cosq_egq.h (38408B)
1 /** 2 * \file bcm_int/dnx/cosq/egress/cosq_egq.h 3 * 4 * 5 * Mainly prototypes of cosq API functions, which are purely 6 * EGQ related, for DNX. \n 7 */ 8 9 /* 10 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 11 * 12 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 13 */ 14 15 #ifndef COSQ_EGQ_H_INCLUDED 16 #define COSQ_EGQ_H_INCLUDED 17 18 #ifndef BCM_DNX_SUPPORT 19 #error "This file is for use by DNX family only!" 20 #endif 21 22 /* 23 * Defines: 24 * { 25 */ 26 /* 27 * } 28 */ 29 /* 30 * Typedefs: 31 * { 32 */ 33 /* 34 * } 35 */ 36 /* 37 * Functions 38 * { 39 */ 40 /** 41 * \brief 42 * Set a single mapping element which indicates, for specified port, to which TCG, 43 * specified priority is mapped. 44 * \param [in] unit - 45 * Int. Identifier of HW platform. 46 * \param [in] gport - 47 * uint32. Gport index to configure. (Converted to logical port to carry out 48 * virtually all required operations.) 49 * \param [in] cosq - 50 * bcm_cos_queue_t. Priority (one of 8) to use in mapping TCG. Essentially, 51 * indicated TCG is mapped to 'priority' which is one of the entries 52 * assigned to 'logical_port'. Basic range is 0 to 7 but it must 53 * also be smaller than the number of priorities assigned to this port. 54 * See dnx_algo_port_priorities_nof_get(). 55 * \param [in] mode 56 * int. Identifier of the TCG to map to indicated priority and logical_port. 57 * If it is in the range BCM_COSQ_SP0 to BCM_COSQ_SP7 then TCG index is 58 * (mode - BCM_COSQ_SP0). 59 * If it is in the range DNX_TCG_MIN to DNX_TCG_MAX then TCG index is 60 * 'mode' itself. 61 * \param [in] weight 62 * int. Ignored. Not used. 63 * \return 64 * \retval Zero - On success 65 * \retval Error - Identifier as per shr_error_e 66 * \remark 67 * * Function description, in other words: Attach Port-Priority of a 68 * given port priority TC-X to the TCG-Y. 69 * \see 70 * * bcm_dnx_cosq_gport_sched_set 71 * * bcm_dnx_cosq_gport_sched_get 72 * * dnx_egr_queuing_tc_to_tcg_mapping_set 73 */ 74 shr_error_e dnx_cosq_egq_gport_egress_tc_to_tcg_map_set( 75 int unit, 76 bcm_gport_t gport, 77 bcm_cos_queue_t cosq, 78 int mode, 79 int weight); 80 /** 81 * \brief 82 * Set a single mapping element which indicates, for specified port, to which TCG, 83 * specified priority is mapped. 84 * \param [in] unit - 85 * Int. Identifier of HW platform. 86 * \param [in] gport - 87 * uint32. Gport index to configure. (Converted to logical port to carry out 88 * virtually all required operations.) 89 * \param [in] cosq - 90 * bcm_cos_queue_t. Priority (one of 8) to use in mapping TCG. Essentially, 91 * indicated TCG is mapped to 'priority' which is one of the entries 92 * assigned to 'logical_port'. Basic range is 0 to 7 but it must 93 * also be smaller than the number of priorities assigned to this port. 94 * See dnx_algo_port_priorities_nof_get(). 95 * \param [out] mode_p 96 * Pointer to int. This procedure loads pointed memory by identifier of 97 * the TCG which is mapped to indicated priority and logical_port. 98 * It is in the range BCM_COSQ_SP0 to BCM_COSQ_SP7. 99 * \param [out] weight_p 100 * Pointer to int. Ignored. Not used. 101 * \return 102 * \retval Zero - On success 103 * \retval Error - Identifier as per shr_error_e 104 * \remark 105 * * Function description, in other words: Get TCG-Y Port-Priority of a 106 * given port priority TC-X. 107 * \see 108 * * bcm_dnx_cosq_gport_sched_set 109 * * bcm_dnx_cosq_gport_sched_get 110 * * dnx_egr_queuing_tc_to_tcg_mapping_set 111 */ 112 shr_error_e dnx_cosq_egq_gport_egress_tc_to_tcg_map_get( 113 int unit, 114 bcm_gport_t gport, 115 bcm_cos_queue_t cosq, 116 int *mode_p, 117 int *weight_p); 118 /** 119 * Purpose: 120 * Set EIR Weight for Egress Port TCG 121 */ 122 /** 123 * \brief - 124 * Configure WFQ parameters (weight) for specified TCG gport 125 * (Sets EIR Weight for Egress Port TCG). 126 * 127 * Sets, for a specified TCG within a certain OFP, its excess rate. 128 * Excess traffic is scheduled between other TCGs according to 129 * weighted fair queueing or strict priority policy. 130 * Sets to 'invalid', in case TCG does not take part in EIR. 131 * \param [in] unit - 132 * HW identifier of unit. 133 * \param [in] gport - 134 * Scheduler port in the format of gport. This parameter determines the 135 * base qpair for which weight is to be set. 136 * See 'mode' below. 137 * \param [in] cosq - 138 * The priority (corresponding to the base qpair related to gport) for which 139 * WFQ (EIR) parameters (weights) are to be set. Note that these parameters 140 * may also be configured to indicate SP (strict priority). 141 * \param [out] mode - 142 * int. Flag. 143 * Can be: 144 * -1 145 * BCM_COSQ_NONE 146 * If set to '-1' then input 'weight' is used. This procedure will select an 147 * element on 'tcg' as per 'cosq' and will load it by input 'weight'. 148 * Note that a 'weight' of '0' indicates 'Strict Priority'. 149 * If set to 'BCM_COSQ_NONE' then input 'weight' is ignored. This procedure 150 * will select an element on 'tcg' as per 'cosq' and will disconnect it from 151 * EIR altogether 152 * \param [out] weight - 153 * This is the weight to assign as per 'mode'. (Only used when mode is -1). 154 * Allowed range is 0 - DNX_COSQ_EGR_OFP_SCH_WFQ_WEIGHT_MAX. 155 * A value of '0' indicates 'Strict Priority'. 156 * \return 157 * If zero (_SHR_E_NONE), then no error was encountered. 158 * Otherwise, see shr_error_e 159 * \remark 160 * * None 161 * \see 162 * * dnx_egr_queuing_tcg_weight_get 163 * * bcm_dnx_cosq_gport_sched_set 164 */ 165 shr_error_e dnx_cosq_egq_gport_egress_port_tcg_sched_set( 166 int unit, 167 bcm_gport_t gport, 168 bcm_cos_queue_t cosq, 169 int mode, 170 int weight); 171 /** 172 * Purpose: 173 * Get EIR Weight for Egress Port TCG. 174 */ 175 /** 176 * \brief - 177 * Get WFQ parameters (weight) for specified TCG gport 178 * (Gets EIR Weight for Egress Port TCG). 179 * 180 * Gets, for a specified TCG within a certain OFP its excess rate. 181 * Excess traffic is scheduled between other TCGs according to 182 * weighted fair queueing or strict priority policy. 183 * Gets 'invalid' indication, in case TCG does not take part in EIR. 184 * \param [in] unit - 185 * HW identifier of unit. 186 * \param [in] gport - 187 * Scheduler port in the format of gport. This parameter determines the 188 * base qpair for which weight is to be retrieved. 189 * See 'mode' below. 190 * \param [in] cosq - 191 * The priority (corresponding to the base qpair related to gport) for which 192 * WFQ (EIR) parameters (weights) are to be retrieved. Note that these parameters 193 * may also be configured to indicate SP (strict priority). 194 * \param [out] mode - 195 * Pointer to int. Flag. 196 * Can be: 197 * -1 198 * BCM_COSQ_NONE 199 * If set to '-1' then '*weight' is meaningful. This procedure selected an 200 * element on 'tcg' as per 'cosq' and has loaded it into '*weight'. 201 * (If 'weight' is '0' then it is configured to 'Strict Priority' over 202 * the other TCG elements). 203 * If set to 'BCM_COSQ_NONE' then '*weight' should be ignored. This procedure 204 * selected an element on 'tcg' as per 'cosq' and has found out it is 205 * disconnected from EIR altogether 206 * \param [out] weight - 207 * See 'mode' above. 208 * \return 209 * If zero (_SHR_E_NONE), then no error was encountered. 210 * Otherwise, see shr_error_e 211 * \remark 212 * * None 213 * \see 214 * * dnx_egr_queuing_tcg_weight_get 215 * * bcm_dnx_cosq_gport_sched_get 216 */ 217 shr_error_e dnx_cosq_egq_gport_egress_port_tcg_sched_get( 218 int unit, 219 bcm_gport_t gport, 220 bcm_cos_queue_t cosq, 221 int *mode, 222 int *weight); 223 /** 224 * \brief - 225 * Configure WFQ parameters (weights) for specified gport. 226 * \param [in] unit - 227 * HW identifier of unit. 228 * \param [in] gport - 229 * Scheduler port in the format of gport. This parameter determines the 230 * base qpair and the traffic type (UC/MC) for which weights are to be set. 231 * See 'mode' below. 232 * \param [in] cosq - 233 * The priority (corresponding to the qpair related to gport) for which 234 * WFQ parameters (weights) are to be set. Note that these parameters may 235 * also indicate SP (strict priority). 236 * \param [in] mode - 237 * int. Flag. 238 * Can be: 239 * -1 240 * DNX_COSQ_EGR_OFP_SCH_SP_HIGH 241 * DNX_COSQ_EGR_OFP_SCH_SP_LOW 242 * If set to '-1' then input 'weight' is used. This procedure will select an 243 * element on 'sch_wfq_p' as per 'is_ucast_egress_queue' and will load it 244 * by input 'weight'. The other element is not touched. 245 * Else 246 * If unicast traffic (non-zero is_ucast_egress_queue) 247 * If 'mode' is SP_HIGH then, 248 * Set unicast weight to '0' and multicast to '1'. This 249 * setup gives strictly high priority to unicast. 250 * If 'mode' is SP_LOW then reverse unicast/multicast roles. 251 * Else (multicast traffic) 252 * If 'mode' is SP_HIGH then, 253 * Set unicast weight to '1' and multicast to '0'. This 254 * setup gives strictly high priority to multicast. 255 * If 'mode' is SP_LOW then reverse unicast/multicast roles. 256 * \param [in] weight - 257 * This is the weight to assign as per 'mode'. (Only used when mode is -1) 258 * \return 259 * If zero (_SHR_E_NONE), then no error was encountered. 260 * Otherwise, see shr_error_e 261 * \remark 262 * Set scheduling mode in OTM port scheduler. 263 * UC and MC Egress queues are handled here. 264 * Configure the SP to connect to and the weighted distribution 265 * between the other queue on the same priority. 266 * \see 267 * * dnx_ofp_rates_wfq_set 268 */ 269 shr_error_e dnx_cosq_egq_queue_wfq_set( 270 int unit, 271 bcm_gport_t gport, 272 bcm_cos_queue_t cosq, 273 int mode, 274 int weight); 275 /** 276 * \brief - 277 * Get 'mode' and 'weight' parameters from WFQ parameters (weights) for 278 * specified gport. 279 * See 'remark' below. 280 * \param [in] unit - 281 * HW identifier of unit. 282 * \param [in] gport - 283 * Scheduler port in the format of gport. This parameter determines the 284 * base qpair and the traffic type (UC/MC) for which mode/weight are to be 285 * derived. See 'mode' below. 286 * \param [in] cosq - 287 * The priority (corresponding to the qpair related to gport) for which 288 * WFQ parameters (weights) are effective. Note that these parameters may 289 * also indicate SP (strict priority). 290 * \param [out] mode - 291 * Pointer to int. This procedure loads pointed memory by a flag as described below. 292 * Can be: 293 * -1 294 * DNX_COSQ_EGR_OFP_SCH_SP_HIGH 295 * DNX_COSQ_EGR_OFP_SCH_SP_LOW 296 * \param [out] weight - 297 * Pointer to int. This procedure loads pointed memory by a flag as described below. 298 * Only meaningful if '*mode' is '-1'. 299 * \return 300 * If zero (_SHR_E_NONE), then no error was encountered. 301 * Otherwise, see shr_error_e 302 * \remark 303 * Do the reverse operation of dnx_cosq_egq_queue_wfq_set(): 304 * Given the weights, get 'mode' and ;weight' 305 * 306 * The algorithm is: 307 * If 'gport' indicates 'unicast' flag 308 * If 'unicast weight' is '0' (SP case) 309 * Set *mode to SP_HIGH (and *weight to -1) 310 * Else if 'multicast weight' is '0' (SP case) 311 * Set *mode to SP_LOW (and *weight to -1) 312 * Else do take weight into consideration: 313 * Set '*mode' to '-1' (meaning 'weight is meaningful') 314 * Set *weight with input 'unicast weight' 315 * Else (gport indicates 'multicast' flag) 316 * If 'multicast weight' is '0' (SP case) 317 * Set *mode to SP_HIGH (and *weight to -1) 318 * Else if 'unicast weight' is '0' (SP case) 319 * Set *mode to SP_LOW (and *weight to -1) 320 * Else do take weight into consideration: 321 * Set '*mode' to '-1' (meaning 'weight is meaningful') 322 * Set *weight with input 'multicast weight' 323 * \see 324 * * dnx_cosq_egress_fill_mode_weight_from_ofp_wfq_sch 325 */ 326 shr_error_e dnx_cosq_egq_queue_wfq_get( 327 int unit, 328 bcm_gport_t gport, 329 bcm_cos_queue_t cosq, 330 int *mode, 331 int *weight); 332 /** 333 * \brief - 334 * Configure Port-TC (q-pair) shaping rate, set single port rate. 335 * \param [in] unit - 336 * HW identifier of unit. 337 * \param [in] gport - 338 * TC port in the format of gport. 339 * \param [in] cosq - 340 * Indicates the 'priority' of the selected port (q-pair): 341 * 0 indicates DNX_EGR_Q_PRIO_0 342 * 1 indicates DNX_EGR_Q_PRIO_1 343 * ... 344 * 7 indicates DNX_EGR_Q_PRIO_7 345 * Other values are illegal 346 * \param [in] kbits_sec_min - 347 * Not used. Must be set to '0'. 348 * \param [in] kbits_sec_max - 349 * Maximal bandwidth in kbits/sec 350 * \param [in] flags - 351 * Not used. Must be set to '0'. 352 * \return 353 * If zero (_SHR_E_NONE), then no error was encountered. 354 * Otherwise, see shr_error_e 355 * \remark 356 * * Indirect output: 357 * * * Updated sw state 358 * * * Updated hw 359 * \see 360 * * dnx_ofp_rates_egq_port_priority_rate_sw_set 361 * * dnx_ofp_rates_egq_port_priority_rate_hw_set 362 */ 363 shr_error_e dnx_cosq_egq_gport_egress_port_tc_bandwidth_set( 364 int unit, 365 bcm_gport_t gport, 366 bcm_cos_queue_t cosq, 367 uint32 kbits_sec_min, 368 uint32 kbits_sec_max, 369 uint32 flags); 370 /** 371 * Purpose: 372 * Get Port-TC (q-pair) shaping rate 373 */ 374 /** 375 * \brief - 376 * Get Port-TC (q-pair) shaping rate, get single port rate. 377 * Data is extracted directly from HW. 378 * \param [in] unit - 379 * HW identifier of unit. 380 * \param [in] gport - 381 * TC port in the format of gport. 382 * \param [in] cosq - 383 * Indicates the 'priority' of the selected port (q-pair): 384 * 0 indicates DNX_EGR_Q_PRIO_0 385 * 1 indicates DNX_EGR_Q_PRIO_1 386 * ... 387 * 7 indicates DNX_EGR_Q_PRIO_7 388 * Other values are illegal 389 * \param [out] kbits_sec_min - 390 * Pointer to uint32. Not used. Set to '0' by this procedure. 391 * \param [out] kbits_sec_max - 392 * Pointer to uint32. This procedure loads pointed memory by 393 * maximal bandwidth in kbits/sec 394 * \param [out] flags - 395 * Pointer to uint32. Not used. Set to '0' by this procedure. 396 * \return 397 * If zero (_SHR_E_NONE), then no error was encountered. 398 * Otherwise, see shr_error_e 399 * \remark 400 * * Indirect output: 401 * * * sw state 402 * \see 403 * * dnx_ofp_rates_egq_port_priority_rate_hw_get 404 */ 405 shr_error_e dnx_cosq_egq_gport_egress_port_tc_bandwidth_get( 406 int unit, 407 bcm_gport_t gport, 408 bcm_cos_queue_t cosq, 409 uint32 *kbits_sec_min, 410 uint32 *kbits_sec_max, 411 uint32 *flags); 412 /** 413 * \brief - 414 * Configure TCG shaping rate 415 * \param [in] unit - 416 * HW identifier of unit. 417 * \param [in] gport - 418 * TCG port in the format of gport. 419 * \param [in] cosq - 420 * Indicates the offset of TCG from port scheduler corresponding to 421 * base q-pair of 'gport': 422 * Must be between 0 and the number of priorities assigned to this port. 423 * (The full TCG index range is between 0 (DNX_TCG_MIN) and 7 (DNX_TCG_MAX)). 424 * \param [in] kbits_sec_min - 425 * Not used. Must be set to '0'. 426 * \param [in] kbits_sec_max - 427 * Maximal bandwidth in kbits/sec. Must not be larger than DNX_IF_MAX_RATE_KBPS(unit) 428 * See dnx_data_egr_queuing.params.max_gbps_rate_egq 429 * \param [in] flags - 430 * Not used. Must be set to '0'. 431 * \return 432 * If zero (_SHR_E_NONE), then no error was encountered. 433 * Otherwise, see shr_error_e 434 * \remark 435 * * Indirect output: 436 * * * Updated sw state 437 * * * Updated hw 438 * * TCG is calculated by adding 'cosq' to the base qpair which matches input 439 * 'gport' (modulo DNX_COSQ_TCG_NOF_PRIORITIES_SUPPORT (= 8)). The net result 440 * must be between DNX_TCG_MIN and DNX_TCG_MAX. 441 * \see 442 * * dnx_ofp_rates_egq_tcg_rate_sw_set 443 * * dnx_ofp_rates_egq_tcg_rate_hw_set 444 * * dnx_algo_port_priorities_nof_get 445 */ 446 shr_error_e dnx_cosq_egq_gport_egress_port_tcg_bandwidth_set( 447 int unit, 448 bcm_gport_t gport, 449 bcm_cos_queue_t cosq, 450 uint32 kbits_sec_min, 451 uint32 kbits_sec_max, 452 uint32 flags); 453 /** 454 * \brief - 455 * Given TCG-port and tcg index on it, get corresponding shaping rate. 456 * \param [in] unit - 457 * HW identifier of unit. 458 * \param [in] gport - 459 * Gport to retrieve corresponding qpair for. 460 * \param [in] cosq - 461 * TCG index (priority) on specified port. Must be smaller than the number 462 * of priorities assigned to this port. 463 * \param [out] kbits_sec_min - 464 * Pointer to uint32. Not used. Called procedure loads it by '0'. 465 * \param [in] kbits_sec_max - 466 * Pointer to uint32. Called procedure loads it by assigned bandwidth 467 * in kbits/sec 468 * \param [in] flags - 469 * Pointer to uint32. Not used. Called procedure loads it by '0'. 470 * \return 471 * If zero (_SHR_E_NONE), then no error was encountered. 472 * Otherwise, see shr_error_e 473 * \remark 474 * * Note that number of assigned prioriries for TCG port may be either 8 or 4 475 * \see 476 * * bcm_dnx_cosq_gport_bandwidth_get 477 */ 478 shr_error_e dnx_cosq_egq_gport_egress_port_tcg_bandwidth_get( 479 int unit, 480 bcm_gport_t gport, 481 bcm_cos_queue_t cosq, 482 uint32 *kbits_sec_min, 483 uint32 *kbits_sec_max, 484 uint32 *flags); 485 /** 486 * \brief - 487 * Configure OFP shaping rate, set configuration per interface. 488 * \param [in] unit - 489 * HW identifier of unit. 490 * \param [in] gport - 491 * Interface port in the format of gport. 492 * \param [in] cosq - 493 * Not used. Must be set to '0'. 494 * \param [in] kbits_sec_min - 495 * Not used. Must be set to '0'. 496 * \param [in] kbits_sec_max - 497 * Maximal bandwidth in kbits/sec 498 * \param [in] flags - 499 * Not used. Must be set to '0'. 500 * \return 501 * If zero (_SHR_E_NONE), then no error was encountered. 502 * Otherwise, see shr_error_e 503 * \remark 504 * * Input port must NOT be channelized. For a channelized port, see 505 * dnx_egq_ofp_rates_port_bandwidth_set(). 506 * * Indirect output: 507 * * * Updated sw state: dnx_ofp_rate_db.otm 508 * * * Updated hw 509 * \see 510 * * dnx_ofp_rates_egq_otm_shapers_set 511 */ 512 shr_error_e dnx_cosq_egq_gport_egress_interface_scheduler_bandwidth_set( 513 int unit, 514 bcm_gport_t gport, 515 bcm_cos_queue_t cosq, 516 uint32 kbits_sec_min, 517 uint32 kbits_sec_max, 518 uint32 flags); 519 /** 520 * \brief - 521 * Get configuration of OFP shaping rate, get configuration per interface. 522 * \param [in] unit - 523 * HW identifier of unit. 524 * \param [in] gport - 525 * Interface port in the format of gport. 526 * \param [in] cosq - 527 * Not used. Must be set to '0'. 528 * \param [out] kbits_sec_min - 529 * Pointer to uint32. Not used. Set to '0' by this procedure. 530 * \param [out] kbits_sec_max - 531 * Pointer to uint32. This procedure loads pointed memory by 532 * maximal bandwidth in kbits/sec 533 * \param [out] flags - 534 * Pointer to uint32. Not used. Set to '0' by this procedure. 535 * \return 536 * If zero (_SHR_E_NONE), then no error was encountered. 537 * Otherwise, see shr_error_e 538 * \remark 539 * * Input port must NOT be channelized. For a channelized port, see 540 * dnx_egq_ofp_rates_port_bandwidth_get(). 541 * * Indirect output: 542 * * * Sw state: dnx_ofp_rate_db.otm 543 * \see 544 * * dnx_ofp_rates_egq_interface_shaper_get 545 */ 546 shr_error_e dnx_cosq_egq_gport_egress_interface_scheduler_bandwidth_get( 547 int unit, 548 bcm_gport_t gport, 549 bcm_cos_queue_t cosq, 550 uint32 *kbits_sec_min, 551 uint32 *kbits_sec_max, 552 uint32 *flags); 553 /** 554 * \brief 555 * Set various features, depnding on type, for egress 'OTM port' scheduler. 556 * Given 'gport' and priority ('cosq') to identify a specific qpair, 557 * use input 'type' to identify the required operation and use 'arg' for 558 * that operation. 559 * \param [in] unit - 560 * HW Unit-ID 561 * \param [in] gport - 562 * bcm_gport_t. Gport used to identify the target 'base qpair'. 563 * \param [in] cosq - 564 * bcm_cos_queue_t. NOT USED by this procedure. Must be set to '0'. 565 * \param [in] type - 566 * bcm_cosq_control_t. Can be: 567 * bcmCosqControlPacketLengthAdjust: 568 * Set 'compensation' for OTM port (on 'channelized arbiter' calendar, 569 * DNX_OFP_RATES_EGQ_CAL_CHAN_ARB). 'Arg' is the value of 'header compensation' 570 * to apply, in bytes. Value must be smaller than 64. 571 * Header Compensation is used to adjust for differences in the packet header size 572 * to account for network headers added by the network interface. 573 * bcmCosqControlBandwidthBurstMax: 574 * Set 'max burst' for all slots corresponding to OTM port (on 575 * 'DNX_OFP_RATES_EGQ_CAL_CHAN_ARB' calendar). 576 * 'Arg' is the value of the maximal burst allowed, in bytes. 577 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 578 * bcmCosqControlBandwidthBurstMaxEmptyQueue: 579 * Set 'max burst' for all OTM port shapers (on 'DNX_OFP_RATES_EGQ_CAL_CHAN_ARB' 580 * calendar) which are in 'empty' state. 581 * 'Arg' is the value of the maximal burst allowed, in bytes. 582 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_EMPTY_Q_LIMIT_MAX. 583 * bcmCosqControlEgressPriorityOverCast: 584 * Select mode of operation for the two queues (unicast and multicast) corresponding to 585 * specified OTM port: If '0' then WFQ is done before SP. Else SP is done before WFQ. 586 * 'Arg' is 'enable' value (0 or 1). 587 * \param [in] arg - 588 * int. General parameter. See 'type' above. 589 * \return 590 * If zero (_SHR_E_NONE), then no error was encountered. 591 * Otherwise, see shr_error_e 592 * \remark 593 * * None 594 * \see 595 * * dnx_egr_queuing_port_is_high_set 596 */ 597 shr_error_e dnx_cosq_egq_control_egress_port_scheduler_set( 598 int unit, 599 bcm_gport_t gport, 600 bcm_cos_queue_t cosq, 601 bcm_cosq_control_t type, 602 int arg); 603 /** 604 * \brief 605 * Set various features, depnding on type, for egress 'TC port' scheduler. 606 * Given 'gport' and priority ('cosq') to identify a specific qpair, 607 * use input 'type' to identify the required operation and use 'arg' for that operation. 608 * \param [in] unit - 609 * HW Unit-ID 610 * \param [in] gport - 611 * bcm_gport_t. Gport used to identify the target 'base qpair'. Together with 612 * 'cosq' the exact target qpair can be identified ('target qpair' = 'base qpair' plus 613 * 'priority') 614 * \param [in] cosq - 615 * bcm_cos_queue_t. Priority of target qpair. Can either be in the range from 0 to 616 * 7 or BCM_COSQ_HIGH_PRIORITY or BCM_COSQ_LOW_PRIORITY. See dnx_cosq_egq_cosq_priority_convert(). 617 * \param [in] type - 618 * bcm_cosq_control_t. Can be: 619 * bcmCosqControlBandwidthBurstMax: 620 * Set 'max burst' for TC port (on 'priority' calendar). 'Arg' is the value of 621 * the maximal burst allowed, in bytes. 622 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 623 * bcmCosqControlBandwidthBurstMaxEmptyQueue: 624 * Set 'max burst' for all TC port (on 'priority' calendar) which are in 'empty' state. 625 * 'Arg' is the value of the maximal burst allowed, in bytes. 626 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 627 * The parameter 'cosq' is not used and 'gport' is only used to verify it is a TC port. 628 * bcmCosqControlBandwidthBurstMaxFlowControlledQueue: 629 * Set 'max burst' for all TC port (on 'priority' calendar) which are in 'Flow Control' 630 * state. 'Arg' is the value of the maximal burst allowed, in bytes. 631 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 632 * The parameter 'cosq' is not used and 'gport' is only used to verify it is a TC port. 633 * bcmCosqControlPrioritySelect 634 * Set priority (High/low), to indicated qpair (port), to the inreface on which it is 635 * channelized. If indicated port is not channelized, this operation is ignored (by HW). 636 * 'Arg' indicates the priority to assign to interface corresponding to indicated qpair. 637 * Can only be high (BCM_COSQ_SP0) or low (BCM_COSQ_SP1). See 638 * dnx_egq_dbal_gport_scheduler_queue_sched_set(). 639 * \param [in] arg - 640 * int. General parameter. See 'type' above. 641 * \return 642 * If zero (_SHR_E_NONE), then no error was encountered. 643 * Otherwise, see shr_error_e 644 * \remark 645 * * Accessing HW table EPS_DWM, fields UC_OR_UC_LOW_QUEUE_WEIGHT, MC_OR_MC_LOW_QUEUE_WEIGHT 646 * * Accessing DBAL table DBAL_TABLE_EGQ_QPAIR_ATTRIBUTES, fields MC_OR_MC_LOW_QUEUE_WEIGHT, 647 * UC_OR_UC_LOW_QUEUE_WEIGHT using 'entry_offset' and 'core' as key. 648 * \see 649 * * dnx_egr_queuing_port_is_high_set 650 */ 651 shr_error_e dnx_cosq_egq_control_egress_port_tc_set( 652 int unit, 653 bcm_gport_t gport, 654 bcm_cos_queue_t cosq, 655 bcm_cosq_control_t type, 656 int arg); 657 /** 658 * \brief 659 * Set various features, depnding on type, for egress 'TCG' scheduler. 660 * Given 'gport' and offset ('cosq') to identify a TCG index, 661 * use input 'type' to identify the required operation and use 'arg' for that operation. 662 * \param [in] unit - 663 * HW Unit-ID 664 * \param [in] gport - 665 * bcm_gport_t. Gport used to identify the target 'base qpair'. Together with 666 * 'cosq' the exact TCG can be identified ('TCG' = 'base qpair % TCG_NOF_PRIORITIES' plus 'cosq') 667 * \param [in] cosq - 668 * bcm_cos_queue_t. Offset of target TCG. Must be within the range from DNX_TCG_MIN to 669 * DNX_NOF_TCGS. See dnx_cosq_bcm_cosq_to_tcg(). 670 * \param [in] type - 671 * bcm_cosq_control_t. Can be: 672 * bcmCosqControlBandwidthBurstMax: 673 * Set 'max burst' for TCG (on 'TCG' calendar, DNX_OFP_RATES_EGQ_CAL_TCG). 'Arg' 674 * is the value of the maximal burst allowed, in bytes. 675 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 676 * \param [in] arg - 677 * int. General parameter. See 'type' above. 678 * \return 679 * If zero (_SHR_E_NONE), then no error was encountered. 680 * Otherwise, see shr_error_e 681 * \remark 682 * * Accessing HW table EPS_TCG_CREDIT_TABLE, field TCG_MAX_BURST 683 * * Accessing DBAL table DBAL_TABLE_EGQ_SHAPING_TCG_CREDIT_TABLE, field DBAL_FIELD_TCG_MAX_BURST. 684 * \see 685 * * dnx_ofp_rates_egq_tcg_max_burst_set 686 */ 687 shr_error_e dnx_cosq_egq_control_egress_port_tcg_set( 688 int unit, 689 bcm_gport_t gport, 690 bcm_cos_queue_t cosq, 691 bcm_cosq_control_t type, 692 int arg); 693 /** 694 * \brief 695 * Get various parameters, depnding on type, for egress 'TC port' scheduler. 696 * Given 'gport' and priority ('cosq') to identify a specific qpair, 697 * use input 'type' to identify the required operation and use 'arg' for that operation. 698 * \param [in] unit - 699 * HW Unit-ID 700 * \param [in] gport - 701 * bcm_gport_t. Gport used to identify the target 'base qpair'. Together with 702 * 'cosq' the exact target qpair can be identified ('target qpair' = 'base qpair' plus 703 * 'priority') 704 * \param [in] cosq - 705 * bcm_cos_queue_t. Priority of target qpair. Can either be in the range from 0 to 706 * 7 or BCM_COSQ_HIGH_PRIORITY or BCM_COSQ_LOW_PRIORITY. See dnx_cosq_egq_cosq_priority_convert(). 707 * \param [in] type - 708 * bcm_cosq_control_t. Can be: 709 * bcmCosqControlBandwidthBurstMax: 710 * Get 'max burst' for TC port (on 'priority' calendar). '*Arg' is used to store the 711 * value of the maximal burst allowed, in bytes. 712 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 713 * bcmCosqControlBandwidthBurstMaxEmptyQueue: 714 * Get 'max burst' for all TC port (on 'priority' calendar) which are in 'empty' state. 715 * '*Arg' is used to store the value of the maximal burst allowed, in bytes. 716 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 717 * The parameter 'cosq' is not used and 'gport' is only used to verify it is a TC port. 718 * bcmCosqControlBandwidthBurstMaxFlowControlledQueue: 719 * Get 'max burst' for all TC port (on 'priority' calendar) which are in 'Flow Control' 720 * state. '*Arg' is used to store the value of the maximal burst allowed, in bytes. 721 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 722 * The parameter 'cosq' is not used and 'gport' is only used to verify it is a TC port. 723 * bcmCosqControlPrioritySelect 724 * Get priority (High/low), related to indicated qpair (port), to the inreface on which 725 * it is channelized. (If indicated port is not channelized, this operation is meaningless). 726 * '*Arg' is used to indicate the priority assigned to the interface corresponding to 727 * indicated qpair. 728 * Can only be high (BCM_COSQ_SP0) or low (BCM_COSQ_SP1). See 729 * dnx_egq_dbal_gport_scheduler_queue_sched_set(). 730 * \param [in] arg - 731 * int. General parameter. See 'type' above. 732 * \return 733 * If zero (_SHR_E_NONE), then no error was encountered. 734 * Otherwise, see shr_error_e 735 * \remark 736 * * Accessing HW table EPS_DWM, fields UC_OR_UC_LOW_QUEUE_WEIGHT, MC_OR_MC_LOW_QUEUE_WEIGHT 737 * * Accessing DBAL table DBAL_TABLE_EGQ_QPAIR_ATTRIBUTES, fields MC_OR_MC_LOW_QUEUE_WEIGHT, 738 * UC_OR_UC_LOW_QUEUE_WEIGHT using 'entry_offset' and 'core' as key. 739 * \see 740 * * dnx_egr_queuing_port_is_high_set 741 */ 742 shr_error_e dnx_cosq_egq_control_egress_port_tc_get( 743 int unit, 744 bcm_gport_t gport, 745 bcm_cos_queue_t cosq, 746 bcm_cosq_control_t type, 747 int *arg); 748 /** 749 * \brief 750 * Get various parameters, depnding on type, for egress 'TCG' scheduler. 751 * Given 'gport' and offset ('cosq') to identify a TCG index, 752 * use input 'type' to identify the required operation and use 'arg' for output. 753 * \param [in] unit - 754 * HW Unit-ID 755 * \param [in] gport - 756 * bcm_gport_t. Gport used to identify the target 'base qpair'. Together with 757 * 'cosq' the exact TCG can be identified ('TCG' = 'base qpair % TCG_NOF_PRIORITIES' plus 'cosq') 758 * \param [in] cosq - 759 * bcm_cos_queue_t. Offset of target TCG. Must be within the range from DNX_TCG_MIN to 760 * DNX_NOF_TCGS. See dnx_cosq_bcm_cosq_to_tcg(). 761 * \param [in] type - 762 * bcm_cosq_control_t. Can be: 763 * bcmCosqControlBandwidthBurstMax: 764 * Get 'max burst' for TCG (on 'TCG' calendar, DNX_OFP_RATES_EGQ_CAL_TCG). Use '*arg' 765 * to store retrieved maximal burst allowed, in bytes. 766 * \param [out] arg - 767 * Pointer to int. General parameter. See 'type' above. 768 * \return 769 * If zero (_SHR_E_NONE), then no error was encountered. 770 * Otherwise, see shr_error_e 771 * \remark 772 * * Accessing HW table EPS_TCG_CREDIT_TABLE, field TCG_MAX_BURST 773 * * Accessing DBAL table DBAL_TABLE_EGQ_SHAPING_TCG_CREDIT_TABLE, field DBAL_FIELD_TCG_MAX_BURST. 774 * \see 775 * * dnx_ofp_rates_egq_tcg_max_burst_get 776 */ 777 shr_error_e dnx_cosq_egq_control_egress_port_tcg_get( 778 int unit, 779 bcm_gport_t gport, 780 bcm_cos_queue_t cosq, 781 bcm_cosq_control_t type, 782 int *arg); 783 /** 784 * \brief 785 * Get various parameters, depnding on type, for egress OTM port scheduler. 786 * Given 'gport' and priority ('cosq') to identify a specific qpair, 787 * use input 'type' to identify the required operation and use '*arg' 788 * to store output. 789 * \param [in] unit - 790 * HW Unit-ID 791 * \param [in] gport - 792 * bcm_gport_t. Gport used to identify the target 'base qpair'. 793 * \param [in] cosq - 794 * bcm_cos_queue_t. NOT USED by this procedure. Must be set to '0'. 795 * \param [in] type - 796 * bcm_cosq_control_t. Can be: 797 * bcmCosqControlPacketLengthAdjust: 798 * Get 'compensation' for OTM port (on 'channelized arbiter' calendar, 799 * DNX_OFP_RATES_EGQ_CAL_CHAN_ARB). '*Arg' is used to store the value of 'header 800 * compensation', in bytes. Value should be smaller than 64. 801 * Header Compensation is used to adjust for differences in the packet header size 802 * to account for network headers added by the network interface. 803 * bcmCosqControlBandwidthBurstMax: 804 * Get 'max burst' for all slots corresponding to OTM port (on 805 * 'DNX_OFP_RATES_EGQ_CAL_CHAN_ARB' calendar). 806 * '*Arg' is used to store the value of the maximal burst allowed, in bytes. 807 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_LIMIT_MAX. 808 * bcmCosqControlBandwidthBurstMaxEmptyQueue: 809 * Get 'max burst' for all OTM port shapers (on 'DNX_OFP_RATES_EGQ_CAL_CHAN_ARB' 810 * calendar) which are in 'empty' state. 811 * '*Arg' is used to store the value of the maximal burst allowed, in bytes. 812 * Value is limited by an upper limit of DNX_OFP_RATES_BURST_EMPTY_Q_LIMIT_MAX. 813 * bcmCosqControlEgressPriorityOverCast: 814 * Get selected mode of operation for the two queues (unicast and multicast) 815 * corresponding to specified OTM port: If '0' then WFQ is done before SP. 816 * Else SP is done before WFQ. '*Arg' is used to store the 'enable' value 817 * (0 or 1). 818 * \param [in] arg_p - 819 * Pointer to int. General output parameter. See 'type' above. 820 * \return 821 * If zero (_SHR_E_NONE), then no error was encountered. 822 * Otherwise, see shr_error_e 823 * \remark 824 * * None 825 * \see 826 * * dnx_egr_queuing_port_is_high_get 827 */ 828 shr_error_e dnx_cosq_egq_control_egress_port_scheduler_get( 829 int unit, 830 bcm_gport_t gport, 831 bcm_cos_queue_t cosq, 832 bcm_cosq_control_t type, 833 int *arg_p); 834 /* 835 * This procedure is currently empty. Fill proper header 836 * when it gets meaningful info. 837 * Purpose: 838 * Set various controls related to egress interface scheduler 839 * (interface port) 840 */ 841 shr_error_e dnx_cosq_control_egress_interface_scheduler_set( 842 int unit, 843 bcm_gport_t port, 844 bcm_cos_queue_t cosq, 845 bcm_cosq_control_t type, 846 int arg); 847 /** 848 * Purpose: 849 * Retrieve specific multicast configuration (out_dp) from port 850 */ 851 /* 852 * \brief - 853 * Retrieve specific multicast configuration (out_tc,out_dp) from egress multicast port. 854 * (out_tc is, essentially, 'offset' from base qpair) 855 * Given a gport plus priority (TC) and Drop-precedence (DP) of multicast traffic 856 * entering egress, get the priority for outgoing traffic (by inquiring its port). 857 * Also, get DP of outgoing traffic into 'config' below. 858 * \param [in] unit - 859 * HW Identifier of the device to access. 860 * \param [in] gport - 861 * bcm_gport_t. Identifier of traffic by its assigned gport. 862 * \param [in] ingress_pri - 863 * bcm_cos_t. Priority (TC) of traffic entering egress. Must be between 0 and 864 * DNX_DEVICE_COSQ_ING_NOF_TC-1 (7). 865 * \param [in] ingress_dp - 866 * bcm_color_t. Drop precedence of traffic entering egress. Must be between 0 and 867 * DNX_DEVICE_COSQ_ING_NOF_DP-1 (3). 868 * \param [in] flags - 869 * uint32. Must be BCM_COSQ_MULTICAST_SCHEDULED 870 * \param [out] config_p - 871 * Pointer to structure of type bcm_cosq_egress_multicast_config_t. This procedure loads only 872 * two elements: 873 * 'priority' - 874 * Priority set to assign to outgoing multicast traffic. Must be between 0 and 875 * DNX_EGR_NOF_Q_PRIO-1 (7). 876 * 'scheduled_dp' - 877 * Drop precedence set to assign to outgoing multicast traffic. 878 * \return 879 * If zero (_SHR_E_NONE), then no error was encountered. 880 * Otherwise, see shr_error_e 881 * \remark 882 * * All info is extracted from sw. See dnx_am_template_egress_queue_mapping_data_get(). 883 * \see 884 * * dnx_am_template_egress_queue_mapping_data_get 885 */ 886 shr_error_e dnx_cosq_egq_gport_egress_multicast_config_get( 887 int unit, 888 bcm_gport_t gport, 889 bcm_cos_t ingress_pri, 890 bcm_color_t ingress_dp, 891 uint32 flags, 892 bcm_cosq_egress_multicast_config_t * config); 893 /* 894 * This procedure is currently empty. Fill proper header 895 * when it gets meaningful info. 896 * Purpose: 897 * Get various controls related to egress interface scheduler 898 * (interface port) 899 */ 900 int dnx_cosq_control_egress_interface_scheduler_get( 901 int unit, 902 bcm_gport_t port, 903 bcm_cos_queue_t cosq, 904 bcm_cosq_control_t type, 905 int *arg); 906 /** 907 * \brief - 908 * Given 'BCM cosq' (priority), get the corresponding local 'EGQ priority' 909 * \param [in] unit - 910 * Unit HW id 911 * \param [in] cosq - 912 * int. BCM priority, to convert. 913 * \param [out] prio_p - 914 * Pointer to dnx_egr_q_prio_e. This procedure loads pointed memory by 915 * 'EGQ priority' corresponding to input 'cosq'. 916 * \return 917 * If zero (_SHR_E_NONE), then no error was encountered. 918 * Otherwise, see shr_error_e 919 * \remark 920 * * None 921 * \see 922 * * dnx_cosq_gport_egress_scheduler_queue_sched_set 923 */ 924 shr_error_e dnx_cosq_egq_cosq_priority_convert( 925 int unit, 926 int cosq, 927 dnx_egr_q_prio_e * prio_p); 928 /** 929 * \brief 930 * Given 'gport' and intended 'priority' (cosq), verify that the latter is within 931 * priority range assigned for this 'gport' 932 * \param [in] unit - 933 * HW Unit-ID 934 * \param [in] gport - 935 * bcm_gport_t. Gport used to identify the target 'logical_port' using which, allowed 936 * 'priority' range is extracted. 937 * \param [in] cosq - 938 * bcm_cos_queue_t. Intended Priority for 'gport'. 939 * \return 940 * If zero (_SHR_E_NONE), then no error was encountered. 941 * Otherwise, see shr_error_e 942 * \remark 943 * * None 944 * \see 945 * * dnx_cosq_gport_egress_scheduler_queue_sched_set 946 * * dnx_algo_port_db 947 */ 948 shr_error_e dnx_cosq_egq_port_priority_validate( 949 int unit, 950 bcm_gport_t gport, 951 bcm_cos_queue_t cosq); 952 /** 953 * \brief 954 * Schedule mode for Channelized NIF port and CPU interface. 955 * Get value of Strict priority currently used by this system. SP range: H/L 956 * Given 'gport' to identify a specific base qpair, 957 * get its priority as specified in 'mode' (high or low). 958 * \param [in] unit - 959 * HW Unit-ID 960 * \param [in] gport - 961 * bcm_gport_t. Gport used to identify the target 'base qpair'. Together with 962 * 'cosq' the exact target qpair can be identified ('target qpair' = 'base qpair' plus 963 * 'priority') 964 * \param [in] cosq - 965 * bcm_cos_queue_t. Must be '0'. 966 * \param [out] mode - 967 * Pointer to int. This procedure loads pointed memory by the priority assigned to interface 968 * corresponding to indicated qpair. Can only be high (BCM_COSQ_SP0) or low (BCM_COSQ_SP1). 969 * See dnx_egq_dbal_gport_scheduler_queue_sched_set(). 970 * \param [out] weight - 971 * Pointer int. Ignored by this procedure. (Loaded by '-1') 972 * \return 973 * If zero (_SHR_E_NONE), then no error was encountered. 974 * Otherwise, see shr_error_e 975 * \remark 976 * * Accessing HW table EPS_QP_CFG, field QP_IS_HP 977 * * Accessing DBAL table DBAL_TABLE_EGQ_QPAIR_ATTRIBUTES, field DBAL_FIELD_QP_IS_HP 978 * \see 979 * * dnx_egr_queuing_port_is_high_set 980 */ 981 shr_error_e dnx_cosq_egq_gport_egress_scheduler_queue_sched_get( 982 int unit, 983 bcm_gport_t gport, 984 bcm_cos_queue_t cosq, 985 int *mode, 986 int *weight); 987 988 /** 989 * \brief - 990 * Given 'gport', convert to the corresponding 'logical port' 991 * 992 * \param [in] unit - 993 * Unit HW id 994 * \param [in] gport - 995 * bcm_gport_t. Gport to convert 996 * \param [out] user_port_p - 997 * Pointer to bcm_port_t. This procedure loads pointed memory by 'logical port' 998 * corresponding to input 'gport'. 999 * \return 1000 * If zero (_SHR_E_NONE), then no error was encountered. 1001 * Otherwise, see shr_error_e 1002 * \remark 1003 * * None 1004 * \see 1005 * * dnx_cosq_egq_port_priority_validate 1006 */ 1007 shr_error_e dnx_cosq_egq_user_port_get( 1008 int unit, 1009 bcm_gport_t gport, 1010 bcm_port_t * user_port_p); 1011 /* 1012 * } 1013 */ 1014 1015 #endif /* COSQ_EGQ_H_INCLUDED */