openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

scheduler.h (25023B)


      1 /*
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5  */
      6 /*
      7  * ! \file bcm_int/dnx/cosq/scheduler.h
      8  * Reserved.$ 
      9  */
     10 
     11 #ifndef _DNX_SCHEDULER_H_INCLUDED_
     12 /*
     13  * { 
     14  */
     15 #define _DNX_SCHEDULER_H_INCLUDED_
     16 
     17 #ifndef BCM_DNX_SUPPORT
     18 #error "This file is for use by DNX (JR2) family only!"
     19 #endif
     20 
     21 #include <bcm/cosq.h>
     22 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h>
     23 #include <soc/dnx/dbal/dbal.h>
     24 #include <bcm_int/dnx/algo/port/algo_port_mgmt.h>
     25 
     26 #define DNX_SCH_REGION_INDEX_FROM_FLOW_INDEX_GET(flow_id) ((flow_id)/dnx_data_sch.flow.region_size_get(unit))
     27 
     28 #define DNX_SCH_FLOW_ID_FROM_REMOTE_CORE(base_flow_id, nof_remote_cores, core) ((base_flow_id) + (dnx_data_sch.flow.region_size_get(unit)/(nof_remote_cores))*(core))
     29 
     30 #define DNX_SCHEDULER_ELEMENT_HR_ID_GET(unit, se_id) (se_id - dnx_data_sch.flow.hr_se_id_min_get(unit))
     31 
     32 #define DNX_SCHEDULER_HR_SE_ID_GET(unit, hr_id) (hr_id + dnx_data_sch.flow.hr_se_id_min_get(unit))
     33 
     34 #define DNX_SCHEDULER_QUARTET_SIZE 4
     35 
     36 #define DNX_SCHEDULER_QUARTET_TO_FLOW_ID(quartet) ((quartet) * DNX_SCHEDULER_QUARTET_SIZE)
     37 #define DNX_SCHEDULER_FLOW_ID_TO_QUARTET(flow_id) ((flow_id) / DNX_SCHEDULER_QUARTET_SIZE)
     38 
     39 /* ENUMS
     40  * {
     41  */
     42 
     43 typedef enum
     44 {
     45     /*
     46      *  undefined value
     47      */
     48     DNX_SCH_ELEMENT_SE_TYPE_NONE = 0,
     49     /*
     50      *  HR scheduler element
     51      */
     52     DNX_SCH_ELEMENT_SE_TYPE_HR = 1,
     53     /*
     54      *  CL scheduler element
     55      */
     56     DNX_SCH_ELEMENT_SE_TYPE_CL = 2,
     57     /*
     58      *  FQ scheduler element
     59      */
     60     DNX_SCH_ELEMENT_SE_TYPE_FQ = 3,
     61     /*
     62      *  Must be the last value
     63      */
     64     DNX_SCH_ELEMENT_SE_TYPE_LAST
     65 } dnx_sch_element_se_type_e;
     66 
     67 /**
     68  * \brief
     69  *   All flow allocations types.
     70  *
     71  * \remark
     72  */
     73 typedef enum
     74 {
     75     DNX_SCH_ALLOC_FLOW_TYPE_INVALID = -1,
     76     /*
     77      * Normal connector
     78      */
     79     DNX_SCH_ALLOC_FLOW_TYPE_CONNECTOR = 0,
     80     /*
     81      * Composite connector 
     82      */
     83     DNX_SCH_ALLOC_FLOW_TYPE_COMP_CONNECTOR = 1,
     84     /*
     85      * Normal FQ 
     86      */
     87     DNX_SCH_ALLOC_FLOW_TYPE_FQ,
     88     /*
     89      * Composite FQ 
     90      */
     91     DNX_SCH_ALLOC_FLOW_TYPE_COMP_FQ,
     92     /*
     93      * Normal CL 
     94      */
     95     DNX_SCH_ALLOC_FLOW_TYPE_CL,
     96     /*
     97      * Composite CL 
     98      */
     99     DNX_SCH_ALLOC_FLOW_TYPE_COMP_CL,
    100     /*
    101      * Enhanced CL
    102      */
    103     DNX_SCH_ALLOC_FLOW_TYPE_ENHANCED_CL,
    104     /*
    105      * Normal HR 
    106      */
    107     DNX_SCH_ALLOC_FLOW_TYPE_HR,
    108     /*
    109      * Composite HR 
    110      */
    111     DNX_SCH_ALLOC_FLOW_TYPE_COMP_HR,
    112     /*
    113      * Dual shaper (2p) CL-FQ
    114      */
    115     DNX_SCH_ALLOC_FLOW_TYPE_SHARED_CL_FQ,
    116     /*
    117      * 4P Shared shaper 
    118      */
    119     DNX_SCH_ALLOC_FLOW_TYPE_SHARED_SE_4,
    120     /*
    121      * 8P Shared shaper 
    122      */
    123     DNX_SCH_ALLOC_FLOW_TYPE_SHARED_SE_8,
    124 
    125     DNX_SCH_ALLOC_FLOW_TYPE_NOF
    126 } dnx_sch_alloc_flow_type_e;
    127 
    128 typedef enum
    129 {
    130     DNX_SCHEDULER_REGION_EVEN = 0,
    131     DNX_SCHEDULER_REGION_ODD,
    132     DNX_SCHEDULER_REGION_ODD_EVEN_MODE_NOF
    133 } dnx_scheduler_region_odd_even_mode_t;
    134 
    135 /* ENUMS
    136  * }
    137  */
    138 #define DNX_SCH_CL_WEIGHTS_NOF 4
    139 
    140 typedef struct
    141 {
    142     dbal_enum_value_field_cl_mode_e cl_mode;
    143     dbal_enum_value_field_wfq_weight_mode_e wfq_weight_mode;
    144     dbal_enum_value_field_cl_enhanced_mode_e enhanced_mode;
    145 } dnx_sch_cl_config_t;
    146 
    147 typedef struct
    148 {
    149     int weight[DNX_SCH_CL_WEIGHTS_NOF];
    150 } dnx_sch_cl_weight_t;
    151 
    152 typedef struct
    153 {
    154     dnx_sch_cl_config_t config;
    155     dnx_sch_cl_weight_t weight;
    156 } dnx_sch_cl_info_t;
    157 
    158 /*
    159  * API:
    160  * {
    161  */
    162 
    163 /**
    164  * \brief - 
    165  * E2E scheduler port add handling
    166  * Allocate HR, E2E interface allocate
    167  *  
    168  * \param [in] unit -  Unit-ID 
    169  * \return
    170  *   See shr_error_e 
    171  * \remark
    172  *   * None
    173  * \see
    174  *   * bcm_fabric_rci_biasing_probability_info_t
    175  */
    176 shr_error_e dnx_sch_port_add_handle(
    177     int unit);
    178 
    179 /**
    180  * \brief - 
    181  * E2E scheduler port remove handling, 
    182  * deallocate HR and E2E interface deallocate
    183  *  
    184  * \param [in] unit -  Unit-ID 
    185  *  
    186  * \return
    187  *   See shr_error_e 
    188  * \remark
    189  *   * None
    190  */
    191 shr_error_e dnx_sch_port_remove_handle(
    192     int unit);
    193 
    194 /**
    195  * \brief - 
    196  * add scheduler only part to a port
    197  *  
    198  * \param [in] unit -  Unit-ID 
    199  * \param [in] port - port ID
    200  *  
    201  * \return
    202  *   See shr_error_e 
    203  * \remark
    204  *   * None
    205  */
    206 shr_error_e dnx_sch_port_add_sch(
    207     int unit,
    208     bcm_port_t port);
    209 
    210 /**
    211  * \brief - 
    212  * remove scheduler only part from a port
    213  * deallocate HR and E2E interface deallocate
    214  *  
    215  * \param [in] unit -  Unit-ID 
    216  * \param [in] port - port ID
    217  *  
    218  * \return
    219  *   See shr_error_e 
    220  * \remark
    221  *   * None
    222  */
    223 shr_error_e dnx_sch_port_remove_sch(
    224     int unit,
    225     bcm_port_t port);
    226 
    227 /**
    228  * \brief - 
    229  * init E2E scheduler module
    230  *  
    231  * \param [in] unit -  Unit-ID 
    232  * \return
    233  *   See shr_error_e 
    234  * \remark
    235  *   * None
    236  */
    237 shr_error_e dnx_sch_init(
    238     int unit);
    239 
    240 /**
    241  * \brief - 
    242  * deinit E2E scheduler module
    243  *  
    244  * \param [in] unit -  Unit-ID 
    245  * \return
    246  *   See shr_error_e 
    247  * \remark
    248  *   * None
    249  */
    250 shr_error_e dnx_sch_deinit(
    251     int unit);
    252 
    253 /**
    254  * \brief
    255  *   Print CL class template data
    256  * \par DIRECT INPUT
    257  *   \param [in] unit - unit ID
    258  *   \param [in] data - template data
    259  * \par INDIRECT INPUT
    260  * \par DIRECT OUTPUT
    261  *   None
    262  * \par INDIRECT OUTPUT
    263  * \see
    264  *   * None
    265  */
    266 void dnx_sch_cl_class_print_cb(
    267     int unit,
    268     const void *data);
    269 
    270 /**
    271  * \brief - 
    272  * colors port's HRs according to default coloring algorith
    273  *  
    274  * \param [in] unit -  Unit-ID 
    275  * \param [in] port - Port ID
    276  *  
    277  * \return
    278  *   See shr_error_e 
    279  * \remark
    280  *   * None
    281  */
    282 shr_error_e dnx_sch_port_interface_ports_color(
    283     int unit,
    284     bcm_port_t port);
    285 
    286 /**
    287  * \brief - Get a bitmap of allocated HRs in a specified PS
    288  */
    289 shr_error_e dnx_sch_allocated_hrs_get(
    290     int unit,
    291     bcm_core_t core,
    292     int ps,
    293     uint32 *allocated_hrs,
    294     int *priority,
    295     int *priority_propagation_enable);
    296 
    297 /**
    298  * \brief - allocate port HR
    299  * 
    300  * \param [in] unit -  Unit-ID 
    301  * \param [in] core - core ID
    302  * \param [in] port_info - basic port info
    303  * \param [in] nof_priorities - number of scheduler priorities
    304  * \param [in] priority_propagation_enable - priority propagation enable
    305  * \param [in] with_id - should allocate WITH ID
    306  * \param [out] hr_id - allocated HR ID
    307  *  
    308  * \return
    309  *   See shr_error_e 
    310  * \remark
    311  *   * None
    312  */
    313 shr_error_e dnx_scheduler_port_hr_allocate(
    314     int unit,
    315     bcm_core_t core,
    316     dnx_algo_port_info_s port_info,
    317     int nof_priorities,
    318     int priority_propagation_enable,
    319     int with_id,
    320     int *hr_id);
    321 
    322 /**
    323  * \brief - Get a nof_remote_cores from provided voq_connector 
    324  *        gport
    325  */
    326 shr_error_e dnx_sch_voq_connector_nof_remote_cores_get(
    327     int unit,
    328     bcm_core_t core,
    329     int voq_connector_id,
    330     int *nof_remote_cores);
    331 
    332 /**
    333  * \brief Get scheduler element type from flow id.
    334  *
    335  * \param [in] unit -  Unit-ID 
    336  * \param [in] core_id - core ID
    337  * \param [in] flow_id - flow ID
    338  * \param [out] se_type - element type
    339  *  
    340  * \return
    341  *   See shr_error_e 
    342  * \remark
    343  *   * None
    344  */
    345 shr_error_e dnx_sch_flow_se_type_get(
    346     int unit,
    347     int core_id,
    348     int flow_id,
    349     dnx_sch_element_se_type_e * se_type);
    350 
    351 /**
    352  * \brief Get flow id and core from gport
    353  *
    354  * \param [in] unit -  Unit-ID 
    355  * \param [in] gport - input gport
    356  * \param [in] cosq - the index inside the bundle for VOQ connectors
    357  * \param [out] core - core ID
    358  * \param [out] flow_id - flow ID
    359  *  
    360  * \return
    361  *   See shr_error_e 
    362  * \remark
    363  *   * None
    364  */
    365 /**
    366  * \brief - obtain flow id from gport and cosq
    367  */
    368 shr_error_e dnx_scheduler_gport_core_flow_id_get(
    369     int unit,
    370     bcm_gport_t gport,
    371     bcm_cos_queue_t cosq,
    372     int *core,
    373     int *flow_id);
    374 
    375 /**
    376  * \brief - is the flow allocated
    377  */
    378 shr_error_e dnx_scheduler_flow_is_allocated(
    379     int unit,
    380     int core,
    381     int flow_id,
    382     int *is_allocated);
    383 
    384 /**
    385  * \brief - convert  SE ID to port+TC
    386  */
    387 int dnx_sch_convert_se_id_to_port_tc(
    388     int unit,
    389     int core,
    390     int se_id,
    391     bcm_port_t * logical_port,
    392     int *tc);
    393 
    394 /**
    395  * \brief - Function to set flow to be tracked when counting 
    396  *        credit count
    397  */
    398 shr_error_e dnx_sch_flow_credit_counter_configuration_set(
    399     int unit,
    400     int core,
    401     int flow_id);
    402 
    403 /**
    404  *
    405  * \brief - Function to disable the filters applied on the credit counters per flow
    406  *
    407  * \author db889754 (2/20/2018)
    408  *
    409  * \param unit [in]- unit
    410  * \param core [in]- core
    411  *
    412  * \return shr_error_e
    413  */
    414 shr_error_e dnx_sch_flow_credit_counter_configuration_reset(
    415     int unit,
    416     int core);
    417 
    418 /**
    419  * \brief - Function to return the credit count of the flow 
    420  *        configured by this function -
    421  *        dnx_sch_flow_credit_counter_configuration_set
    422  */
    423 shr_error_e dnx_sch_flow_credit_counter_info_get(
    424     int unit,
    425     int core_id,
    426     uint32 *credit_count);
    427 
    428 /**
    429  * \brief - Function to set port to be tracked when counting 
    430  *        credit count
    431  */
    432 shr_error_e dnx_sch_port_credit_counter_configuration_set(
    433     int unit,
    434     int core,
    435     int port);
    436 
    437 /**
    438  *
    439  * \brief - Function to disable the filters applied on the credit counters per port
    440  *
    441  * \param unit [in]- unit
    442  * \param core [in]- core
    443  *
    444  * \return shr_error_e
    445  */
    446 shr_error_e dnx_sch_port_credit_counter_configuration_reset(
    447     int unit,
    448     int core);
    449 
    450 /**
    451  * \brief - Function to return the credit count of the port 
    452  *        configured by this function -
    453  *        dnx_sch_port_credit_counter_configuration_set
    454  */
    455 shr_error_e dnx_sch_port_credit_counter_info_get(
    456     int unit,
    457     int core_id,
    458     uint32 *credit_count);
    459 
    460 /**
    461  * \brief - Function to set port to be tracked when counting 
    462  *        flow control indications count
    463  */
    464 shr_error_e dnx_sch_port_fc_counter_configuration_set(
    465     int unit,
    466     int core,
    467     int port);
    468 
    469 /**
    470  * \brief - Function to return the fc indications count of the 
    471  *        port configured by this function -
    472  *        dnx_sch_port_fc_counter_configuration_set
    473  */
    474 shr_error_e dnx_sch_port_fc_counter_info_get(
    475     int unit,
    476     int core_id,
    477     uint32 *fc_count);
    478 
    479 /**
    480  *  
    481  * \brief Function to retrieve the slow status of a given flow 
    482  *  
    483  * @param unit [in] - unit 
    484  * @param core_id [in] - core_id
    485  * @param flow_id [in] - flow_id
    486  * @param slow_status [out] - 2 bit value: 
    487  * 0 - OFF 
    488  * 1 - ON-SLOW 
    489  * 2 - ON-NORMAL 
    490  *  MAX returned value is restricted to 2!
    491  * @return shr_error_e 
    492  */
    493 shr_error_e dnx_sch_flow_slow_status_get(
    494     int unit,
    495     int core_id,
    496     int flow_id,
    497     dbal_enum_value_field_flow_slow_status_e * slow_status);
    498 
    499 /**
    500  * \brief - convert flow ID to SE ID
    501  */
    502 shr_error_e dnx_sch_convert_flow_to_se_id(
    503     int unit,
    504     int flow_id,
    505     int *se_id);
    506 
    507 /*
    508  * \brief - convert SE ID to flow ID
    509  */
    510 shr_error_e dnx_sch_convert_se_to_flow_id(
    511     int unit,
    512     int se_id,
    513     int *flow_id);
    514 
    515 /**
    516  * \brief - 
    517  * allocate HRs for advanced FMQ mode
    518  *  
    519  * \param [in] unit -  Unit-ID 
    520  * \param [in] core -  core-ID 
    521  * \param [in] hr_nof - number of required HRs 
    522  * \param [out] hr_id - array of allocated HR IDs
    523  * \return
    524  *   See shr_error_e 
    525  * \remark
    526  *   * None
    527  */
    528 int dnx_scheduler_fmq_hr_allocate(
    529     int unit,
    530     bcm_core_t core,
    531     int hr_nof,
    532     uint32 *hr_id);
    533 
    534 /**
    535  * \brief - 
    536  * deallocate advanced FMQ mode HRs 
    537  * 
    538  * called when switching to simple FMQ mode
    539  *  
    540  * \param [in] unit -  Unit-ID 
    541  * \param [in] core -  core-ID 
    542  * \param [in] hr_nof - number of required HRs 
    543  * \param [in] hr_id - array of HR IDs
    544  * \return
    545  *   See shr_error_e 
    546  * \remark
    547  *   * None
    548  */
    549 int dnx_scheduler_fmq_hr_deallocate(
    550     int unit,
    551     bcm_core_t core,
    552     int hr_nof,
    553     uint32 *hr_id);
    554 /**
    555  * \brief -
    556  * configure rci_biasing_mode to HW
    557  *
    558  * \param [in] unit -  Unit-ID 
    559  * \param [in] rci_biasing_mode - rci biasing mode
    560  * \return
    561  *   See shr_error_e 
    562  * \remark
    563  *   * None
    564  */
    565 shr_error_e dnx_sch_rci_throttling_mode_hw_set(
    566     int unit,
    567     dbal_enum_value_field_rci_biasing_mode_e rci_biasing_mode);
    568 
    569 /**
    570  * \brief -
    571  * read rci_biasing_mode from HW
    572  *
    573  * \param [in] unit -  Unit-ID 
    574  * \param [out] rci_biasing_mode - rci biasing mode
    575  * \return
    576  *   See shr_error_e 
    577  * \remark
    578  *   * None
    579  */
    580 shr_error_e dnx_sch_rci_throttling_mode_hw_get(
    581     int unit,
    582     dbal_enum_value_field_rci_biasing_mode_e * rci_biasing_mode);
    583 
    584 /**
    585  * \brief - Get FMQ Class from FMQ HR gport
    586  *
    587  * \param [in] unit - Unit ID
    588  * \param [in] fmq_hr_gport - fmq_hr_gport
    589  * \param [out] fmq_class - fmq_class
    590  *
    591  * \return
    592  *   shr_error_e
    593  *
    594  * \remark
    595  *   * None
    596  * \see
    597  *   * None
    598  */
    599 shr_error_e dnx_scheduler_fmq_hr_gport_fmq_class_get(
    600     int unit,
    601     bcm_gport_t fmq_hr_gport,
    602     int *fmq_class);
    603 
    604 /**
    605  * \brief - returns flow_id of connector num. cos
    606  * in case of composite connector, returns flow_id of the second subflow as well
    607  */
    608 shr_error_e dnx_scheduler_connector_flow_id_calc(
    609     int unit,
    610     int core,
    611     int base_flow_id,
    612     int cos,
    613     int is_non_contiguous,
    614     int is_composite,
    615     int called_by_voq_remove,
    616     int flow[2],
    617     int *nof_subflows);
    618 
    619 /**
    620  * \brief - Set mode and weight of attaching a flow to its parent
    621  */
    622 shr_error_e dnx_scheduler_gport_e2e_sched_set(
    623     int unit,
    624     bcm_gport_t gport,
    625     bcm_cos_queue_t cosq,
    626     int mode,
    627     int weight);
    628 
    629 /**
    630  * \brief - Get mode and weight of attaching a flow to its parent
    631  */
    632 shr_error_e dnx_scheduler_gport_e2e_sched_get(
    633     int unit,
    634     bcm_gport_t gport,
    635     bcm_cos_queue_t cosq,
    636     int *mode,
    637     int *weight);
    638 
    639 /**
    640  * \brief - cosq control set on flow gport
    641  */
    642 int dnx_scheduler_cosq_control_flow_set(
    643     int unit,
    644     bcm_gport_t port,
    645     bcm_cos_queue_t cosq,
    646     bcm_cosq_control_t type,
    647     int arg);
    648 
    649 /**
    650  * \brief - cosq control get on flow gport
    651  */
    652 int dnx_scheduler_cosq_control_flow_get(
    653     int unit,
    654     bcm_gport_t port,
    655     bcm_cos_queue_t cosq,
    656     bcm_cosq_control_t type,
    657     int *arg);
    658 
    659 /**
    660  * \brief - get bandwidth of a flow
    661  */
    662 shr_error_e dnx_scheduler_gport_flow_bandwidth_get(
    663     int unit,
    664     bcm_gport_t gport,
    665     bcm_cos_queue_t cosq,
    666     uint32 *kbits_sec_min,
    667     uint32 *kbits_sec_max,
    668     uint32 *flags);
    669 
    670 /**
    671  * \brief - configure bandwidth of a flow
    672  */
    673 shr_error_e dnx_scheduler_gport_flow_bandwidth_set(
    674     int unit,
    675     bcm_gport_t gport,
    676     bcm_cos_queue_t cosq,
    677     uint32 kbits_sec_min,
    678     uint32 kbits_sec_max,
    679     uint32 flags);
    680 
    681 /* 
    682  *  \brief -
    683  * Attach given port priority (TC) to Port TCG
    684  */
    685 int dnx_scheduler_gport_e2e_port_tc_sched_set(
    686     int unit,
    687     bcm_gport_t gport,
    688     bcm_cos_queue_t cosq,
    689     int mode,
    690     int weight);
    691 
    692 /** 
    693  * \brief -
    694  * Get Port TCG of a given port priority (TC).
    695  */
    696 int dnx_scheduler_gport_e2e_port_tc_sched_get(
    697     int unit,
    698     bcm_gport_t gport,
    699     bcm_cos_queue_t cosq,
    700     int *mode,
    701     int *weight);
    702 
    703 /** 
    704  * \brief -
    705  * Set EIR Weight for E2E Port TCG
    706  */
    707 int dnx_scheduler_gport_e2e_port_tcg_sched_set(
    708     int unit,
    709     bcm_gport_t gport,
    710     bcm_cos_queue_t cosq,
    711     int mode,
    712     int weight);
    713 
    714 /** 
    715  * \brief -
    716  * Get EIR Weight for E2E Port TCG
    717  */
    718 int dnx_scheduler_gport_e2e_port_tcg_sched_get(
    719     int unit,
    720     bcm_gport_t gport,
    721     bcm_cos_queue_t cosq,
    722     int *mode,
    723     int *weight);
    724 
    725 /** 
    726  * \brief -
    727  * Configure Port-TC (HR) shaping rate, set single port rate.
    728  */
    729 int dnx_scheduler_gport_e2e_port_tc_bandwidth_set(
    730     int unit,
    731     bcm_gport_t gport,
    732     bcm_cos_queue_t cosq,
    733     uint32 kbits_sec_min,
    734     uint32 kbits_sec_max,
    735     uint32 flags);
    736 
    737 /** 
    738  * \brief -
    739  * Get Port-TC (HR) shaping rate
    740  */
    741 int dnx_scheduler_gport_e2e_port_tc_bandwidth_get(
    742     int unit,
    743     bcm_gport_t gport,
    744     bcm_cos_queue_t cosq,
    745     uint32 *kbits_sec_min,
    746     uint32 *kbits_sec_max,
    747     uint32 *flags);
    748 
    749 /** 
    750  * \brief -
    751  * Configure TCG shaping rate - E2E
    752  */
    753 int dnx_scheduler_gport_e2e_port_tcg_bandwidth_set(
    754     int unit,
    755     bcm_gport_t gport,
    756     bcm_cos_queue_t cosq,
    757     uint32 kbits_sec_min,
    758     uint32 kbits_sec_max,
    759     uint32 flags);
    760 
    761 /** 
    762  * \brief -
    763  * Get E2E Port-TCG shapring rate
    764  */
    765 int dnx_scheduler_gport_e2e_port_tcg_bandwidth_get(
    766     int unit,
    767     bcm_gport_t gport,
    768     bcm_cos_queue_t cosq,
    769     uint32 *kbits_sec_min,
    770     uint32 *kbits_sec_max,
    771     uint32 *flags);
    772 
    773 /**
    774  * \brief -
    775  * Set various feature dependent control type
    776  * for the e2e port tc scheduler 
    777  */
    778 int dnx_scheduler_control_e2e_port_tc_set(
    779     int unit,
    780     bcm_gport_t port,
    781     bcm_cos_queue_t cosq,
    782     bcm_cosq_control_t type,
    783     int arg);
    784 
    785 /**
    786  * \brief -
    787  * Get various feature dependent control type
    788  * for the e2e port tc
    789  */
    790 int dnx_scheduler_control_e2e_port_tc_get(
    791     int unit,
    792     bcm_gport_t port,
    793     bcm_cos_queue_t cosq,
    794     bcm_cosq_control_t type,
    795     int *arg);
    796 
    797 /**
    798  * \brief -
    799  * Set various feature dependent control type
    800  * for the e2e port tcg scheduler 
    801  */
    802 int dnx_scheduler_control_e2e_port_tcg_set(
    803     int unit,
    804     bcm_gport_t port,
    805     bcm_cos_queue_t cosq,
    806     bcm_cosq_control_t type,
    807     int arg);
    808 
    809 /** 
    810  * \brief -
    811  * Get various feature dependent control type
    812  * for the e2e port tcg
    813  */
    814 int dnx_scheduler_control_e2e_port_tcg_get(
    815     int unit,
    816     bcm_gport_t port,
    817     bcm_cos_queue_t cosq,
    818     bcm_cosq_control_t type,
    819     int *arg);
    820 
    821 /**
    822  * \brief -
    823  * Set various feature dependent control type
    824  * for the e2e port
    825  */
    826 int dnx_scheduler_cosq_control_e2e_set(
    827     int unit,
    828     bcm_gport_t port,
    829     bcm_cos_queue_t cosq,
    830     bcm_cosq_control_t type,
    831     int arg);
    832 
    833 /**
    834  * \brief -
    835  * Get various feature dependent control type
    836  * for the e2e port
    837  */
    838 int dnx_scheduler_cosq_control_e2e_get(
    839     int unit,
    840     bcm_gport_t port,
    841     bcm_cos_queue_t cosq,
    842     bcm_cosq_control_t type,
    843     int *arg);
    844 
    845 /** 
    846  * \brief -
    847  * Configure E2E port bandwidth
    848  */
    849 int dnx_scheduler_gport_e2e_port_bandwidth_set(
    850     int unit,
    851     bcm_gport_t gport,
    852     bcm_cos_queue_t cosq,
    853     uint32 kbits_sec_min,
    854     uint32 kbits_sec_max,
    855     uint32 flags);
    856 
    857 /** 
    858  * \brief -
    859  * Get E2E port bandwidth
    860  */
    861 int dnx_scheduler_gport_e2e_port_bandwidth_get(
    862     int unit,
    863     bcm_gport_t gport,
    864     bcm_cos_queue_t cosq,
    865     uint32 *kbits_sec_min,
    866     uint32 *kbits_sec_max,
    867     uint32 *flags);
    868 
    869 /** 
    870  * \brief -
    871  * Configure E2E interface bandwidth
    872  */
    873 int dnx_scheduler_gport_e2e_interface_bandwidth_set(
    874     int unit,
    875     bcm_gport_t gport,
    876     bcm_cos_queue_t cosq,
    877     uint32 kbits_sec_min,
    878     uint32 kbits_sec_max,
    879     uint32 flags);
    880 
    881 /** 
    882  * \brief -
    883  * Get E2E interface bandwidth
    884  */
    885 int dnx_scheduler_gport_e2e_interface_bandwidth_get(
    886     int unit,
    887     bcm_gport_t gport,
    888     bcm_cos_queue_t cosq,
    889     uint32 *kbits_sec_min,
    890     uint32 *kbits_sec_max,
    891     uint32 *flags);
    892 
    893 /**
    894  * \brief - Has the region connectors
    895  */
    896 shr_error_e dnx_scheduler_region_has_connector(
    897     int unit,
    898     int core,
    899     int region_index,
    900     int *has_connector);
    901 
    902 /**
    903  * \brief - Is the region interdigitated
    904  */
    905 shr_error_e dnx_scheduler_region_is_interdigitated_get(
    906     int unit,
    907     int core,
    908     int region_index,
    909     int *is_interdigitated);
    910 
    911 /**
    912  * \brief - Get shared shaper mode
    913  */
    914 shr_error_e dnx_sch_shared_shaper_mode_get(
    915     int unit,
    916     int core_id,
    917     int flow_id,
    918     dbal_enum_value_field_shared_shaper_mode_e * mode);
    919 
    920 /**
    921  * \brief returns true iff flow is SE
    922  */
    923 shr_error_e dnx_sch_flow_is_se_get(
    924     int unit,
    925     int core_id,
    926     int flow_id,
    927     int *is_se);
    928 
    929 /**
    930  * \brief -
    931  * returns TRUE iff flow_id is reserved element
    932  */
    933 shr_error_e dnx_scheduler_flow_is_reserved_element(
    934     int unit,
    935     int core,
    936     int flow_id,
    937     int *is_reserved);
    938 
    939 /**
    940  * \brief Obtain is_composite property of flow
    941  */
    942 shr_error_e dnx_sch_flow_is_composite_get(
    943     int unit,
    944     int core_id,
    945     int base_flow_id,
    946     int *is_composite);
    947 
    948 /**
    949  * \brief - Get region odd/even mode 
    950  */
    951 shr_error_e dnx_scheduler_region_odd_even_mode_get(
    952     int unit,
    953     int core,
    954     int region_index,
    955     dnx_scheduler_region_odd_even_mode_t * odd_even_mode);
    956 
    957 /**
    958  * \brief - get number of shared priorities for provided flow
    959  */
    960 shr_error_e dnx_scheduler_element_shared_shaper_nof_priorities_get(
    961     int unit,
    962     int core,
    963     int flow_id,
    964     int *nof_priorities);
    965 
    966 /**
    967  * \brief - get real scheduler gport
    968  * mainly used to replace FMQ gport by actual sched gport
    969  */
    970 shr_error_e dnx_scheduler_gport_actual_sched_gport_get(
    971     int unit,
    972     bcm_gport_t sched_gport,
    973     int allow_core_all,
    974     bcm_gport_t * actual_sched_gport);
    975 
    976 /**
    977  * \brief
    978  *   connect VOQ connector to remote VOQ (egress side)
    979  */
    980 int dnx_scheduler_connection_set(
    981     int unit,
    982     bcm_cosq_gport_connection_t * gport_connect);
    983 
    984 /**
    985  * \brief
    986  *   obtain remote VOQ connected to provided VOQ connector (egress side)
    987  */
    988 int dnx_scheduler_connection_get(
    989     int unit,
    990     bcm_cosq_gport_connection_t * gport_connect);
    991 
    992 /**
    993  * \brief -
    994  * Allocate and configure new scheduling element
    995  * legacy API implementation
    996  */
    997 int dnx_cosq_sched_gport_add(
    998     int unit,
    999     bcm_gport_t port,
   1000     int numq,
   1001     uint32 flags,
   1002     bcm_gport_t * gport);
   1003 
   1004 /**
   1005  * \brief - main function implementing bcm_cosq_voq_connector_gport_add API
   1006  */
   1007 shr_error_e dnx_scheduler_connector_gport_add(
   1008     int unit,
   1009     int core,
   1010     int src_modid,
   1011     uint32 nof_remote_cores,
   1012     bcm_gport_t port,
   1013     int numq,
   1014     uint32 flags,
   1015     bcm_gport_t * gport);
   1016 
   1017 /**
   1018  * \brief - main function implementing bcm_cosq_gport_delete for VOQ_CONNECTOR gport
   1019  */
   1020 shr_error_e dnx_scheduler_voq_connector_gport_delete(
   1021     int unit,
   1022     bcm_gport_t gport);
   1023 
   1024 /**
   1025  * \brief - delete scheduling element
   1026  */
   1027 int dnx_scheduler_element_gport_delete(
   1028     int unit,
   1029     bcm_gport_t gport);
   1030 
   1031 /**
   1032  * \brief - get information about VOQ connector gport
   1033  */
   1034 int dnx_scheduler_connector_gport_get(
   1035     int unit,
   1036     bcm_gport_t gport,
   1037     bcm_cosq_voq_connector_gport_t * config);
   1038 
   1039 /**
   1040  * \brief - get information about scheduler element gport
   1041  * in terms of legacy bcm_cosq_gport_add API
   1042  */
   1043 int dnx_sched_gport_get(
   1044     int unit,
   1045     bcm_gport_t gport,
   1046     bcm_gport_t * physical_port,
   1047     int *num_cos_levels,
   1048     uint32 *flags);
   1049 
   1050 /**
   1051  * \brief - configure mapping of qpair to HR
   1052  */
   1053 shr_error_e dnx_scheduler_internal_fc_map_set(
   1054     int unit,
   1055     bcm_cosq_fc_endpoint_t * source,
   1056     bcm_cosq_fc_endpoint_t * target);
   1057 
   1058 /**
   1059  * \brief - get mapping of qpair to HR
   1060  */
   1061 shr_error_e dnx_scheduler_internal_fc_map_get(
   1062     int unit,
   1063     bcm_cosq_fc_endpoint_t * source,
   1064     int target_max,
   1065     bcm_cosq_fc_endpoint_t * target,
   1066     int *target_count);
   1067 
   1068 shr_error_e dnx_scheduler_low_rate_factor_set(
   1069     int unit,
   1070     int factor);
   1071 
   1072 shr_error_e dnx_scheduler_low_rate_factor_get(
   1073     int unit,
   1074     int *factor);
   1075 
   1076 shr_error_e dnx_scheduler_low_rate_connector_range_set(
   1077     int unit,
   1078     bcm_gport_t gport,
   1079     uint32 flags,
   1080     bcm_cosq_range_t * range);
   1081 
   1082 shr_error_e dnx_scheduler_low_rate_connector_range_get(
   1083     int unit,
   1084     bcm_gport_t gport,
   1085     uint32 flags,
   1086     bcm_cosq_range_t * range);
   1087 
   1088 /**
   1089  * \brief -
   1090  * Set various feature dependent control type
   1091  * for the e2e interface
   1092  *
   1093  * \param [in] unit -  Unit-ID 
   1094  * \param [in] port -  E2E interface gport
   1095  * \param [in] cosq -  TC
   1096  * \param [in] type -  control type
   1097  * \param [in] arg  -  control value
   1098  *
   1099  * \return
   1100  *   See shr_error_e 
   1101  * \remark
   1102  *   * None
   1103  * \see
   1104  *   * none
   1105  */
   1106 int dnx_scheduler_cosq_control_e2e_interface_set(
   1107     int unit,
   1108     bcm_gport_t port,
   1109     bcm_cos_queue_t cosq,
   1110     bcm_cosq_control_t type,
   1111     int arg);
   1112 
   1113 /**
   1114  * \brief -
   1115  * Get various feature dependent control type
   1116  * for the e2e interface
   1117  *
   1118  * \param [in] unit -  Unit-ID 
   1119  * \param [in] port -  E2E interface gport
   1120  * \param [in] cosq -  TC
   1121  * \param [in] type -  control type
   1122  * \param [in] arg  -  control value
   1123  *
   1124  * \return
   1125  *   See shr_error_e 
   1126  * \remark
   1127  *   * None
   1128  * \see
   1129  *   * none
   1130  */
   1131 int dnx_scheduler_cosq_control_e2e_interface_get(
   1132     int unit,
   1133     bcm_gport_t port,
   1134     bcm_cos_queue_t cosq,
   1135     bcm_cosq_control_t type,
   1136     int *arg);
   1137 
   1138 /**
   1139  * \brief - get scheduler port for a given port
   1140  *
   1141  * \param [in] unit -  Unit-ID 
   1142  * \param [in] src_port - egress logical port
   1143  * \param [out] target_port - scheduler port attached to src_port
   1144  *
   1145  * \return
   1146  *   See shr_error_e 
   1147  * \remark
   1148  *   * None
   1149  * \see
   1150  *   * none
   1151  */
   1152 shr_error_e dnx_scheduler_port_scheduler_get(
   1153     int unit,
   1154     bcm_port_t src_port,
   1155     bcm_port_t * target_port);
   1156 
   1157 /**
   1158  * \brief - update number of tokens on reserved SE
   1159  *          to make sure no credits are issued to unattached flows
   1160  *          following soft reset
   1161  */
   1162 shr_error_e dnx_sch_reserve_se_update(
   1163     int unit);
   1164 
   1165 /**
   1166  * \ brief configure SMP message counter fabric type, id  and filter
   1167  */
   1168 
   1169 shr_error_e dnx_sch_fsm_counter_configuration_fabric_type_set(
   1170     int unit,
   1171     int core,
   1172     uint32 flow__id,
   1173     uint32 fabric_type,
   1174     uint32 filter_by_type,
   1175     uint32 filter_by_flow_id);
   1176 
   1177 /**
   1178  * \ brief get SMP message counter fabric type, id  and filter
   1179  */
   1180 shr_error_e dnx_sch_fsm_counter_configuration_fabric_type_get(
   1181     int unit,
   1182     int core,
   1183     uint32 *flow_id,
   1184     uint32 *fabric_type,
   1185     uint32 *filter_by_type,
   1186     uint32 *filter_by_flow_id);
   1187 
   1188 /**
   1189  * \ brief read SMP message counter
   1190  */
   1191 shr_error_e dnx_sch_fsm_counter_info_get(
   1192     int unit,
   1193     int core,
   1194     uint32 *count,
   1195     uint32 *overflow);
   1196 
   1197 #endif /*_DNX_SCHEDULER_H_INCLUDED_*/