-
Notifications
You must be signed in to change notification settings - Fork 1
/
rate.c
666 lines (554 loc) · 19.9 KB
/
rate.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/*
* Copyright (C) 2013 Realtek Semiconductor Corp.
* All Rights Reserved.
*
* This program is the proprietary software of Realtek Semiconductor
* Corporation and/or its licensors, and only be used, duplicated,
* modified or distributed under the authorized license from Realtek.
*
* ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
* THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
*
* $Revision: 79432 $
* $Date: 2017-06-06 16:36:50 +0800 (週二, 06 六月 2017) $
*
* Purpose : RTK switch high-level API for RTL8367/RTL8367C
* Feature : Here is a list of all functions and variables in rate module.
*
*/
#include "rtk_switch.h"
#include "rtk_error.h"
#include "rate.h"
#include "qos.h"
#include "string.h"
#include "rtl8367c_asicdrv.h"
#include "rtl8367c_asicdrv_meter.h"
#include "rtl8367c_asicdrv_inbwctrl.h"
#include "rtl8367c_asicdrv_scheduling.h"
static rtk_api_ret_t _rtk_rate_shareMeter_set(rtk_meter_id_t index, rtk_meter_type_t type, rtk_rate_t rate, rtk_enable_t ifg_include)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
if (index > RTK_MAX_METER_ID)
return RT_ERR_FILTER_METER_ID;
if (type >= METER_TYPE_END)
return RT_ERR_INPUT;
if (ifg_include >= RTK_ENABLE_END)
return RT_ERR_INPUT;
switch (type)
{
case METER_TYPE_KBPS:
if (rate > RTL8367C_QOS_RATE_INPUT_MAX_HSG || rate < RTL8367C_QOS_RATE_INPUT_MIN)
return RT_ERR_RATE;
if ((retVal = rtl8367c_setAsicShareMeter(index, rate >> 3, ifg_include)) != RT_ERR_OK)
return retVal;
break;
case METER_TYPE_PPS:
if (rate > RTL8367C_QOS_PPS_INPUT_MAX || rate < RTL8367C_QOS_PPS_INPUT_MIN)
return RT_ERR_RATE;
if ((retVal = rtl8367c_setAsicShareMeter(index, rate, ifg_include)) != RT_ERR_OK)
return retVal;
break;
default:
return RT_ERR_INPUT;
}
/* Set Type */
if ((retVal = rtl8367c_setAsicShareMeterType(index, (rtk_uint32)type)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_shareMeter_get(rtk_meter_id_t index, rtk_meter_type_t *pType, rtk_rate_t *pRate, rtk_enable_t *pIfg_include)
{
rtk_api_ret_t retVal;
rtk_uint32 regData;
/* Check initialization state */
RTK_CHK_INIT_STATE();
if (index > RTK_MAX_METER_ID)
return RT_ERR_FILTER_METER_ID;
if (NULL == pType)
return RT_ERR_NULL_POINTER;
if (NULL == pRate)
return RT_ERR_NULL_POINTER;
if (NULL == pIfg_include)
return RT_ERR_NULL_POINTER;
if ((retVal = rtl8367c_getAsicShareMeter(index, ®Data, pIfg_include)) != RT_ERR_OK)
return retVal;
if ((retVal = rtl8367c_getAsicShareMeterType(index, (rtk_uint32 *)pType)) != RT_ERR_OK)
return retVal;
if (*pType == METER_TYPE_KBPS)
*pRate = regData << 3;
else
*pRate = regData;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_shareMeterBucket_set(rtk_meter_id_t index, rtk_uint32 bucket_size)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
if (index > RTK_MAX_METER_ID)
return RT_ERR_FILTER_METER_ID;
if (bucket_size > RTL8367C_METERBUCKETSIZEMAX)
return RT_ERR_INPUT;
if ((retVal = rtl8367c_setAsicShareMeterBucketSize(index, bucket_size)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_shareMeterBucket_get(rtk_meter_id_t index, rtk_uint32 *pBucket_size)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
if (index > RTK_MAX_METER_ID)
return RT_ERR_FILTER_METER_ID;
if (NULL == pBucket_size)
return RT_ERR_NULL_POINTER;
if ((retVal = rtl8367c_getAsicShareMeterBucketSize(index, pBucket_size)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_igrBandwidthCtrlRate_set(rtk_port_t port, rtk_rate_t rate, rtk_enable_t ifg_include, rtk_enable_t fc_enable)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (ifg_include >= RTK_ENABLE_END)
return RT_ERR_INPUT;
if (fc_enable >= RTK_ENABLE_END)
return RT_ERR_INPUT;
if (rtk_switch_isHsgPort(port) == RT_ERR_OK)
{
if ((rate > RTL8367C_QOS_RATE_INPUT_MAX_HSG) || (rate < RTL8367C_QOS_RATE_INPUT_MIN))
return RT_ERR_QOS_EBW_RATE;
}
else
{
if ((rate > RTL8367C_QOS_RATE_INPUT_MAX) || (rate < RTL8367C_QOS_RATE_INPUT_MIN))
return RT_ERR_QOS_EBW_RATE;
}
if ((retVal = rtl8367c_setAsicPortIngressBandwidth(rtk_switch_port_L2P_get(port), rate >> 3, ifg_include, fc_enable)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_igrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include, rtk_enable_t *pFc_enable)
{
rtk_api_ret_t retVal;
rtk_uint32 regData;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (NULL == pIfg_include)
return RT_ERR_NULL_POINTER;
if (NULL == pFc_enable)
return RT_ERR_NULL_POINTER;
if ((retVal = rtl8367c_getAsicPortIngressBandwidth(rtk_switch_port_L2P_get(port), ®Data, pIfg_include, pFc_enable)) != RT_ERR_OK)
return retVal;
*pRate = regData << 3;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrBandwidthCtrlRate_set(rtk_port_t port, rtk_rate_t rate, rtk_enable_t ifg_include)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (rtk_switch_isHsgPort(port) == RT_ERR_OK)
{
if ((rate > RTL8367C_QOS_RATE_INPUT_MAX_HSG) || (rate < RTL8367C_QOS_RATE_INPUT_MIN))
return RT_ERR_QOS_EBW_RATE;
}
else
{
if ((rate > RTL8367C_QOS_RATE_INPUT_MAX) || (rate < RTL8367C_QOS_RATE_INPUT_MIN))
return RT_ERR_QOS_EBW_RATE;
}
if (ifg_include >= RTK_ENABLE_END)
return RT_ERR_ENABLE;
if ((retVal = rtl8367c_setAsicPortEgressRate(rtk_switch_port_L2P_get(port), rate >> 3)) != RT_ERR_OK)
return retVal;
if ((retVal = rtl8367c_setAsicPortEgressRateIfg(ifg_include)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include)
{
rtk_api_ret_t retVal;
rtk_uint32 regData;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (NULL == pRate)
return RT_ERR_NULL_POINTER;
if (NULL == pIfg_include)
return RT_ERR_NULL_POINTER;
if ((retVal = rtl8367c_getAsicPortEgressRate(rtk_switch_port_L2P_get(port), ®Data)) != RT_ERR_OK)
return retVal;
*pRate = regData << 3;
if ((retVal = rtl8367c_getAsicPortEgressRateIfg((rtk_uint32 *)pIfg_include)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrQueueBwCtrlEnable_get(rtk_port_t port, rtk_qid_t queue, rtk_enable_t *pEnable)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
/*for whole port function, the queue value should be 0xFF*/
if (queue != RTK_WHOLE_SYSTEM)
return RT_ERR_QUEUE_ID;
if (NULL == pEnable)
return RT_ERR_NULL_POINTER;
if ((retVal = rtl8367c_getAsicAprEnable(rtk_switch_port_L2P_get(port), pEnable)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrQueueBwCtrlEnable_set(rtk_port_t port, rtk_qid_t queue, rtk_enable_t enable)
{
rtk_api_ret_t retVal;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
/*for whole port function, the queue value should be 0xFF*/
if (queue != RTK_WHOLE_SYSTEM)
return RT_ERR_QUEUE_ID;
if (enable >= RTK_ENABLE_END)
return RT_ERR_INPUT;
if ((retVal = rtl8367c_setAsicAprEnable(rtk_switch_port_L2P_get(port), enable)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrQueueBwCtrlRate_get(rtk_port_t port, rtk_qid_t queue, rtk_meter_id_t *pIndex)
{
rtk_api_ret_t retVal;
rtk_uint32 offset_idx;
rtk_uint32 phy_port;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (queue >= RTK_MAX_NUM_OF_QUEUE)
return RT_ERR_QUEUE_ID;
if (NULL == pIndex)
return RT_ERR_NULL_POINTER;
phy_port = rtk_switch_port_L2P_get(port);
if ((retVal = rtl8367c_getAsicAprMeter(phy_port, queue, &offset_idx)) != RT_ERR_OK)
return retVal;
*pIndex = offset_idx + ((phy_port % 4) * 8);
return RT_ERR_OK;
}
static rtk_api_ret_t _rtk_rate_egrQueueBwCtrlRate_set(rtk_port_t port, rtk_qid_t queue, rtk_meter_id_t index)
{
rtk_api_ret_t retVal;
rtk_uint32 offset_idx;
rtk_uint32 phy_port;
/* Check initialization state */
RTK_CHK_INIT_STATE();
/* Check Port Valid */
RTK_CHK_PORT_VALID(port);
if (queue >= RTK_MAX_NUM_OF_QUEUE)
return RT_ERR_QUEUE_ID;
if (index > RTK_MAX_METER_ID)
return RT_ERR_FILTER_METER_ID;
phy_port = rtk_switch_port_L2P_get(port);
if (index < ((phy_port % 4) * 8) || index > (7 + (phy_port % 4) * 8))
return RT_ERR_FILTER_METER_ID;
offset_idx = index - ((phy_port % 4) * 8);
if ((retVal = rtl8367c_setAsicAprMeter(phy_port, queue, offset_idx)) != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtk_rate_shareMeter_set
* Description:
* Set meter configuration
* Input:
* index - shared meter index
* type - shared meter type
* rate - rate of share meter
* ifg_include - include IFG or not, ENABLE:include DISABLE:exclude
* Output:
* None
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_FILTER_METER_ID - Invalid meter
* RT_ERR_RATE - Invalid rate
* RT_ERR_INPUT - Invalid input parameters
* Note:
* The API can set shared meter rate and ifg include for each meter.
* The rate unit is 1 kbps and the range is from 8k to 1048568k if type is METER_TYPE_KBPS and
* the granularity of rate is 8 kbps.
* The rate unit is packets per second and the range is 1 ~ 0x1FFF if type is METER_TYPE_PPS.
* The ifg_include parameter is used
* for rate calculation with/without inter-frame-gap and preamble.
*/
rtk_api_ret_t rtk_rate_shareMeter_set(rtk_meter_id_t index, rtk_meter_type_t type, rtk_rate_t rate, rtk_enable_t ifg_include)
{
return _rtk_rate_shareMeter_set(index, type, rate, ifg_include);
}
/* Function Name:
* rtk_rate_shareMeter_get
* Description:
* Get meter configuration
* Input:
* index - shared meter index
* Output:
* pType - Meter Type
* pRate - pointer of rate of share meter
* pIfg_include - include IFG or not, ENABLE:include DISABLE:exclude
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_FILTER_METER_ID - Invalid meter
* Note:
*
*/
rtk_api_ret_t rtk_rate_shareMeter_get(rtk_meter_id_t index, rtk_meter_type_t *pType, rtk_rate_t *pRate, rtk_enable_t *pIfg_include)
{
return _rtk_rate_shareMeter_get(index, pType, pRate, pIfg_include);
}
/* Function Name:
* rtk_rate_shareMeterBucket_set
* Description:
* Set meter Bucket Size
* Input:
* index - shared meter index
* bucket_size - Bucket Size
* Output:
* None.
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_INPUT - Error Input
* RT_ERR_SMI - SMI access error
* RT_ERR_FILTER_METER_ID - Invalid meter
* Note:
* The API can set shared meter bucket size.
*/
rtk_api_ret_t rtk_rate_shareMeterBucket_set(rtk_meter_id_t index, rtk_uint32 bucket_size)
{
return _rtk_rate_shareMeterBucket_set(index, bucket_size);
}
/* Function Name:
* rtk_rate_shareMeterBucket_get
* Description:
* Get meter Bucket Size
* Input:
* index - shared meter index
* Output:
* pBucket_size - Bucket Size
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_FILTER_METER_ID - Invalid meter
* Note:
* The API can get shared meter bucket size.
*/
rtk_api_ret_t rtk_rate_shareMeterBucket_get(rtk_meter_id_t index, rtk_uint32 *pBucket_size)
{
return _rtk_rate_shareMeterBucket_get(index, pBucket_size);
}
/* Function Name:
* rtk_rate_igrBandwidthCtrlRate_set
* Description:
* Set port ingress bandwidth control
* Input:
* port - Port id
* rate - Rate of share meter
* ifg_include - include IFG or not, ENABLE:include DISABLE:exclude
* fc_enable - enable flow control or not, ENABLE:use flow control DISABLE:drop
* Output:
* None
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number.
* RT_ERR_ENABLE - Invalid IFG parameter.
* RT_ERR_INBW_RATE - Invalid ingress rate parameter.
* Note:
* The rate unit is 1 kbps and the range is from 8k to 1048568k. The granularity of rate is 8 kbps.
* The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble.
*/
rtk_api_ret_t rtk_rate_igrBandwidthCtrlRate_set(rtk_port_t port, rtk_rate_t rate, rtk_enable_t ifg_include, rtk_enable_t fc_enable)
{
return _rtk_rate_igrBandwidthCtrlRate_set(port, rate, ifg_include, fc_enable);
}
/* Function Name:
* rtk_rate_igrBandwidthCtrlRate_get
* Description:
* Get port ingress bandwidth control
* Input:
* port - Port id
* Output:
* pRate - Rate of share meter
* pIfg_include - Rate's calculation including IFG, ENABLE:include DISABLE:exclude
* pFc_enable - enable flow control or not, ENABLE:use flow control DISABLE:drop
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number.
* RT_ERR_INPUT - Invalid input parameters.
* Note:
* The rate unit is 1 kbps and the range is from 8k to 1048568k. The granularity of rate is 8 kbps.
* The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble.
*/
rtk_api_ret_t rtk_rate_igrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include, rtk_enable_t *pFc_enable)
{
return _rtk_rate_igrBandwidthCtrlRate_get(port, pRate, pIfg_include, pFc_enable);
}
/* Function Name:
* rtk_rate_egrBandwidthCtrlRate_set
* Description:
* Set port egress bandwidth control
* Input:
* port - Port id
* rate - Rate of egress bandwidth
* ifg_include - include IFG or not, ENABLE:include DISABLE:exclude
* Output:
* None
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number.
* RT_ERR_INPUT - Invalid input parameters.
* RT_ERR_QOS_EBW_RATE - Invalid egress bandwidth/rate
* Note:
* The rate unit is 1 kbps and the range is from 8k to 1048568k. The granularity of rate is 8 kbps.
* The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble.
*/
rtk_api_ret_t rtk_rate_egrBandwidthCtrlRate_set(rtk_port_t port, rtk_rate_t rate, rtk_enable_t ifg_include)
{
return _rtk_rate_egrBandwidthCtrlRate_set(port, rate, ifg_include);
}
/* Function Name:
* rtk_rate_egrBandwidthCtrlRate_get
* Description:
* Get port egress bandwidth control
* Input:
* port - Port id
* Output:
* pRate - Rate of egress bandwidth
* pIfg_include - Rate's calculation including IFG, ENABLE:include DISABLE:exclude
* Return:
* RT_ERR_OK - OK
* RT_ERR_FAILED - Failed
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number.
* RT_ERR_INPUT - Invalid input parameters.
* Note:
* The rate unit is 1 kbps and the range is from 8k to 1048568k. The granularity of rate is 8 kbps.
* The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble.
*/
rtk_api_ret_t rtk_rate_egrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include)
{
return _rtk_rate_egrBandwidthCtrlRate_get(port, pRate, pIfg_include);
}
/* Function Name:
* rtk_rate_egrQueueBwCtrlEnable_get
* Description:
* Get enable status of egress bandwidth control on specified queue.
* Input:
* unit - unit id
* port - port id
* queue - queue id
* Output:
* pEnable - Pointer to enable status of egress queue bandwidth control
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_PORT_ID - invalid port id
* RT_ERR_QUEUE_ID - invalid queue id
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
* None
*/
rtk_api_ret_t rtk_rate_egrQueueBwCtrlEnable_get(rtk_port_t port, rtk_qid_t queue, rtk_enable_t *pEnable)
{
return _rtk_rate_egrQueueBwCtrlEnable_get(port, queue, pEnable);
}
/* Function Name:
* rtk_rate_egrQueueBwCtrlEnable_set
* Description:
* Set enable status of egress bandwidth control on specified queue.
* Input:
* port - port id
* queue - queue id
* enable - enable status of egress queue bandwidth control
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_PORT_ID - invalid port id
* RT_ERR_QUEUE_ID - invalid queue id
* RT_ERR_INPUT - invalid input parameter
* Note:
* None
*/
rtk_api_ret_t rtk_rate_egrQueueBwCtrlEnable_set(rtk_port_t port, rtk_qid_t queue, rtk_enable_t enable)
{
return _rtk_rate_egrQueueBwCtrlEnable_set(port, queue, enable);
}
/* Function Name:
* rtk_rate_egrQueueBwCtrlRate_get
* Description:
* Get rate of egress bandwidth control on specified queue.
* Input:
* port - port id
* queue - queue id
* pIndex - shared meter index
* Output:
* pRate - pointer to rate of egress queue bandwidth control
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_PORT_ID - invalid port id
* RT_ERR_QUEUE_ID - invalid queue id
* RT_ERR_FILTER_METER_ID - Invalid meter id
* Note:
* The actual rate control is set in shared meters.
* The unit of granularity is 8Kbps.
*/
rtk_api_ret_t rtk_rate_egrQueueBwCtrlRate_get(rtk_port_t port, rtk_qid_t queue, rtk_meter_id_t *pIndex)
{
return _rtk_rate_egrQueueBwCtrlRate_get(port, queue, pIndex);
}
/* Function Name:
* rtk_rate_egrQueueBwCtrlRate_set
* Description:
* Set rate of egress bandwidth control on specified queue.
* Input:
* port - port id
* queue - queue id
* index - shared meter index
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_PORT_ID - invalid port id
* RT_ERR_QUEUE_ID - invalid queue id
* RT_ERR_FILTER_METER_ID - Invalid meter id
* Note:
* The actual rate control is set in shared meters.
* The unit of granularity is 8Kbps.
*/
rtk_api_ret_t rtk_rate_egrQueueBwCtrlRate_set(rtk_port_t port, rtk_qid_t queue, rtk_meter_id_t index)
{
return _rtk_rate_egrQueueBwCtrlRate_set(port, queue, index);
}