mediatek: mt7622: rtl8367c: source comment fixes
[openwrt/staging/stintel.git] / target / linux / mediatek / files / drivers / net / phy / rtk / rtl8367c / rtl8367c_asicdrv_fc.c
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 * $Revision: 76306 $
11 * $Date: 2017-03-08 15:13:58 +0800 (週三, 08 三月 2017) $
12 *
13 * Purpose : RTL8367C switch high-level API for RTL8367C
14 * Feature : Flow control related functions
15 *
16 */
17
18 #include <rtl8367c_asicdrv_fc.h>
19 /* Function Name:
20 * rtl8367c_setAsicFlowControlSelect
21 * Description:
22 * Set system flow control type
23 * Input:
24 * select - System flow control type 1: Ingress flow control 0:Egress flow control
25 * Output:
26 * None
27 * Return:
28 * RT_ERR_OK - Success
29 * RT_ERR_SMI - SMI access error
30 * Note:
31 * None
32 */
33 ret_t rtl8367c_setAsicFlowControlSelect(rtk_uint32 select)
34 {
35 return rtl8367c_setAsicRegBit(RTL8367C_REG_FLOWCTRL_CTRL0, RTL8367C_FLOWCTRL_TYPE_OFFSET, select);
36 }
37 /* Function Name:
38 * rtl8367c_getAsicFlowControlSelect
39 * Description:
40 * Get system flow control type
41 * Input:
42 * pSelect - System flow control type 1: Ingress flow control 0:Egress flow control
43 * Output:
44 * None
45 * Return:
46 * RT_ERR_OK - Success
47 * RT_ERR_SMI - SMI access error
48 * Note:
49 * None
50 */
51 ret_t rtl8367c_getAsicFlowControlSelect(rtk_uint32 *pSelect)
52 {
53 return rtl8367c_getAsicRegBit(RTL8367C_REG_FLOWCTRL_CTRL0, RTL8367C_FLOWCTRL_TYPE_OFFSET, pSelect);
54 }
55 /* Function Name:
56 * rtl8367c_setAsicFlowControlJumboMode
57 * Description:
58 * Set Jumbo threshold for flow control
59 * Input:
60 * enabled - Jumbo mode flow control 1: Enable 0:Disable
61 * Output:
62 * None
63 * Return:
64 * RT_ERR_OK - Success
65 * RT_ERR_SMI - SMI access error
66 * Note:
67 * None
68 */
69 ret_t rtl8367c_setAsicFlowControlJumboMode(rtk_uint32 enabled)
70 {
71 return rtl8367c_setAsicRegBit(RTL8367C_REG_FLOWCTRL_JUMBO_SIZE, RTL8367C_JUMBO_MODE_OFFSET, enabled);
72 }
73 /* Function Name:
74 * rtl8367c_getAsicFlowControlJumboMode
75 * Description:
76 * Get Jumbo threshold for flow control
77 * Input:
78 * pEnabled - Jumbo mode flow control 1: Enable 0:Disable
79 * Output:
80 * None
81 * Return:
82 * RT_ERR_OK - Success
83 * RT_ERR_SMI - SMI access error
84 * Note:
85 * None
86 */
87 ret_t rtl8367c_getAsicFlowControlJumboMode(rtk_uint32* pEnabled)
88 {
89 return rtl8367c_getAsicRegBit(RTL8367C_REG_FLOWCTRL_JUMBO_SIZE, RTL8367C_JUMBO_MODE_OFFSET, pEnabled);
90 }
91 /* Function Name:
92 * rtl8367c_setAsicFlowControlJumboModeSize
93 * Description:
94 * Set Jumbo size for Jumbo mode flow control
95 * Input:
96 * size - Jumbo size 0:3Kbytes 1:4Kbytes 2:6Kbytes 3:9Kbytes
97 * Output:
98 * None
99 * Return:
100 * RT_ERR_OK - Success
101 * RT_ERR_SMI - SMI access error
102 * RT_ERR_OUT_OF_RANGE - input parameter out of range
103 * Note:
104 * None
105 */
106 ret_t rtl8367c_setAsicFlowControlJumboModeSize(rtk_uint32 size)
107 {
108 if(size >= FC_JUMBO_SIZE_END)
109 return RT_ERR_OUT_OF_RANGE;
110
111 return rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SIZE, RTL8367C_JUMBO_SIZE_MASK, size);
112 }
113 /* Function Name:
114 * rtl8367c_getAsicFlowControlJumboModeSize
115 * Description:
116 * Get Jumbo size for Jumbo mode flow control
117 * Input:
118 * pSize - Jumbo size 0:3Kbytes 1:4Kbytes 2:6Kbytes 3:9Kbytes
119 * Output:
120 * None
121 * Return:
122 * RT_ERR_OK - Success
123 * RT_ERR_SMI - SMI access error
124 * Note:
125 * None
126 */
127 ret_t rtl8367c_getAsicFlowControlJumboModeSize(rtk_uint32* pSize)
128 {
129 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SIZE, RTL8367C_JUMBO_SIZE_MASK, pSize);
130 }
131
132 /* Function Name:
133 * rtl8367c_setAsicFlowControlQueueEgressEnable
134 * Description:
135 * Set flow control ability for each queue
136 * Input:
137 * port - Physical port number (0~7)
138 * qid - Queue id
139 * enabled - 1: enabled, 0: disabled
140 * Output:
141 * None
142 * Return:
143 * RT_ERR_OK - Success
144 * RT_ERR_SMI - SMI access error
145 * RT_ERR_PORT_ID - Invalid port number
146 * RT_ERR_QUEUE_ID - Invalid queue id
147 * Note:
148 * None
149 */
150 ret_t rtl8367c_setAsicFlowControlQueueEgressEnable(rtk_uint32 port, rtk_uint32 qid, rtk_uint32 enabled)
151 {
152 if(port > RTL8367C_PORTIDMAX)
153 return RT_ERR_PORT_ID;
154
155 if(qid > RTL8367C_QIDMAX)
156 return RT_ERR_QUEUE_ID;
157
158 return rtl8367c_setAsicRegBit(RTL8367C_FLOWCRTL_EGRESS_QUEUE_ENABLE_REG(port), RTL8367C_FLOWCRTL_EGRESS_QUEUE_ENABLE_REG_OFFSET(port)+ qid, enabled);
159 }
160 /* Function Name:
161 * rtl8367c_getAsicFlowControlQueueEgressEnable
162 * Description:
163 * Get flow control ability for each queue
164 * Input:
165 * port - Physical port number (0~7)
166 * qid - Queue id
167 * pEnabled - 1: enabled, 0: disabled
168 * Output:
169 * None
170 * Return:
171 * RT_ERR_OK - Success
172 * RT_ERR_SMI - SMI access error
173 * RT_ERR_PORT_ID - Invalid port number
174 * RT_ERR_QUEUE_ID - Invalid queue id
175 * Note:
176 * None
177 */
178 ret_t rtl8367c_getAsicFlowControlQueueEgressEnable(rtk_uint32 port, rtk_uint32 qid, rtk_uint32* pEnabled)
179 {
180 if(port > RTL8367C_PORTIDMAX)
181 return RT_ERR_PORT_ID;
182
183 if(qid > RTL8367C_QIDMAX)
184 return RT_ERR_QUEUE_ID;
185
186 return rtl8367c_getAsicRegBit(RTL8367C_FLOWCRTL_EGRESS_QUEUE_ENABLE_REG(port), RTL8367C_FLOWCRTL_EGRESS_QUEUE_ENABLE_REG_OFFSET(port)+ qid, pEnabled);
187 }
188 /* Function Name:
189 * rtl8367c_setAsicFlowControlDropAll
190 * Description:
191 * Set system-based drop parameters
192 * Input:
193 * dropall - Whole system drop threshold
194 * Output:
195 * None
196 * Return:
197 * RT_ERR_OK - Success
198 * RT_ERR_SMI - SMI access error
199 * RT_ERR_OUT_OF_RANGE - input parameter out of range
200 * Note:
201 * None
202 */
203 ret_t rtl8367c_setAsicFlowControlDropAll(rtk_uint32 dropall)
204 {
205 if(dropall >= RTL8367C_PAGE_NUMBER)
206 return RT_ERR_OUT_OF_RANGE;
207
208 return rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_CTRL0, RTL8367C_DROP_ALL_THRESHOLD_MASK, dropall);
209 }
210 /* Function Name:
211 * rtl8367c_getAsicFlowControlDropAll
212 * Description:
213 * Get system-based drop parameters
214 * Input:
215 * pDropall - Whole system drop threshold
216 * Output:
217 * None
218 * Return:
219 * RT_ERR_OK - Success
220 * RT_ERR_SMI - SMI access error
221 * Note:
222 * None
223 */
224 ret_t rtl8367c_getAsicFlowControlDropAll(rtk_uint32* pDropall)
225 {
226 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_CTRL0, RTL8367C_DROP_ALL_THRESHOLD_MASK, pDropall);
227 }
228 /* Function Name:
229 * rtl8367c_setAsicFlowControlPauseAll
230 * Description:
231 * Set system-based all ports enable flow control parameters
232 * Input:
233 * threshold - Whole system pause all threshold
234 * Output:
235 * None
236 * Return:
237 * RT_ERR_OK - Success
238 * RT_ERR_SMI - SMI access error
239 * RT_ERR_OUT_OF_RANGE - input parameter out of range
240 * Note:
241 * None
242 */
243 ret_t rtl8367c_setAsicFlowControlPauseAllThreshold(rtk_uint32 threshold)
244 {
245 if(threshold >= RTL8367C_PAGE_NUMBER)
246 return RT_ERR_OUT_OF_RANGE;
247
248 return rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_ALL_ON, RTL8367C_FLOWCTRL_ALL_ON_THRESHOLD_MASK, threshold);
249 }
250 /* Function Name:
251 * rtl8367c_getAsicFlowControlPauseAllThreshold
252 * Description:
253 * Get system-based all ports enable flow control parameters
254 * Input:
255 * pThreshold - Whole system pause all threshold
256 * Output:
257 * None
258 * Return:
259 * RT_ERR_OK - Success
260 * RT_ERR_SMI - SMI access error
261 * Note:
262 * None
263 */
264 ret_t rtl8367c_getAsicFlowControlPauseAllThreshold(rtk_uint32 *pThreshold)
265 {
266 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_ALL_ON, RTL8367C_FLOWCTRL_ALL_ON_THRESHOLD_MASK, pThreshold);
267 }
268 /* Function Name:
269 * rtl8367c_setAsicFlowControlSystemThreshold
270 * Description:
271 * Set system-based flow control parameters
272 * Input:
273 * onThreshold - Flow control turn ON threshold
274 * offThreshold - Flow control turn OFF threshold
275 * Output:
276 * None
277 * Return:
278 * RT_ERR_OK - Success
279 * RT_ERR_SMI - SMI access error
280 * RT_ERR_OUT_OF_RANGE - input parameter out of range
281 * Note:
282 * None
283 */
284 ret_t rtl8367c_setAsicFlowControlSystemThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
285 {
286 ret_t retVal;
287
288 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
289 return RT_ERR_OUT_OF_RANGE;
290
291 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_SYS_OFF, RTL8367C_FLOWCTRL_SYS_OFF_MASK, offThreshold);
292
293 if(retVal != RT_ERR_OK)
294 return retVal;
295
296 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_SYS_ON, RTL8367C_FLOWCTRL_SYS_ON_MASK, onThreshold);
297
298 return retVal;
299 }
300 /* Function Name:
301 * rtl8367c_getAsicFlowControlSystemThreshold
302 * Description:
303 * Get system-based flow control parameters
304 * Input:
305 * pOnThreshold - Flow control turn ON threshold
306 * pOffThreshold - Flow control turn OFF threshold
307 * Output:
308 * None
309 * Return:
310 * RT_ERR_OK - Success
311 * RT_ERR_SMI - SMI access error
312 * Note:
313 * None
314 */
315 ret_t rtl8367c_getAsicFlowControlSystemThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
316 {
317 ret_t retVal;
318
319 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_SYS_OFF, RTL8367C_FLOWCTRL_SYS_OFF_MASK, pOffThreshold);
320
321 if(retVal != RT_ERR_OK)
322 return retVal;
323
324 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_SYS_ON, RTL8367C_FLOWCTRL_SYS_ON_MASK, pOnThreshold);
325
326 return retVal;
327 }
328 /* Function Name:
329 * rtl8367c_setAsicFlowControlSharedThreshold
330 * Description:
331 * Set share-based flow control parameters
332 * Input:
333 * onThreshold - Flow control turn ON threshold
334 * offThreshold - Flow control turn OFF threshold
335 * Output:
336 * None
337 * Return:
338 * RT_ERR_OK - Success
339 * RT_ERR_SMI - SMI access error
340 * RT_ERR_OUT_OF_RANGE - input parameter out of range
341 * Note:
342 * None
343 */
344 ret_t rtl8367c_setAsicFlowControlSharedThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
345 {
346 ret_t retVal;
347
348 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
349 return RT_ERR_OUT_OF_RANGE;
350
351 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_SHARE_OFF, RTL8367C_FLOWCTRL_SHARE_OFF_MASK, offThreshold);
352
353 if(retVal != RT_ERR_OK)
354 return retVal;
355
356 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_SHARE_ON, RTL8367C_FLOWCTRL_SHARE_ON_MASK, onThreshold);
357
358 return retVal;
359 }
360 /* Function Name:
361 * rtl8367c_getAsicFlowControlSharedThreshold
362 * Description:
363 * Get share-based flow control parameters
364 * Input:
365 * pOnThreshold - Flow control turn ON threshold
366 * pOffThreshold - Flow control turn OFF threshold
367 * Output:
368 * None
369 * Return:
370 * RT_ERR_OK - Success
371 * RT_ERR_SMI - SMI access error
372 * Note:
373 * None
374 */
375 ret_t rtl8367c_getAsicFlowControlSharedThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
376 {
377 ret_t retVal;
378
379 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_SHARE_OFF, RTL8367C_FLOWCTRL_SHARE_OFF_MASK, pOffThreshold);
380
381 if(retVal != RT_ERR_OK)
382 return retVal;
383
384 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_SHARE_ON, RTL8367C_FLOWCTRL_SHARE_ON_MASK, pOnThreshold);
385
386 return retVal;
387 }
388 /* Function Name:
389 * rtl8367c_setAsicFlowControlPortThreshold
390 * Description:
391 * Set Port-based flow control parameters
392 * Input:
393 * onThreshold - Flow control turn ON threshold
394 * offThreshold - Flow control turn OFF threshold
395 * Output:
396 * None
397 * Return:
398 * RT_ERR_OK - Success
399 * RT_ERR_SMI - SMI access error
400 * RT_ERR_OUT_OF_RANGE - input parameter out of range
401 * Note:
402 * None
403 */
404 ret_t rtl8367c_setAsicFlowControlPortThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
405 {
406 ret_t retVal;
407
408 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
409 return RT_ERR_OUT_OF_RANGE;
410
411 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_OFF, RTL8367C_FLOWCTRL_PORT_OFF_MASK, offThreshold);
412
413 if(retVal != RT_ERR_OK)
414 return retVal;
415
416 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_ON, RTL8367C_FLOWCTRL_PORT_ON_MASK, onThreshold);
417
418 return retVal;
419 }
420 /* Function Name:
421 * rtl8367c_getAsicFlowControlPortThreshold
422 * Description:
423 * Get Port-based flow control parameters
424 * Input:
425 * pOnThreshold - Flow control turn ON threshold
426 * pOffThreshold - Flow control turn OFF threshold
427 * Output:
428 * None
429 * Return:
430 * RT_ERR_OK - Success
431 * RT_ERR_SMI - SMI access error
432 * Note:
433 * None
434 */
435 ret_t rtl8367c_getAsicFlowControlPortThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
436 {
437 ret_t retVal;
438
439 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_OFF, RTL8367C_FLOWCTRL_PORT_OFF_MASK, pOffThreshold);
440
441 if(retVal != RT_ERR_OK)
442 return retVal;
443
444 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_ON, RTL8367C_FLOWCTRL_PORT_ON_MASK, pOnThreshold);
445
446 return retVal;
447 }
448 /* Function Name:
449 * rtl8367c_setAsicFlowControlPortPrivateThreshold
450 * Description:
451 * Set Port-private-based flow control parameters
452 * Input:
453 * onThreshold - Flow control turn ON threshold
454 * offThreshold - Flow control turn OFF threshold
455 * Output:
456 * None
457 * Return:
458 * RT_ERR_OK - Success
459 * RT_ERR_SMI - SMI access error
460 * RT_ERR_OUT_OF_RANGE - input parameter out of range
461 * Note:
462 * None
463 */
464 ret_t rtl8367c_setAsicFlowControlPortPrivateThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
465 {
466 ret_t retVal;
467
468 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
469 return RT_ERR_OUT_OF_RANGE;
470
471 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_PORT_PRIVATE_OFF_MASK, offThreshold);
472
473 if(retVal != RT_ERR_OK)
474 return retVal;
475
476 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_PORT_PRIVATE_ON_MASK, onThreshold);
477
478 return retVal;
479 }
480 /* Function Name:
481 * rtl8367c_getAsicFlowControlPortPrivateThreshold
482 * Description:
483 * Get Port-private-based flow control parameters
484 * Input:
485 * pOnThreshold - Flow control turn ON threshold
486 * pOffThreshold - Flow control turn OFF threshold
487 * Output:
488 * None
489 * Return:
490 * RT_ERR_OK - Success
491 * RT_ERR_SMI - SMI access error
492 * Note:
493 * None
494 */
495 ret_t rtl8367c_getAsicFlowControlPortPrivateThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
496 {
497 ret_t retVal;
498
499 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_PORT_PRIVATE_OFF_MASK, pOffThreshold);
500
501 if(retVal != RT_ERR_OK)
502 return retVal;
503
504 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_PORT_PRIVATE_ON_MASK, pOnThreshold);
505
506 return retVal;
507 }
508 /* Function Name:
509 * rtl8367c_setAsicFlowControlSystemDropThreshold
510 * Description:
511 * Set system-based drop parameters
512 * Input:
513 * onThreshold - Drop turn ON threshold
514 * offThreshold - Drop turn OFF threshold
515 * Output:
516 * None
517 * Return:
518 * RT_ERR_OK - Success
519 * RT_ERR_SMI - SMI access error
520 * RT_ERR_OUT_OF_RANGE - input parameter out of range
521 * Note:
522 * None
523 */
524 ret_t rtl8367c_setAsicFlowControlSystemDropThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
525 {
526 ret_t retVal;
527
528 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
529 return RT_ERR_OUT_OF_RANGE;
530
531 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SYS_OFF, RTL8367C_FLOWCTRL_FCOFF_SYS_OFF_MASK, offThreshold);
532
533 if(retVal != RT_ERR_OK)
534 return retVal;
535
536 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SYS_ON, RTL8367C_FLOWCTRL_FCOFF_SYS_ON_MASK, onThreshold);
537
538 return retVal;
539 }
540 /* Function Name:
541 * rtl8367c_getAsicFlowControlSystemDropThreshold
542 * Description:
543 * Get system-based drop parameters
544 * Input:
545 * pOnThreshold - Drop turn ON threshold
546 * pOffThreshold - Drop turn OFF threshold
547 * Output:
548 * None
549 * Return:
550 * RT_ERR_OK - Success
551 * RT_ERR_SMI - SMI access error
552 * Note:
553 * None
554 */
555 ret_t rtl8367c_getAsicFlowControlSystemDropThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
556 {
557 ret_t retVal;
558
559 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SYS_OFF, RTL8367C_FLOWCTRL_FCOFF_SYS_OFF_MASK, pOffThreshold);
560
561 if(retVal != RT_ERR_OK)
562 return retVal;
563
564 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SYS_ON, RTL8367C_FLOWCTRL_FCOFF_SYS_ON_MASK, pOnThreshold);
565
566 return retVal;
567 }
568 /* Function Name:
569 * rtl8367c_setAsicFlowControlSharedDropThreshold
570 * Description:
571 * Set share-based fdrop parameters
572 * Input:
573 * onThreshold - Drop turn ON threshold
574 * offThreshold - Drop turn OFF threshold
575 * Output:
576 * None
577 * Return:
578 * RT_ERR_OK - Success
579 * RT_ERR_SMI - SMI access error
580 * RT_ERR_OUT_OF_RANGE - input parameter out of range
581 * Note:
582 * None
583 */
584 ret_t rtl8367c_setAsicFlowControlSharedDropThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
585 {
586 ret_t retVal;
587
588 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
589 return RT_ERR_OUT_OF_RANGE;
590
591 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SHARE_OFF, RTL8367C_FLOWCTRL_FCOFF_SHARE_OFF_MASK, offThreshold);
592 if(retVal != RT_ERR_OK)
593 return retVal;
594
595 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SHARE_ON, RTL8367C_FLOWCTRL_FCOFF_SHARE_ON_MASK, onThreshold);
596
597 return retVal;
598 }
599 /* Function Name:
600 * rtl8367c_getAsicFlowControlSharedDropThreshold
601 * Description:
602 * Get share-based fdrop parameters
603 * Input:
604 * pOnThreshold - Drop turn ON threshold
605 * pOffThreshold - Drop turn OFF threshold
606 * Output:
607 * None
608 * Return:
609 * RT_ERR_OK - Success
610 * RT_ERR_SMI - SMI access error
611 * Note:
612 * None
613 */
614 ret_t rtl8367c_getAsicFlowControlSharedDropThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
615 {
616 ret_t retVal;
617
618 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SHARE_OFF, RTL8367C_FLOWCTRL_FCOFF_SHARE_OFF_MASK, pOffThreshold);
619 if(retVal != RT_ERR_OK)
620 return retVal;
621
622 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_SHARE_ON, RTL8367C_FLOWCTRL_FCOFF_SHARE_ON_MASK, pOnThreshold);
623
624 return retVal;
625 }
626 /* Function Name:
627 * rtl8367c_setAsicFlowControlPortDropThreshold
628 * Description:
629 * Set Port-based drop parameters
630 * Input:
631 * onThreshold - Drop turn ON threshold
632 * offThreshold - Drop turn OFF threshold
633 * Output:
634 * None
635 * Return:
636 * RT_ERR_OK - Success
637 * RT_ERR_SMI - SMI access error
638 * RT_ERR_OUT_OF_RANGE - input parameter out of range
639 * Note:
640 * None
641 */
642 ret_t rtl8367c_setAsicFlowControlPortDropThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
643 {
644 ret_t retVal;
645
646 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
647 return RT_ERR_OUT_OF_RANGE;
648
649 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_OFF, RTL8367C_FLOWCTRL_FCOFF_PORT_OFF_MASK, offThreshold);
650
651 if(retVal != RT_ERR_OK)
652 return retVal;
653
654 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_ON, RTL8367C_FLOWCTRL_FCOFF_PORT_ON_MASK, onThreshold);
655
656 return retVal;
657 }
658 /* Function Name:
659 * rtl8367c_getAsicFlowControlPortDropThreshold
660 * Description:
661 * Get Port-based drop parameters
662 * Input:
663 * pOnThreshold - Drop turn ON threshold
664 * pOffThreshold - Drop turn OFF threshold
665 * Output:
666 * None
667 * Return:
668 * RT_ERR_OK - Success
669 * RT_ERR_SMI - SMI access error
670 * Note:
671 * None
672 */
673 ret_t rtl8367c_getAsicFlowControlPortDropThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
674 {
675 ret_t retVal;
676
677 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_OFF, RTL8367C_FLOWCTRL_FCOFF_PORT_OFF_MASK, pOffThreshold);
678 if(retVal != RT_ERR_OK)
679 return retVal;
680
681 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_ON, RTL8367C_FLOWCTRL_FCOFF_PORT_ON_MASK, pOnThreshold);
682
683 return retVal;
684 }
685 /* Function Name:
686 * rtl8367c_setAsicFlowControlPortPrivateDropThreshold
687 * Description:
688 * Set Port-private-based drop parameters
689 * Input:
690 * onThreshold - Drop turn ON threshold
691 * offThreshold - Drop turn OFF threshold
692 * Output:
693 * None
694 * Return:
695 * RT_ERR_OK - Success
696 * RT_ERR_SMI - SMI access error
697 * RT_ERR_OUT_OF_RANGE - input parameter out of range
698 * Note:
699 * None
700 */
701 ret_t rtl8367c_setAsicFlowControlPortPrivateDropThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
702 {
703 ret_t retVal;
704
705 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
706 return RT_ERR_OUT_OF_RANGE;
707
708 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_FCOFF_PORT_PRIVATE_OFF_MASK, offThreshold);
709
710 if(retVal != RT_ERR_OK)
711 return retVal;
712
713 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_FCOFF_PORT_PRIVATE_ON_MASK, onThreshold);
714
715 return retVal;
716 }
717 /* Function Name:
718 * rtl8367c_getAsicFlowControlPortPrivateDropThreshold
719 * Description:
720 * Get Port-private-based drop parameters
721 * Input:
722 * pOnThreshold - Drop turn ON threshold
723 * pOffThreshold - Drop turn OFF threshold
724 * Output:
725 * None
726 * Return:
727 * RT_ERR_OK - Success
728 * RT_ERR_SMI - SMI access error
729 * Note:
730 * None
731 */
732 ret_t rtl8367c_getAsicFlowControlPortPrivateDropThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
733 {
734 ret_t retVal;
735
736 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_FCOFF_PORT_PRIVATE_OFF_MASK, pOffThreshold);
737 if(retVal != RT_ERR_OK)
738 return retVal;
739
740 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_FCOFF_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_FCOFF_PORT_PRIVATE_ON_MASK, pOnThreshold);
741
742 return retVal;
743 }
744 /* Function Name:
745 * rtl8367c_setAsicFlowControlSystemJumboThreshold
746 * Description:
747 * Set Jumbo system-based flow control parameters
748 * Input:
749 * onThreshold - Flow control turn ON threshold
750 * offThreshold - Flow control turn OFF threshold
751 * Output:
752 * None
753 * Return:
754 * RT_ERR_OK - Success
755 * RT_ERR_SMI - SMI access error
756 * RT_ERR_OUT_OF_RANGE - input parameter out of range
757 * Note:
758 * None
759 */
760 ret_t rtl8367c_setAsicFlowControlSystemJumboThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
761 {
762 ret_t retVal;
763
764 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
765 return RT_ERR_OUT_OF_RANGE;
766
767 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SYS_OFF, RTL8367C_FLOWCTRL_JUMBO_SYS_OFF_MASK, offThreshold);
768
769 if(retVal != RT_ERR_OK)
770 return retVal;
771
772 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SYS_ON, RTL8367C_FLOWCTRL_JUMBO_SYS_ON_MASK, onThreshold);
773
774 return retVal;
775 }
776 /* Function Name:
777 * rtl8367c_getAsicFlowControlSystemJumboThreshold
778 * Description:
779 * Get Jumbo system-based flow control parameters
780 * Input:
781 * pOnThreshold - Flow control turn ON threshold
782 * pOffThreshold - Flow control turn OFF threshold
783 * Output:
784 * None
785 * Return:
786 * RT_ERR_OK - Success
787 * RT_ERR_SMI - SMI access error
788 * Note:
789 * None
790 */
791 ret_t rtl8367c_getAsicFlowControlSystemJumboThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
792 {
793 ret_t retVal;
794
795 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SYS_OFF, RTL8367C_FLOWCTRL_JUMBO_SYS_OFF_MASK, pOffThreshold);
796
797 if(retVal != RT_ERR_OK)
798 return retVal;
799
800 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SYS_ON, RTL8367C_FLOWCTRL_JUMBO_SYS_ON_MASK, pOnThreshold);
801
802 return retVal;
803 }
804 /* Function Name:
805 * rtl8367c_setAsicFlowControlSharedJumboThreshold
806 * Description:
807 * Set Jumbo share-based flow control parameters
808 * Input:
809 * onThreshold - Flow control turn ON threshold
810 * offThreshold - Flow control turn OFF threshold
811 * Output:
812 * None
813 * Return:
814 * RT_ERR_OK - Success
815 * RT_ERR_SMI - SMI access error
816 * RT_ERR_OUT_OF_RANGE - input parameter out of range
817 * Note:
818 * None
819 */
820 ret_t rtl8367c_setAsicFlowControlSharedJumboThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
821 {
822 ret_t retVal;
823
824 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
825 return RT_ERR_OUT_OF_RANGE;
826
827 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SHARE_OFF, RTL8367C_FLOWCTRL_JUMBO_SHARE_OFF_MASK, offThreshold);
828
829 if(retVal != RT_ERR_OK)
830 return retVal;
831
832 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SHARE_ON, RTL8367C_FLOWCTRL_JUMBO_SHARE_ON_MASK, onThreshold);
833
834 return retVal;
835 }
836 /* Function Name:
837 * rtl8367c_getAsicFlowControlSharedJumboThreshold
838 * Description:
839 * Get Jumbo share-based flow control parameters
840 * Input:
841 * pOnThreshold - Flow control turn ON threshold
842 * pOffThreshold - Flow control turn OFF threshold
843 * Output:
844 * None
845 * Return:
846 * RT_ERR_OK - Success
847 * RT_ERR_SMI - SMI access error
848 * Note:
849 * None
850 */
851 ret_t rtl8367c_getAsicFlowControlSharedJumboThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
852 {
853 ret_t retVal;
854
855 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SHARE_OFF, RTL8367C_FLOWCTRL_JUMBO_SHARE_OFF_MASK, pOffThreshold);
856
857 if(retVal != RT_ERR_OK)
858 return retVal;
859
860 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_SHARE_ON, RTL8367C_FLOWCTRL_JUMBO_SHARE_ON_MASK, pOnThreshold);
861
862 return retVal;
863 }
864 /* Function Name:
865 * rtl8367c_setAsicFlowControlPortJumboThreshold
866 * Description:
867 * Set Jumbo Port-based flow control parameters
868 * Input:
869 * onThreshold - Flow control turn ON threshold
870 * offThreshold - Flow control turn OFF threshold
871 * Output:
872 * None
873 * Return:
874 * RT_ERR_OK - Success
875 * RT_ERR_SMI - SMI access error
876 * RT_ERR_OUT_OF_RANGE - input parameter out of range
877 * Note:
878 * None
879 */
880 ret_t rtl8367c_setAsicFlowControlPortJumboThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
881 {
882 ret_t retVal;
883
884 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
885 return RT_ERR_OUT_OF_RANGE;
886
887 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_OFF, RTL8367C_FLOWCTRL_JUMBO_PORT_OFF_MASK, offThreshold);
888
889 if(retVal != RT_ERR_OK)
890 return retVal;
891
892 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_ON, RTL8367C_FLOWCTRL_JUMBO_PORT_ON_MASK, onThreshold);
893
894 return retVal;
895 }
896 /* Function Name:
897 * rtl8367c_getAsicFlowControlPortJumboThreshold
898 * Description:
899 * Get Jumbo Port-based flow control parameters
900 * Input:
901 * pOnThreshold - Flow control turn ON threshold
902 * pOffThreshold - Flow control turn OFF threshold
903 * Output:
904 * None
905 * Return:
906 * RT_ERR_OK - Success
907 * RT_ERR_SMI - SMI access error
908 * Note:
909 * None
910 */
911 ret_t rtl8367c_getAsicFlowControlPortJumboThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
912 {
913 ret_t retVal;
914
915 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_OFF, RTL8367C_FLOWCTRL_JUMBO_PORT_OFF_MASK, pOffThreshold);
916
917 if(retVal != RT_ERR_OK)
918 return retVal;
919
920 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_ON, RTL8367C_FLOWCTRL_JUMBO_PORT_ON_MASK, pOnThreshold);
921
922 return retVal;
923 }
924 /* Function Name:
925 * rtl8367c_setAsicFlowControlPortPrivateJumboThreshold
926 * Description:
927 * Set Jumbo Port-private-based flow control parameters
928 * Input:
929 * onThreshold - Flow control turn ON threshold
930 * offThreshold - Flow control turn OFF threshold
931 * Output:
932 * None
933 * Return:
934 * RT_ERR_OK - Success
935 * RT_ERR_SMI - SMI access error
936 * RT_ERR_OUT_OF_RANGE - input parameter out of range
937 * Note:
938 * None
939 */
940 ret_t rtl8367c_setAsicFlowControlPortPrivateJumboThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
941 {
942 ret_t retVal;
943
944 if((onThreshold >= RTL8367C_PAGE_NUMBER) || (offThreshold >= RTL8367C_PAGE_NUMBER))
945 return RT_ERR_OUT_OF_RANGE;
946
947 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF_MASK, offThreshold);
948
949 if(retVal != RT_ERR_OK)
950 return retVal;
951
952 retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_JUMBO_PORT_PRIVATE_ON_MASK, onThreshold);
953
954 return retVal;
955 }
956 /* Function Name:
957 * rtl8367c_getAsicFlowControlPortPrivateJumboThreshold
958 * Description:
959 * Get Jumbo Port-private-based flow control parameters
960 * Input:
961 * pOnThreshold - Flow control turn ON threshold
962 * pOffThreshold - Flow control turn OFF threshold
963 * Output:
964 * None
965 * Return:
966 * RT_ERR_OK - Success
967 * RT_ERR_SMI - SMI access error
968 * Note:
969 * None
970 */
971 ret_t rtl8367c_getAsicFlowControlPortPrivateJumboThreshold(rtk_uint32 *pOnThreshold, rtk_uint32 *pOffThreshold)
972 {
973 ret_t retVal;
974
975 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF, RTL8367C_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF_MASK, pOffThreshold);
976
977 if(retVal != RT_ERR_OK)
978 return retVal;
979
980 retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_ON, RTL8367C_FLOWCTRL_JUMBO_PORT_PRIVATE_ON_MASK, pOnThreshold);
981
982 return retVal;
983 }
984
985
986
987 /* Function Name:
988 * rtl8367c_setAsicEgressFlowControlQueueDropThreshold
989 * Description:
990 * Set Queue-based egress flow control turn on or ingress flow control drop on threshold
991 * Input:
992 * qid - The queue id
993 * threshold - Queue-based flown control/drop turn ON threshold
994 * Output:
995 * None
996 * Return:
997 * RT_ERR_OK - Success
998 * RT_ERR_SMI - SMI access error
999 * RT_ERR_OUT_OF_RANGE - input parameter out of range
1000 * RT_ERR_QUEUE_ID - Invalid queue id
1001 * Note:
1002 * None
1003 */
1004 ret_t rtl8367c_setAsicEgressFlowControlQueueDropThreshold(rtk_uint32 qid, rtk_uint32 threshold)
1005 {
1006 if( threshold >= RTL8367C_PAGE_NUMBER)
1007 return RT_ERR_OUT_OF_RANGE;
1008
1009 if(qid > RTL8367C_QIDMAX)
1010 return RT_ERR_QUEUE_ID;
1011
1012 return rtl8367c_setAsicRegBits(RTL8367C_FLOWCTRL_QUEUE_DROP_ON_REG(qid), RTL8367C_FLOWCTRL_QUEUE_DROP_ON_MASK, threshold);
1013 }
1014 /* Function Name:
1015 * rtl8367c_getAsicEgressFlowControlQueueDropThreshold
1016 * Description:
1017 * Get Queue-based egress flow control turn on or ingress flow control drop on threshold
1018 * Input:
1019 * qid - The queue id
1020 * pThreshold - Queue-based flown control/drop turn ON threshold
1021 * Output:
1022 * None
1023 * Return:
1024 * RT_ERR_OK - Success
1025 * RT_ERR_SMI - SMI access error
1026 * RT_ERR_QUEUE_ID - Invalid queue id
1027 * Note:
1028 * None
1029 */
1030 ret_t rtl8367c_getAsicEgressFlowControlQueueDropThreshold(rtk_uint32 qid, rtk_uint32 *pThreshold)
1031 {
1032 if(qid > RTL8367C_QIDMAX)
1033 return RT_ERR_QUEUE_ID;
1034
1035 return rtl8367c_getAsicRegBits(RTL8367C_FLOWCTRL_QUEUE_DROP_ON_REG(qid), RTL8367C_FLOWCTRL_QUEUE_DROP_ON_MASK, pThreshold);
1036 }
1037 /* Function Name:
1038 * rtl8367c_setAsicEgressFlowControlPortDropThreshold
1039 * Description:
1040 * Set port-based egress flow control turn on or ingress flow control drop on threshold
1041 * Input:
1042 * port - Physical port number (0~7)
1043 * threshold - Queue-based flown control/drop turn ON threshold
1044 * Output:
1045 * None
1046 * Return:
1047 * RT_ERR_OK - Success
1048 * RT_ERR_SMI - SMI access error
1049 * RT_ERR_PORT_ID - Invalid port number
1050 * RT_ERR_OUT_OF_RANGE - input parameter out of range
1051 * Note:
1052 * None
1053 */
1054 ret_t rtl8367c_setAsicEgressFlowControlPortDropThreshold(rtk_uint32 port, rtk_uint32 threshold)
1055 {
1056 if(port > RTL8367C_PORTIDMAX)
1057 return RT_ERR_PORT_ID;
1058
1059 if(threshold >= RTL8367C_PAGE_NUMBER)
1060 return RT_ERR_OUT_OF_RANGE;
1061
1062 return rtl8367c_setAsicRegBits(RTL8367C_FLOWCTRL_PORT_DROP_ON_REG(port), RTL8367C_FLOWCTRL_PORT_DROP_ON_MASK, threshold);
1063 }
1064 /* Function Name:
1065 * rtl8367c_setAsicEgressFlowControlPortDropThreshold
1066 * Description:
1067 * Set port-based egress flow control turn on or ingress flow control drop on threshold
1068 * Input:
1069 * port - Physical port number (0~7)
1070 * pThreshold - Queue-based flown control/drop turn ON threshold
1071 * Output:
1072 * None
1073 * Return:
1074 * RT_ERR_OK - Success
1075 * RT_ERR_SMI - SMI access error
1076 * RT_ERR_PORT_ID - Invalid port number
1077 * Note:
1078 * None
1079 */
1080 ret_t rtl8367c_getAsicEgressFlowControlPortDropThreshold(rtk_uint32 port, rtk_uint32 *pThreshold)
1081 {
1082 if(port > RTL8367C_PORTIDMAX)
1083 return RT_ERR_PORT_ID;
1084
1085 return rtl8367c_getAsicRegBits(RTL8367C_FLOWCTRL_PORT_DROP_ON_REG(port), RTL8367C_FLOWCTRL_PORT_DROP_ON_MASK, pThreshold);
1086 }
1087 /* Function Name:
1088 * rtl8367c_setAsicEgressFlowControlPortDropGap
1089 * Description:
1090 * Set port-based egress flow control turn off or ingress flow control drop off gap
1091 * Input:
1092 * gap - Flow control/drop turn OFF threshold = turn ON threshold - gap
1093 * Output:
1094 * None
1095 * Return:
1096 * RT_ERR_OK - Success
1097 * RT_ERR_SMI - SMI access error
1098 * RT_ERR_OUT_OF_RANGE - input parameter out of range
1099 * Note:
1100 * None
1101 */
1102 ret_t rtl8367c_setAsicEgressFlowControlPortDropGap(rtk_uint32 gap)
1103 {
1104 if(gap >= RTL8367C_PAGE_NUMBER)
1105 return RT_ERR_OUT_OF_RANGE;
1106
1107 return rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_GAP, RTL8367C_FLOWCTRL_PORT_GAP_MASK, gap);
1108 }
1109 /* Function Name:
1110 * rtl8367c_getAsicEgressFlowControlPortDropGap
1111 * Description:
1112 * Get port-based egress flow control turn off or ingress flow control drop off gap
1113 * Input:
1114 * pGap - Flow control/drop turn OFF threshold = turn ON threshold - gap
1115 * Output:
1116 * None
1117 * Return:
1118 * RT_ERR_OK - Success
1119 * RT_ERR_SMI - SMI access error
1120 * Note:
1121 * None
1122 */
1123 ret_t rtl8367c_getAsicEgressFlowControlPortDropGap(rtk_uint32 *pGap)
1124 {
1125 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT_GAP, RTL8367C_FLOWCTRL_PORT_GAP_MASK, pGap);
1126 }
1127 /* Function Name:
1128 * rtl8367c_setAsicEgressFlowControlQueueDropGap
1129 * Description:
1130 * Set Queue-based egress flow control turn off or ingress flow control drop off gap
1131 * Input:
1132 * gap - Flow control/drop turn OFF threshold = turn ON threshold - gap
1133 * Output:
1134 * None
1135 * Return:
1136 * RT_ERR_OK - Success
1137 * RT_ERR_SMI - SMI access error
1138 * RT_ERR_OUT_OF_RANGE - input parameter out of range
1139 * Note:
1140 * None
1141 */
1142 ret_t rtl8367c_setAsicEgressFlowControlQueueDropGap(rtk_uint32 gap)
1143 {
1144 if(gap >= RTL8367C_PAGE_NUMBER)
1145 return RT_ERR_OUT_OF_RANGE;
1146
1147 return rtl8367c_setAsicRegBits(RTL8367C_REG_FLOWCTRL_QUEUE_GAP, RTL8367C_FLOWCTRL_QUEUE_GAP_MASK, gap);
1148 }
1149 /* Function Name:
1150 * rtl8367c_getAsicEgressFlowControlQueueDropGap
1151 * Description:
1152 * Get Queue-based egress flow control turn off or ingress flow control drop off gap
1153 * Input:
1154 * pGap - Flow control/drop turn OFF threshold = turn ON threshold - gap
1155 * Output:
1156 * None
1157 * Return:
1158 * RT_ERR_OK - Success
1159 * RT_ERR_SMI - SMI access error
1160 * Note:
1161 * None
1162 */
1163 ret_t rtl8367c_getAsicEgressFlowControlQueueDropGap(rtk_uint32 *pGap)
1164 {
1165 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_QUEUE_GAP, RTL8367C_FLOWCTRL_QUEUE_GAP_MASK, pGap);
1166 }
1167 /* Function Name:
1168 * rtl8367c_getAsicEgressQueueEmptyPortMask
1169 * Description:
1170 * Get queue empty port mask
1171 * Input:
1172 * pPortmask - Queue empty port mask
1173 * Output:
1174 * None
1175 * Return:
1176 * RT_ERR_OK - Success
1177 * RT_ERR_SMI - SMI access error
1178 * Note:
1179 * None
1180 */
1181 ret_t rtl8367c_getAsicEgressQueueEmptyPortMask(rtk_uint32 *pPortmask)
1182 {
1183 return rtl8367c_getAsicReg(RTL8367C_REG_PORT_QEMPTY, pPortmask);
1184 }
1185 /* Function Name:
1186 * rtl8367c_getAsicTotalPage
1187 * Description:
1188 * Get system total page usage number
1189 * Input:
1190 * pPageCount - page usage number
1191 * Output:
1192 * None
1193 * Return:
1194 * RT_ERR_OK - Success
1195 * RT_ERR_SMI - SMI access error
1196 * Note:
1197 * None
1198 */
1199 ret_t rtl8367c_getAsicTotalPage(rtk_uint32 *pPageCount)
1200 {
1201 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_TOTAL_PAGE_COUNTER, RTL8367C_FLOWCTRL_TOTAL_PAGE_COUNTER_MASK, pPageCount);
1202 }
1203 /* Function Name:
1204 * rtl8367c_getAsicPulbicPage
1205 * Description:
1206 * Get system public page usage number
1207 * Input:
1208 * pPageCount - page usage number
1209 * Output:
1210 * None
1211 * Return:
1212 * RT_ERR_OK - Success
1213 * RT_ERR_SMI - SMI access error
1214 * Note:
1215 * None
1216 */
1217 ret_t rtl8367c_getAsicPulbicPage(rtk_uint32 *pPageCount)
1218 {
1219 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PUBLIC_PAGE_COUNTER, RTL8367C_FLOWCTRL_PUBLIC_PAGE_COUNTER_MASK, pPageCount);
1220 }
1221 /* Function Name:
1222 * rtl8367c_getAsicMaxTotalPage
1223 * Description:
1224 * Get system total page max usage number
1225 * Input:
1226 * pPageCount - page usage number
1227 * Output:
1228 * None
1229 * Return:
1230 * RT_ERR_OK - Success
1231 * RT_ERR_SMI - SMI access error
1232 * Note:
1233 * None
1234 */
1235 ret_t rtl8367c_getAsicMaxTotalPage(rtk_uint32 *pPageCount)
1236 {
1237 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_TOTAL_PAGE_MAX, RTL8367C_FLOWCTRL_TOTAL_PAGE_MAX_MASK, pPageCount);
1238 }
1239 /* Function Name:
1240 * rtl8367c_getAsicPulbicPage
1241 * Description:
1242 * Get system public page max usage number
1243 * Input:
1244 * pPageCount - page usage number
1245 * Output:
1246 * None
1247 * Return:
1248 * RT_ERR_OK - Success
1249 * RT_ERR_SMI - SMI access error
1250 * Note:
1251 * None
1252 */
1253 ret_t rtl8367c_getAsicMaxPulbicPage(rtk_uint32 *pPageCount)
1254 {
1255 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PUBLIC_PAGE_MAX, RTL8367C_FLOWCTRL_PUBLIC_PAGE_MAX_MASK, pPageCount);
1256 }
1257 /* Function Name:
1258 * rtl8367c_getAsicPortPage
1259 * Description:
1260 * Get per-port page usage number
1261 * Input:
1262 * port - Physical port number (0~7)
1263 * pPageCount - page usage number
1264 * Output:
1265 * None
1266 * Return:
1267 * RT_ERR_OK - Success
1268 * RT_ERR_SMI - SMI access error
1269 * RT_ERR_PORT_ID - Invalid port number
1270 * Note:
1271 * None
1272 */
1273 ret_t rtl8367c_getAsicPortPage(rtk_uint32 port, rtk_uint32 *pPageCount)
1274 {
1275 if(port > RTL8367C_PORTIDMAX)
1276 return RT_ERR_PORT_ID;
1277
1278 if(port < 8)
1279 return rtl8367c_getAsicRegBits(RTL8367C_FLOWCTRL_PORT_PAGE_COUNTER_REG(port), RTL8367C_FLOWCTRL_PORT_PAGE_COUNTER_MASK, pPageCount);
1280 else
1281 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT8_PAGE_COUNTER+port - 8, RTL8367C_FLOWCTRL_PORT_PAGE_COUNTER_MASK, pPageCount);
1282 }
1283 /* Function Name:
1284 * rtl8367c_getAsicPortPage
1285 * Description:
1286 * Get per-port page max usage number
1287 * Input:
1288 * port - Physical port number (0~7)
1289 * pPageCount - page usage number
1290 * Output:
1291 * None
1292 * Return:
1293 * RT_ERR_OK - Success
1294 * RT_ERR_SMI - SMI access error
1295 * RT_ERR_PORT_ID - Invalid port number
1296 * Note:
1297 * None
1298 */
1299 ret_t rtl8367c_getAsicPortPageMax(rtk_uint32 port, rtk_uint32 *pPageCount)
1300 {
1301 if(port > RTL8367C_PORTIDMAX)
1302 return RT_ERR_PORT_ID;
1303 if(port < 8)
1304 return rtl8367c_getAsicRegBits(RTL8367C_FLOWCTRL_PORT_PAGE_MAX_REG(port), RTL8367C_FLOWCTRL_PORT_PAGE_MAX_MASK, pPageCount);
1305 else
1306 return rtl8367c_getAsicRegBits(RTL8367C_REG_FLOWCTRL_PORT0_PAGE_MAX+port-8, RTL8367C_FLOWCTRL_PORT_PAGE_MAX_MASK, pPageCount);
1307
1308
1309 }
1310
1311 /* Function Name:
1312 * rtl8367c_setAsicFlowControlEgressPortIndep
1313 * Description:
1314 * Set per-port egress flow control independent
1315 * Input:
1316 * port - Physical port number (0~7)
1317 * enabled - Egress port flow control usage 1:enable 0:disable.
1318 * Output:
1319 * None
1320 * Return:
1321 * RT_ERR_OK - Success
1322 * RT_ERR_SMI - SMI access error
1323 * RT_ERR_PORT_ID - Invalid port number
1324 * Note:
1325 * None
1326 */
1327 ret_t rtl8367c_setAsicFlowControlEgressPortIndep(rtk_uint32 port, rtk_uint32 enable)
1328 {
1329 if(port > RTL8367C_PORTIDMAX)
1330 return RT_ERR_PORT_ID;
1331
1332 return rtl8367c_setAsicRegBit(RTL8367C_REG_PORT0_MISC_CFG + (port *0x20), RTL8367C_PORT0_MISC_CFG_FLOWCTRL_INDEP_OFFSET,enable);
1333 }
1334
1335 /* Function Name:
1336 * rtl8367c_getAsicFlowControlEgressPortIndep
1337 * Description:
1338 * Get per-port egress flow control independent
1339 * Input:
1340 * port - Physical port number (0~7)
1341 * enabled - Egress port flow control usage 1:enable 0:disable.
1342 * Output:
1343 * None
1344 * Return:
1345 * RT_ERR_OK - Success
1346 * RT_ERR_SMI - SMI access error
1347 * RT_ERR_PORT_ID - Invalid port number
1348 * Note:
1349 * None
1350 */
1351 ret_t rtl8367c_getAsicFlowControlEgressPortIndep(rtk_uint32 port, rtk_uint32 *pEnable)
1352 {
1353 return rtl8367c_getAsicRegBit(RTL8367C_REG_PORT0_MISC_CFG + (port *0x20),RTL8367C_PORT0_MISC_CFG_FLOWCTRL_INDEP_OFFSET,pEnable);
1354 }