OpenNSL API Guide and Reference Manual
cosqX.h
Go to the documentation of this file.
1 
4 /*****************************************************************************
5  *
6  * This software is governed by the Broadcom Advanced Switch APIs license.
7  * This license is set out in the
8  * https://github.com/Broadcom-Switch/OpenNSL/Legal/LICENSE-Adv file.
9  *
10  * Copyright 2015-2016 Broadcom Corporation. All rights reserved.
11  *
12  ***************************************************************************/
16 #ifndef __OPENNSL_COSQX_H__
17 #define __OPENNSL_COSQX_H__
18 
19 #include <opennsl/types.h>
20 #include <opennsl/switch.h>
21 #include <shared/port.h>
22 
23 /***************************************************************************/
33 extern int opennsl_cosq_init(
34  int unit) LIB_DLL_EXPORTED ;
35 
36 /***************************************************************************/
47 extern int opennsl_cosq_detach(
48  int unit) LIB_DLL_EXPORTED ;
49 
50 /***************************************************************************/
82 extern int opennsl_cosq_config_set(
83  int unit,
84  int numq) LIB_DLL_EXPORTED ;
85 
86 /***************************************************************************/
118 extern int opennsl_cosq_config_get(
119  int unit,
120  int *numq) LIB_DLL_EXPORTED ;
121 
122 /***************************************************************************/
154 extern int opennsl_cosq_mapping_set(
155  int unit,
156  opennsl_cos_t priority,
158 
159 /***************************************************************************/
191 extern int opennsl_cosq_mapping_get(
192  int unit,
193  opennsl_cos_t priority,
195 
196 /***************************************************************************/
230  int unit,
232  opennsl_cos_t priority,
234 
235 /***************************************************************************/
269  int unit,
271  opennsl_cos_t priority,
273 
274 /***************************************************************************/
314  int unit,
316  int count,
317  opennsl_cos_t *priority_array,
319 
320 /***************************************************************************/
360  int unit,
362  int count,
363  opennsl_cos_t *priority_array,
365 
366 #define OPENNSL_COSQ_NONE 0x0
367 #define OPENNSL_COSQ_STRICT 0x01
368 #define OPENNSL_COSQ_ROUND_ROBIN 0x02
369 #define OPENNSL_COSQ_WEIGHTED_ROUND_ROBIN 0x03
370 #define OPENNSL_COSQ_WEIGHTED_FAIR_QUEUING 0x04
371 #define OPENNSL_COSQ_DEFICIT_ROUND_ROBIN 0x05
372 #define OPENNSL_COSQ_SP0 0x0C
374 #define OPENNSL_COSQ_SP1 0x0D
376 #define OPENNSL_COSQ_WEIGHT_UNLIMITED -1
377 #define OPENNSL_COSQ_WEIGHT_STRICT 0
378 #define OPENNSL_COSQ_WEIGHT_MIN 1
379 #define OPENNSL_COSQ_PRIO_VALID(prio) ((prio) >= 0 && (prio < 8))
380 #define OPENNSL_COSQ_QUEUE_VALID(unit, numq) \
381  ((numq) >= 0 && (numq) < NUM_COS(unit))
382 /***************************************************************************/
422 extern int opennsl_cosq_sched_set(
423  int unit,
424  int mode,
425  const int weights[OPENNSL_COS_COUNT],
426  int delay) LIB_DLL_EXPORTED ;
427 
428 /***************************************************************************/
469 extern int opennsl_cosq_port_sched_set(
470  int unit,
471  opennsl_pbmp_t pbm,
472  int mode,
473  const int weights[OPENNSL_COS_COUNT],
474  int delay) LIB_DLL_EXPORTED ;
475 
476 /***************************************************************************/
516 extern int opennsl_cosq_sched_get(
517  int unit,
518  int *mode,
519  int weights[OPENNSL_COS_COUNT],
520  int *delay) LIB_DLL_EXPORTED ;
521 
522 /***************************************************************************/
563 extern int opennsl_cosq_port_sched_get(
564  int unit,
565  opennsl_pbmp_t pbm,
566  int *mode,
567  int weights[OPENNSL_COS_COUNT],
568  int *delay) LIB_DLL_EXPORTED ;
569 
570 /***************************************************************************/
583  int unit,
584  int mode,
585  int *weight_max) LIB_DLL_EXPORTED ;
586 
587 #define OPENNSL_COSQ_ALL 0x00000001
588 #define OPENNSL_COSQ_BW_EAV_MODE 0x00000008
591 #define OPENNSL_COSQ_BW_LLFC 0x00000010
593 #define OPENNSL_COSQ_BW_PACKET_MODE 0x00000020
596 #define OPENNSL_COSQ_BW_NOT_COMMIT 0x00000040
600 /***************************************************************************/
629 extern int opennsl_cosq_port_bandwidth_set(
630  int unit,
632  opennsl_cos_queue_t cosq,
633  uint32 kbits_sec_min,
634  uint32 kbits_sec_max,
635  uint32 flags) LIB_DLL_EXPORTED ;
636 
637 /***************************************************************************/
667  int unit,
669  opennsl_cos_queue_t cosq,
670  uint32 *kbits_sec_min,
671  uint32 *kbits_sec_max,
672  uint32 *flags) LIB_DLL_EXPORTED ;
673 
674 #define OPENNSL_COSQ_DISCARD_ENABLE 0x0001
675 #define OPENNSL_COSQ_DISCARD_NONTCP 0x0004
676 #define OPENNSL_COSQ_DISCARD_COLOR_GREEN 0x0100
677 #define OPENNSL_COSQ_DISCARD_COLOR_YELLOW 0x0200
678 #define OPENNSL_COSQ_DISCARD_COLOR_RED 0x0400
679 #define OPENNSL_COSQ_DISCARD_COLOR_BLACK 0x0800
680 #define OPENNSL_COSQ_DISCARD_COLOR_ALL 0x0F00
681 #define OPENNSL_COSQ_DISCARD_DROP_FIRST OPENNSL_COSQ_DISCARD_COLOR_RED
682 #define OPENNSL_COSQ_DISCARD_PACKETS 0x1000
683 #define OPENNSL_COSQ_DISCARD_BYTES 0x2000
684 #define OPENNSL_COSQ_DISCARD_MARK_CONGESTION 0x4000
685 #define OPENNSL_COSQ_DISCARD_PORT 0x8000
686 #define OPENNSL_COSQ_DISCARD_DEVICE 0x10000
687 #define OPENNSL_COSQ_DISCARD_TCP 0x40000
688 #define OPENNSL_COSQ_DISCARD_SYSTEM 0x80000
689 #define OPENNSL_COSQ_DISCARD_PROBABILITY1 0x100000
690 #define OPENNSL_COSQ_DISCARD_PROBABILITY2 0x200000
691 #define OPENNSL_COSQ_DISCARD_IFP 0x400000
692 #define OPENNSL_COSQ_DISCARD_OUTER_CFI 0x800000
693 /***************************************************************************/
704 extern int opennsl_cosq_discard_set(
705  int unit,
706  uint32 flags) LIB_DLL_EXPORTED ;
707 
708 /***************************************************************************/
719 extern int opennsl_cosq_discard_get(
720  int unit,
721  uint32 *flags) LIB_DLL_EXPORTED ;
722 
723 /***************************************************************************/
781  int unit,
783  opennsl_cos_queue_t cosq,
784  uint32 color,
785  int drop_start,
786  int drop_slope,
787  int average_time) LIB_DLL_EXPORTED ;
788 
789 /***************************************************************************/
847  int unit,
849  opennsl_cos_queue_t cosq,
850  uint32 color,
851  int *drop_start,
852  int *drop_slope,
853  int *average_time) LIB_DLL_EXPORTED ;
854 
855 #define OPENNSL_COSQ_HIGH_PRIORITY -4
856 #define OPENNSL_COSQ_LOW_PRIORITY -5
857 
866 /* __doxy_func_body_end__ */
867 
868 /***************************************************************************/
884 extern int opennsl_cosq_control_set(
885  int unit,
887  opennsl_cos_queue_t cosq,
889  int arg) LIB_DLL_EXPORTED ;
890 
891 /***************************************************************************/
907 extern int opennsl_cosq_control_get(
908  int unit,
910  opennsl_cos_queue_t cosq,
912  int *arg) LIB_DLL_EXPORTED ;
913 
921 /* __doxy_func_body_end__ */
922 
1028 /* __doxy_func_body_end__ */
1029 
1030 #define OPENNSL_COSQ_GPORT_STATS_SHARED 0x00000001
1031 
1035 /* __doxy_func_body_end__ */
1036 
1037 /***************************************************************************/
1050 extern int opennsl_cosq_priority_set(
1051  int unit,
1052  int start_queue,
1053  int end_queue,
1054  int pri_profile_id) LIB_DLL_EXPORTED ;
1055 
1056 /***************************************************************************/
1070 extern int opennsl_cosq_priority_get(
1071  int unit,
1072  int start_queue,
1073  int end_queue,
1074  int *pri_profile_id) LIB_DLL_EXPORTED ;
1075 
1076 /***************************************************************************/
1181 extern int opennsl_cosq_gport_get(
1182  int unit,
1183  opennsl_gport_t gport,
1184  opennsl_gport_t *physical_port,
1185  int *num_cos_levels,
1186  uint32 *flags) LIB_DLL_EXPORTED ;
1187 
1189  int unit,
1191  int numq,
1192  uint32 flags,
1193  opennsl_gport_t gport,
1194  void *user_data);
1195 
1196 /***************************************************************************/
1209 extern int opennsl_cosq_gport_traverse(
1210  int unit,
1212  void *user_data) LIB_DLL_EXPORTED ;
1213 
1214 /***************************************************************************/
1232  int unit,
1233  opennsl_gport_t gport,
1234  opennsl_cos_queue_t cosq,
1235  int enable) LIB_DLL_EXPORTED ;
1236 
1237 /***************************************************************************/
1253  int unit,
1254  opennsl_gport_t gport,
1255  opennsl_cos_queue_t cosq,
1257  uint64 *value) LIB_DLL_EXPORTED ;
1258 
1259 /***************************************************************************/
1277  int unit,
1278  opennsl_gport_t gport,
1279  opennsl_cos_queue_t cosq,
1280  int *enable) LIB_DLL_EXPORTED ;
1281 
1282 /***************************************************************************/
1294  int unit,
1295  opennsl_gport_t gport,
1296  int enable) LIB_DLL_EXPORTED ;
1297 
1298 /***************************************************************************/
1310  int unit,
1311  opennsl_gport_t gport,
1312  int *enable) LIB_DLL_EXPORTED ;
1313 
1314 /***************************************************************************/
1332 extern int opennsl_cosq_gport_stat_get(
1333  int unit,
1334  opennsl_gport_t gport,
1335  opennsl_cos_queue_t cosq,
1337  uint64 *value) LIB_DLL_EXPORTED ;
1338 
1339 /***************************************************************************/
1357 extern int opennsl_cosq_gport_stat_set(
1358  int unit,
1359  opennsl_gport_t gport,
1360  opennsl_cos_queue_t cosq,
1362  uint64 value) LIB_DLL_EXPORTED ;
1363 
1364 /***************************************************************************/
1395  int unit,
1396  opennsl_gport_t gport,
1397  opennsl_gport_t lgl_gport,
1398  opennsl_cos_queue_t cosq,
1399  uint32 flags,
1401 
1402 /***************************************************************************/
1456  int unit,
1457  opennsl_gport_t gport,
1458  opennsl_gport_t lgl_gport,
1459  opennsl_cos_queue_t cosq,
1460  uint32 flags,
1462 
1463 /***************************************************************************/
1499  int unit,
1500  opennsl_gport_t gport,
1501  opennsl_gport_t lgl_gport,
1502  opennsl_cos_queue_t cosq,
1503  uint32 flags,
1505  uint64 *value) LIB_DLL_EXPORTED ;
1506 
1507 /***************************************************************************/
1539  int unit,
1540  opennsl_gport_t gport,
1541  opennsl_gport_t lgl_gport,
1542  opennsl_cos_queue_t cosq,
1543  uint32 flags,
1545  uint64 value) LIB_DLL_EXPORTED ;
1546 
1547 #define OPENNSL_COSQ_GPORT_WITH_ID 0x00000001
1548 #define OPENNSL_COSQ_GPORT_SCHEDULER 0x00000002
1549 #define OPENNSL_COSQ_GPORT_OVERLAY 0x00000004
1550 #define OPENNSL_COSQ_GPORT_UCAST_QUEUE_GROUP 0x00000008
1551 #define OPENNSL_COSQ_GPORT_DESTMOD_UCAST_QUEUE_GROUP 0x00000010
1552 #define OPENNSL_COSQ_GPORT_MCAST_QUEUE 0x00000010
1553 #define OPENNSL_COSQ_GPORT_MCAST_QUEUE_GROUP 0x00000020
1554 #define OPENNSL_COSQ_GPORT_SUBSCRIBER 0x00000040
1555 #define OPENNSL_COSQ_GPORT_EGRESS_GROUP 0x00000080
1556 #define OPENNSL_COSQ_GPORT_DISABLE 0x00000100
1560 /***************************************************************************/
1666 extern int opennsl_cosq_gport_add(
1667  int unit,
1669  int numq,
1670  uint32 flags,
1672 
1673 /***************************************************************************/
1687 extern int opennsl_cosq_gport_delete(
1688  int unit,
1690 
1691 /***************************************************************************/
1723  int unit,
1724  opennsl_port_t ing_port,
1725  opennsl_cos_t int_pri,
1726  uint32 flags,
1727  opennsl_gport_t gport,
1729 
1730 /***************************************************************************/
1762  int unit,
1763  opennsl_port_t ing_port,
1764  opennsl_cos_t int_pri,
1765  uint32 flags,
1766  opennsl_gport_t *gport,
1768 
1769 /***************************************************************************/
1792  int unit,
1793  opennsl_gport_t gport,
1794  opennsl_cos_queue_t cosq,
1795  uint32 kbits_sec_min,
1796  uint32 kbits_sec_max,
1797  uint32 flags) LIB_DLL_EXPORTED ;
1798 
1799 /***************************************************************************/
1822  int unit,
1823  opennsl_gport_t gport,
1824  opennsl_cos_queue_t cosq,
1825  uint32 *kbits_sec_min,
1826  uint32 *kbits_sec_max,
1827  uint32 *flags) LIB_DLL_EXPORTED ;
1828 
1829 /***************************************************************************/
1849 extern int opennsl_cosq_gport_sched_set(
1850  int unit,
1851  opennsl_gport_t gport,
1852  opennsl_cos_queue_t cosq,
1853  int mode,
1854  int weight) LIB_DLL_EXPORTED ;
1855 
1856 /***************************************************************************/
1876 extern int opennsl_cosq_gport_sched_get(
1877  int unit,
1878  opennsl_gport_t gport,
1879  opennsl_cos_queue_t cosq,
1880  int *mode,
1881  int *weight) LIB_DLL_EXPORTED ;
1882 
1883 /***************************************************************************/
1900  int unit,
1901  opennsl_gport_t gport,
1902  opennsl_cos_queue_t cosq,
1904 
1905 /***************************************************************************/
1922  int unit,
1923  opennsl_gport_t gport,
1924  opennsl_cos_queue_t cosq,
1926 
1927 /***************************************************************************/
1943  int unit,
1944  opennsl_gport_t gport,
1945  int sched_mode,
1946  int int_pri,
1947  uint32 flags) LIB_DLL_EXPORTED ;
1948 
1949 /***************************************************************************/
1965  int unit,
1966  opennsl_gport_t gport,
1967  int sched_mode,
1968  int int_pri,
1969  uint32 *flags) LIB_DLL_EXPORTED ;
1970 
1971 /***************************************************************************/
2008 extern int opennsl_cosq_gport_attach(
2009  int unit,
2010  opennsl_gport_t sched_port,
2011  opennsl_gport_t input_port,
2013 
2014 /***************************************************************************/
2051 extern int opennsl_cosq_gport_detach(
2052  int unit,
2053  opennsl_gport_t sched_port,
2054  opennsl_gport_t input_port,
2056 
2057 /***************************************************************************/
2095  int unit,
2096  opennsl_gport_t sched_port,
2097  opennsl_gport_t *input_port,
2099 
2100 /***************************************************************************/
2114 extern int opennsl_cosq_gport_child_get(
2115  int unit,
2116  opennsl_gport_t in_gport,
2117  opennsl_cos_queue_t cosq,
2118  opennsl_gport_t *out_gport) LIB_DLL_EXPORTED ;
2119 
2120 /***************************************************************************/
2138  int unit,
2139  opennsl_gport_t gport,
2140  opennsl_cos_t ingress_pri,
2141  opennsl_color_t ingress_dp,
2143 
2144 /***************************************************************************/
2162  int unit,
2163  opennsl_gport_t gport,
2164  opennsl_cos_t ingress_pri,
2165  opennsl_color_t ingress_dp,
2167 
2168 #define OPENNSL_COSQ_MULTICAST_SCHEDULED 0x00000001
2171 typedef struct opennsl_cosq_egress_multicast_config_s {
2177 /* __doxy_func_body_end__ */
2178 
2179 /***************************************************************************/
2208  int unit,
2209  opennsl_gport_t gport,
2210  opennsl_cos_t ingress_pri,
2211  opennsl_color_t ingress_dp,
2212  uint32 flags,
2214 
2215 /***************************************************************************/
2244  int unit,
2245  opennsl_gport_t gport,
2246  opennsl_cos_t ingress_pri,
2247  opennsl_color_t ingress_dp,
2248  uint32 flags,
2250 
2259 /* __doxy_func_body_end__ */
2260 
2268 /* __doxy_func_body_end__ */
2269 
2270 /***************************************************************************/
2286  int unit,
2287  opennsl_cosq_gport_type_t gport_type,
2289 
2291 typedef enum opennsl_cosq_stat_e {
2304 /* __doxy_func_body_end__ */
2305 
2306 /***************************************************************************/
2333 extern int opennsl_cosq_stat_get(
2334  int unit,
2335  opennsl_gport_t gport,
2336  opennsl_cos_queue_t cosq,
2337  opennsl_cosq_stat_t stat,
2338  uint64 *value) LIB_DLL_EXPORTED ;
2339 
2340 /***************************************************************************/
2363 extern int opennsl_cosq_stat_sync_get(
2364  int unit,
2365  opennsl_gport_t gport,
2366  opennsl_cos_queue_t cosq,
2367  opennsl_cosq_stat_t stat,
2368  uint64 *value) LIB_DLL_EXPORTED ;
2369 
2370 /***************************************************************************/
2397 extern int opennsl_cosq_stat_set(
2398  int unit,
2399  opennsl_gport_t gport,
2400  opennsl_cos_queue_t cosq,
2401  opennsl_cosq_stat_t stat,
2402  uint64 value) LIB_DLL_EXPORTED ;
2403 
2404 #if defined(INCLUDE_TCB)
2405 #endif
2406 #if defined(INCLUDE_TCB)
2407 #endif
2408 #if defined(INCLUDE_TCB)
2409 #endif
2410 #endif /* __OPENNSL_COSQX_H__ */
2411