lb.h (12991B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_LB_H__ 14 #define __BCM_LB_H__ 15 16 #include <bcm/types.h> 17 18 /* Link bonding module flags. */ 19 #define BCM_LB_FLAG_GLOBAL (1 << 0) /* Global configuration. */ 20 #define BCM_LB_FLAG_UNMAP (1 << 1) /* Unmap operation. */ 21 #define BCM_LB_FLAG_FLUSH_GLOBAL (1 << 2) /* flush for all lbg. */ 22 #define BCM_LB_FLAG_MODEM_SHAPER_SEGMENT (1 << 3) /* set modem segment 23 shaper. */ 24 25 /* LBG ID type */ 26 typedef uint32 bcm_lbg_t; 27 28 /* MODEM ID type */ 29 typedef uint32 bcm_modem_t; 30 31 /* Link bonding direction type eumerations */ 32 typedef enum bcm_lb_direction_type_e { 33 bcmLbDirectionRx = 0, /* Link bonding in receive side */ 34 bcmLbDirectionTx = 1, /* Link bonding in transmit side */ 35 bcmLbDirectionBoth = 2, /* Link bonding in both receive and transmit side */ 36 bcmLbDirectionCount = 3 /* Always Last. Not a usable value. */ 37 } bcm_lb_direction_type_t; 38 39 /* Link bonding control type */ 40 typedef enum bcm_lb_control_e { 41 bcmLbControlSegmentationMode = 0, /* Global configuration in TX side */ 42 bcmLbControlPacketCrcEnable = 1, /* Global configuration in TX side */ 43 bcmLbControlTimeoutThreshold = 2, /* Per LBG configuration in RX side */ 44 bcmLbControlMaxOutOfOrder = 3, /* Per LBG configuration in RX side */ 45 bcmLbControlMaxBuffer = 4, /* Per LBG configuration in RX side */ 46 bcmLbControlExpectedSequenceNumber = 5, /* Per LBG configuration in RX side */ 47 bcmLbControlNofTotalSharedBuffers = 6, /* Total shared buffers */ 48 bcmLbControlNofGuaranteedBuffers = 7, /* Guaranteed buffers the link bonding 49 group can acquire */ 50 bcmLbControlCount = 8 /* Always Last. Not a usable value. */ 51 } bcm_lb_control_t; 52 53 /* Link bonding modem control type */ 54 typedef enum bcm_lb_modem_control_e { 55 bcmLbModemControlHeaderCompensation = 0, /* Modem configuration in TX side */ 56 bcmLbModemControlCount = 1 /* Always Last. Not a usable value. */ 57 } bcm_lb_modem_control_t; 58 59 /* Link bonding format type */ 60 typedef enum bcm_lb_format_type_e { 61 bcmLbFormatTypeBypass = 0, /* LB bypss */ 62 bcmLbFormatTypeNonChannelize = 1, /* LB non channelize */ 63 bcmLbFormatTypechannelize = 2, /* LB channelize */ 64 bcmLbFormatCount = 3 /* Always Last. Not a usable value. */ 65 } bcm_lb_format_type_t; 66 67 /* Link bonding status */ 68 typedef enum bcm_lb_status_type_e { 69 bcmLbStatusIsInSync = 0, /* Is expected sequence number in sync state */ 70 bcmLbStatusIsEmptyFifo = 1, /* LBG FIFOs empty indication */ 71 bcmLbStatusCount = 2 /* Always Last. Not a usable value. */ 72 } bcm_lb_status_type_t; 73 74 /* Link bonding Modem status */ 75 typedef enum bcm_lb_modem_status_type_e { 76 bcmLbModemStatusIsEmptyFifo = 0, /* Modem FIFO empty indication */ 77 bcmLbModemStatusCount = 1 /* Always Last. Not a usable value. */ 78 } bcm_lb_modem_status_type_t; 79 80 /* Link bonding stat */ 81 typedef enum bcm_lb_stat_val_e { 82 bcmLbStatsUnicastPkts = 0, /* Unicast packets */ 83 bcmLbStatsMulticastPkts = 1, /* Multicast packets */ 84 bcmLbStatsBroadcastPkts = 2, /* Broadcast packets */ 85 bcmLbStatsPkts64Octets = 3, 86 bcmLbStatsPkts65to127Octets = 4, 87 bcmLbStatsPkts128to255Octets = 5, 88 bcmLbStatsPkts256to511Octets = 6, 89 bcmLbStatsPkts512to1023Octets = 7, 90 bcmLbStatsPkts1024to1518Octets = 8, 91 bcmLbStatsPkts1519Octets = 9, 92 bcmLbStatsPkts = 10, 93 bcmLbStatsOctets = 11, 94 bcmLbStatsDiscardFragments = 12, 95 bcmLbStatsErrorPkts = 13, 96 bcmLbStatsCount = 14 /* Always Last. Not a usable value. */ 97 } bcm_lb_stat_val_t; 98 99 /* Link bonding Modem stat */ 100 typedef enum bcm_lb_modem_stat_val_e { 101 bcmLbModemStatsPkts = 0, 102 bcmLbModemStatsOctets = 1, 103 bcmLbModemStatsCount = 2 /* Always Last. Not a usable value. */ 104 } bcm_lb_modem_stat_val_t; 105 106 /* Link bonding Segment Mode */ 107 typedef enum bcm_lb_segment_mode_e { 108 bcmLbSegmentMode128 = 0, 109 bcmLbSegmentMode192 = 1, 110 bcmLbSegmentMode192Enhanced = 2, 111 bcmLbSegmentMode128Enhanced = 3, 112 bcmLbSegmentModeCount = 4 /* Always Last. Not a usable value. */ 113 } bcm_lb_segment_mode_t; 114 115 /* Link bonding flush operation type */ 116 typedef enum bcm_lb_flush_type_e { 117 bcmLbFlushTypeForceFlush = 0, /* For debug only. Should not be used in 118 normal operation */ 119 bcmLbFlushTypeFlushOnGroupOverflow = 1, 120 bcmLbFlushTypeFlushOnFifoOverflow = 2, 121 bcmLbFlushTypeFlushOnSharedOverflow = 3, 122 bcmLbFlushTypeCount = 4 /* Always Last. Not a usable value. */ 123 } bcm_lb_flush_type_t; 124 125 /* Index of mapping traffic to modem */ 126 typedef struct bcm_lb_rx_modem_map_index_s { 127 bcm_gport_t port; 128 bcm_vlan_t vlan; 129 } bcm_lb_rx_modem_map_index_t; 130 131 /* Modem info */ 132 typedef struct bcm_lb_rx_modem_map_config_s { 133 bcm_lb_format_type_t lbg_type; 134 bcm_modem_t modem_id; 135 } bcm_lb_rx_modem_map_config_t; 136 137 /* packet info */ 138 typedef struct bcm_lb_packet_config_s { 139 uint16 outer_vlan_tpid; 140 uint16 lbg_tpid; 141 } bcm_lb_packet_config_t; 142 143 /* packet info */ 144 typedef struct bcm_lb_modem_packet_config_s { 145 bcm_lb_format_type_t pkt_format; 146 bcm_mac_t dst_mac; 147 bcm_mac_t src_mac; 148 uint16 vlan; 149 int use_global_priority_map; 150 } bcm_lb_modem_packet_config_t; 151 152 /* tc dp info */ 153 typedef struct bcm_lb_tc_dp_s { 154 uint32 tc; 155 uint32 dp; 156 } bcm_lb_tc_dp_t; 157 158 /* packet priority info */ 159 typedef struct bcm_lb_pkt_pri_s { 160 uint32 pkt_pri; 161 uint32 pkt_cfi; 162 uint32 pkt_dp; 163 } bcm_lb_pkt_pri_t; 164 165 /* LBG weight info */ 166 typedef struct bcm_lb_lbg_weight_s { 167 bcm_lbg_t lbg_id; 168 int lbg_weight; 169 } bcm_lb_lbg_weight_t; 170 171 /* packet priority info */ 172 typedef struct bcm_lb_modem_shaper_config_s { 173 uint32 enable; 174 uint32 rate; 175 uint32 max_burst; 176 } bcm_lb_modem_shaper_config_t; 177 178 /* Initialize structure bcm_lb_rx_modem_map_index_t */ 179 extern void bcm_lb_rx_modem_map_index_t_init( 180 bcm_lb_rx_modem_map_index_t *map_index); 181 182 /* Initialize structure bcm_lb_rx_modem_map_config_t */ 183 extern void bcm_lb_rx_modem_map_config_t_init( 184 bcm_lb_rx_modem_map_config_t *map_config); 185 186 /* Initialize structure bcm_lb_packet_config_t */ 187 extern void bcm_lb_packet_config_t_init( 188 bcm_lb_packet_config_t *packet_config); 189 190 /* Initialize structure bcm_lb_modem_packet_config_t */ 191 extern void bcm_lb_modem_packet_config_t_init( 192 bcm_lb_modem_packet_config_t *packet_config); 193 194 /* Initialize structure bcm_lb_tc_dp_t */ 195 extern void bcm_lb_tc_dp_t_init( 196 bcm_lb_tc_dp_t *tc_dp); 197 198 /* Initialize structure bcm_lb_pkt_pri_t */ 199 extern void bcm_lb_pkt_pri_t_init( 200 bcm_lb_pkt_pri_t *pkt_pri); 201 202 /* Initialize structure bcm_lb_lbg_weight_t */ 203 extern void bcm_lb_lbg_weight_t_init( 204 bcm_lb_lbg_weight_t *lbg_weights); 205 206 /* Initialize structure bcm_lb_modem_shaper_config_t */ 207 extern void bcm_lb_modem_shaper_config_t_init( 208 bcm_lb_modem_shaper_config_t *shaper); 209 210 #ifndef BCM_HIDE_DISPATCHABLE 211 212 /* Connect Modem to logic port */ 213 extern int bcm_lb_modem_to_port_map_set( 214 int unit, 215 bcm_modem_t modem_id, 216 uint32 flags, 217 bcm_gport_t port); 218 219 /* Connect Modem to logic port */ 220 extern int bcm_lb_modem_to_port_map_get( 221 int unit, 222 bcm_modem_t modem_id, 223 uint32 flags, 224 bcm_gport_t *port); 225 226 /* Enable or disable LBG */ 227 extern int bcm_lb_enable_set( 228 int unit, 229 bcm_lbg_t lbg_id, 230 uint32 flags, 231 uint32 enable); 232 233 /* Enable or disable LBG */ 234 extern int bcm_lb_enable_get( 235 int unit, 236 bcm_lbg_t lbg_id, 237 uint32 flags, 238 uint32 *enable); 239 240 /* Connect Modem to LBG */ 241 extern int bcm_lb_modem_to_lbg_map_set( 242 int unit, 243 bcm_modem_t modem_id, 244 bcm_lb_direction_type_t direction, 245 uint32 flags, 246 bcm_lbg_t lbg_id); 247 248 /* Connect Modem to LBG */ 249 extern int bcm_lb_modem_to_lbg_map_get( 250 int unit, 251 bcm_modem_t modem_id, 252 bcm_lb_direction_type_t direction, 253 uint32 flags, 254 bcm_lbg_t *lbg_id); 255 256 /* Set sequence number width */ 257 extern int bcm_lb_sequence_number_width_set( 258 int unit, 259 bcm_lbg_t lbg_id, 260 bcm_lb_direction_type_t direction, 261 uint32 flags, 262 int number_width); 263 264 /* Get sequence number width */ 265 extern int bcm_lb_sequence_number_width_get( 266 int unit, 267 bcm_lbg_t lbg_id, 268 bcm_lb_direction_type_t direction, 269 uint32 flags, 270 int *number_width); 271 272 /* Set configuration */ 273 extern int bcm_lb_control_set( 274 int unit, 275 bcm_lbg_t lbg_id, 276 bcm_lb_direction_type_t direction, 277 uint32 flags, 278 bcm_lb_control_t lb_control, 279 int arg); 280 281 /* Set configuration */ 282 extern int bcm_lb_control_get( 283 int unit, 284 bcm_lbg_t lbg_id, 285 bcm_lb_direction_type_t direction, 286 uint32 flags, 287 bcm_lb_control_t lb_control, 288 int *arg); 289 290 /* Set configuration */ 291 extern int bcm_lb_modem_control_set( 292 int unit, 293 bcm_modem_t modem_id, 294 bcm_lb_direction_type_t direction, 295 uint32 flags, 296 bcm_lb_modem_control_t modem_control, 297 int arg); 298 299 /* Get configuration */ 300 extern int bcm_lb_modem_control_get( 301 int unit, 302 bcm_modem_t modem_id, 303 bcm_lb_direction_type_t direction, 304 uint32 flags, 305 bcm_lb_modem_control_t modem_control, 306 int *arg); 307 308 /* Get status of LBG or global */ 309 extern int bcm_lb_status_get( 310 int unit, 311 bcm_lbg_t lbg_id, 312 bcm_lb_direction_type_t direction, 313 uint32 flags, 314 bcm_lb_status_type_t status_type, 315 int *value); 316 317 /* Get status of LBG or global */ 318 extern int bcm_lb_modem_status_get( 319 int unit, 320 bcm_modem_t modem_id, 321 bcm_lb_direction_type_t direction, 322 uint32 flags, 323 bcm_lb_modem_status_type_t status_type, 324 int *value); 325 326 /* Get stat of LBG or global */ 327 extern int bcm_lb_stat_get( 328 int unit, 329 bcm_lbg_t lbg_id, 330 bcm_lb_direction_type_t direction, 331 uint32 flags, 332 bcm_lb_stat_val_t type, 333 uint64 *value); 334 335 /* Get stat of Modem */ 336 extern int bcm_lb_modem_stat_get( 337 int unit, 338 bcm_modem_t modem_id, 339 bcm_lb_direction_type_t direction, 340 uint32 flags, 341 bcm_lb_modem_stat_val_t type, 342 uint64 *value); 343 344 /* Set mapping of port to modem */ 345 extern int bcm_lb_rx_modem_map_set( 346 int unit, 347 bcm_lb_rx_modem_map_index_t *map_index, 348 uint32 flags, 349 bcm_lb_rx_modem_map_config_t *map_config); 350 351 /* Get mapping of port to modem */ 352 extern int bcm_lb_rx_modem_map_get( 353 int unit, 354 bcm_lb_rx_modem_map_index_t *map_index, 355 uint32 flags, 356 bcm_lb_rx_modem_map_config_t *map_config); 357 358 /* Set packet configuration */ 359 extern int bcm_lb_packet_config_set( 360 int unit, 361 uint32 flags, 362 bcm_lb_packet_config_t *packet_config); 363 364 /* Set packet configuration */ 365 extern int bcm_lb_packet_config_get( 366 int unit, 367 uint32 flags, 368 bcm_lb_packet_config_t *packet_config); 369 370 /* Set packet configuration */ 371 extern int bcm_lb_modem_packet_config_set( 372 int unit, 373 bcm_modem_t modem_id, 374 uint32 flags, 375 bcm_lb_modem_packet_config_t *packet_config); 376 377 /* Get packet configuration */ 378 extern int bcm_lb_modem_packet_config_get( 379 int unit, 380 bcm_modem_t modem_id, 381 uint32 flags, 382 bcm_lb_modem_packet_config_t *packet_config); 383 384 /* Set mapping for tc,dp to priority */ 385 extern int bcm_lb_tc_dp_to_priority_config_set( 386 int unit, 387 uint32 flags, 388 bcm_lb_tc_dp_t *tc_dp, 389 bcm_lb_pkt_pri_t *pkt_pri); 390 391 /* Get mapping for tc,dp to priority */ 392 extern int bcm_lb_tc_dp_to_priority_config_get( 393 int unit, 394 uint32 flags, 395 bcm_lb_tc_dp_t *tc_dp, 396 bcm_lb_pkt_pri_t *pkt_pri); 397 398 /* Set scheduler between lbg */ 399 extern int bcm_lb_tx_sched_set( 400 int unit, 401 uint32 flags, 402 int lbg_count, 403 bcm_lb_lbg_weight_t *lbg_weights); 404 405 /* Set scheduler between lbg */ 406 extern int bcm_lb_tx_sched_get( 407 int unit, 408 uint32 flags, 409 int max_lbg_count, 410 bcm_lb_lbg_weight_t *lbg_weights, 411 int *lbg_count); 412 413 /* Set modem shaper */ 414 extern int bcm_lb_modem_shaper_set( 415 int unit, 416 bcm_modem_t modem_id, 417 uint32 flags, 418 bcm_lb_modem_shaper_config_t *shaper); 419 420 /* Get modem shaper */ 421 extern int bcm_lb_modem_shaper_get( 422 int unit, 423 bcm_modem_t modem_id, 424 uint32 flags, 425 bcm_lb_modem_shaper_config_t *shaper); 426 427 /* Set flush operation */ 428 extern int bcm_lb_flush_configure_set( 429 int unit, 430 bcm_lbg_t lbg_id, 431 uint32 flags, 432 bcm_lb_flush_type_t type, 433 int arg); 434 435 /* Get configuration */ 436 extern int bcm_lb_flush_configure_get( 437 int unit, 438 bcm_lbg_t lbg_id, 439 uint32 flags, 440 bcm_lb_flush_type_t type, 441 int *arg); 442 443 #endif /* BCM_HIDE_DISPATCHABLE */ 444 445 #endif /* __BCM_LB_H__ */