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

tsn.h (23473B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        tsn.h
      8  * Purpose:     Definitions for TSN.
      9  */
     10 
     11 #ifndef _BCM_INT_TSN_H_
     12 #define _BCM_INT_TSN_H_
     13 
     14 #include <soc/defs.h>
     15 #include <bcm/tsn.h>
     16 
     17 #if defined(BCM_TSN_SUPPORT)
     18 
     19 #ifdef BCM_WARM_BOOT_SUPPORT
     20 #define BCM_TSN_WB_DEFAULT_VERSION            SOC_SCACHE_VERSION(1, 0)
     21 #define BCM_TSN_WB_SCACHE_PART_EGR_MTU                   (1)
     22 #define BCM_TSN_WB_SCACHE_PART_EGR_STU                   (2)
     23 #define BCM_TSN_WB_SCACHE_PART_TSN_STAT_PORTCNT          (3)
     24 #define BCM_TSN_WB_SCACHE_PART_TSN_STAT_FLOWCNT          (4)
     25 #define BCM_TSN_WB_SCACHE_PART_TSN_FLOWS                 (5)
     26 #define BCM_TSN_WB_SCACHE_PART_TAF                       (6)
     27 #if defined(BCM_TSN_SR_SUPPORT)
     28 #define BCM_TSN_WB_SCACHE_PART_AUTO_LEARN                (7)
     29 #define BCM_TSN_WB_SCACHE_PART_PRP_FORWARDING            (8)
     30 #define BCM_TSN_WB_SCACHE_PART_SR_FLOWS                  (9)
     31 #define BCM_TSN_WB_SCACHE_PART_MIN  (BCM_TSN_WB_SCACHE_PART_EGR_MTU)
     32 #define BCM_TSN_WB_SCACHE_PART_MAX  (BCM_TSN_WB_SCACHE_PART_SR_FLOWS)
     33 #else
     34 #define BCM_TSN_WB_SCACHE_PART_MIN  (BCM_TSN_WB_SCACHE_PART_EGR_MTU)
     35 #define BCM_TSN_WB_SCACHE_PART_MAX  (BCM_TSN_WB_SCACHE_PART_TAF)
     36 #endif /* BCM_TSN_SR_SUPPORT */
     37 #endif /* BCM_WARM_BOOT_SUPPORT */
     38 
     39 /*
     40  * Macro:
     41  *     TSN_ALLOC
     42  * Purpose:
     43  *      Generic memory allocation routine.
     44  * Parameters:
     45  *    _unit_    - Unit.
     46  *    _ptr_     - Pointer to allocated memory.
     47  *    _ptype_   - Pointer type.
     48  *    _size_    - Size of heap memory to be allocated.
     49  *    _descr_   - Information about this memory allocation.
     50  *    _dma_     - use sal_alloc or soc_cm_alloc.
     51  *    _rv_      - return value
     52  */
     53 #define TSN_ALLOC(_unit_, _ptr_, _ptype_, _size_, _descr_, _dma_, _rv_) \
     54             do { \
     55                 if (NULL == (_ptr_)) { \
     56                     if (0 == (_dma_)) { \
     57                         (_ptr_) = (_ptype_ *)sal_alloc((_size_), (_descr_)); \
     58                     } else { \
     59                         (_ptr_) = (_ptype_ *)soc_cm_salloc((_unit_), (_size_), \
     60                                                             (_descr_)); \
     61                     } \
     62                 } \
     63                 if ((_ptr_) != NULL) { \
     64                     sal_memset((_ptr_), 0, (_size_)); \
     65                     (_rv_) = BCM_E_NONE; \
     66                 } else { \
     67                     LOG_ERROR(BSL_LS_BCM_TSN, \
     68                               (BSL_META("TSN Error: Allocation failure %s\n"), \
     69                                (_descr_))); \
     70                     (_rv_) = BCM_E_MEMORY; \
     71                 } \
     72             } while (0)
     73 
     74 /*
     75  * Macro:
     76  *     TSN_FREE
     77  * Purpose:
     78  *      Generic memory free routine.
     79  * Parameters:
     80  *    _unit_    - Unit.
     81  *    _ptr_     - Memory pointer to be free
     82  *    _dma_     - use sal_free or soc_cm_free.
     83  */
     84 #define TSN_FREE(_unit_, _ptr_, _dma_) \
     85             do { \
     86                 if (0 == (_dma_)) { \
     87                     sal_free((_ptr_)); \
     88                 } else { \
     89                     soc_cm_sfree((_unit_), (_ptr_)); \
     90                 } \
     91             } while (0)
     92 
     93 #if defined(BCM_TSN_SR_SUPPORT)
     94 
     95 /*
     96  * SR MAC proxy management
     97  */
     98 extern int
     99 bcmi_esw_tsn_sr_mac_proxy_insert(
    100     int unit,
    101     bcm_pbmp_t mp_pbmp,
    102     int *mp_index);
    103 extern int
    104 bcmi_esw_tsn_sr_mac_proxy_delete(int unit, int mp_index);
    105 extern int
    106 bcmi_esw_tsn_sr_mac_proxy_get(int unit, int mp_index, bcm_pbmp_t *mp_pbmp);
    107 
    108 /* Per-chip SR MAC Proxy info */
    109 typedef struct tsn_sr_mac_proxy_info_s {
    110     const soc_mem_t mem;
    111     const soc_field_t field;
    112 } tsn_sr_mac_proxy_info_t;
    113 
    114 /*
    115  * SR flow ID conversion between software flow ID and hardware flow ID
    116  */
    117 extern int
    118 bcmi_esw_tsn_sr_hw_flow_id_get(
    119     int unit,
    120     bcm_tsn_sr_flow_t flow_id,
    121     uint32 *hw_id);
    122 extern int
    123 bcmi_esw_tsn_sr_sw_flow_id_get(
    124     int unit, uint32 hw_id,
    125     bcm_tsn_sr_flow_t *flow_id);
    126 
    127 /*
    128  * SR flowset reference count control (increase or decrease reference count)
    129  */
    130 extern int
    131 bcmi_esw_tsn_sr_flowset_ref_inc(int unit, bcm_tsn_sr_flowset_t flowset);
    132 extern int
    133 bcmi_esw_tsn_sr_flowset_ref_dec(int unit, bcm_tsn_sr_flowset_t flowset);
    134 
    135 /*
    136  * SR flow to flowset converstion (identify the flowset based on a flow)
    137  */
    138 extern int
    139 bcmi_esw_tsn_sr_flowset_identify(
    140     int unit,
    141     bcm_tsn_sr_flow_t flow_id,
    142     bcm_tsn_sr_flowset_t *flowset);
    143 
    144 /*
    145  * Handle to an SR sequence number history slice.
    146  * SN history pool management is something that requires full optimization
    147  * for minimal allocation time to reduce overall time taken for flow learning.
    148  * Since different chips may have different seqnum pool parameters (number of
    149  * pools, pool size, min alocation, etc.) and different parameters would
    150  * require fine-tuned algorithms, the implementation is chip-specific.
    151  * This is the handle provided by chip-specific algorithm as the seqnum slice
    152  * used for a flow.
    153  */
    154 typedef void *bcmi_tsn_sr_seqnum_slice_t;
    155 
    156 /*
    157  * SR RX flow internal configuration for writing by platform specific code.
    158  * The public config structure is wrapped here with additional internal
    159  * fields (for extension) required by the platform specific code.
    160  */
    161 typedef struct tsn_sr_rx_flow_s {
    162     bcmi_tsn_sr_seqnum_slice_t      sn_slice;
    163     bcm_tsn_sr_rx_flow_config_t     config;
    164 } bcmi_tsn_sr_rx_flow_t;
    165 
    166 /*
    167  * SR TX flow internal configuration for writing by platform specific code.
    168  * The public config structure is wrapped here with additional internal
    169  * fields (for extension) required by the platform specific code.
    170  */
    171 typedef struct tsn_sr_tx_flow_s {
    172     bcm_tsn_sr_tx_flow_config_t     config;
    173 } bcmi_tsn_sr_tx_flow_t;
    174 
    175 /*
    176  * SR flow management platform specific data
    177  */
    178 typedef struct bcmi_tsn_sr_flows_dev_info_s {
    179     /* Get number of RX/TX flows */
    180     int (*get_num_flows)(int unit, int *rx_flows, int *tx_flows);
    181     /* Get HW flow ID from flow index */
    182     int (*get_hw_flow_id)(int unit, int is_tx, int fidx, uint32 *hw_id);
    183     /* Get flow index from HW flow ID */
    184     int (*get_sw_flow_idx)(int unit, uint32 hw_id, int *is_tx, int *fidx);
    185     /* Check RX flow config (based on platform HW parameters) */
    186     int (*check_rx_flow_config)(int unit, bcm_tsn_sr_rx_flow_config_t *cfg);
    187     /* Check TX flow config (based on platform HW parameters) */
    188     int (*check_tx_flow_config)(int unit, bcm_tsn_sr_tx_flow_config_t *cfg);
    189     /* Clear RX flow config in HW */
    190     int (*clear_rx_flow)(int unit, int idx);
    191     /* Clear TX flow config in HW */
    192     int (*clear_tx_flow)(int unit, int idx);
    193     /* Write RX flow config to HW */
    194     int (*write_rx_flow)(int unit, int idx, bcmi_tsn_sr_rx_flow_t *config);
    195     /* Write TX flow config to HW */
    196     int (*write_tx_flow)(int unit, int idx, bcmi_tsn_sr_tx_flow_t *config);
    197 #ifdef BCM_WARM_BOOT_SUPPORT
    198     /* Read RX flow config from HW (for warm boot) */
    199     int (*read_rx_flow)(int unit, int idx, bcmi_tsn_sr_rx_flow_t *config);
    200     /* Read TX flow config from HW (for warm boot) */
    201     int (*read_tx_flow)(int unit, int idx, bcmi_tsn_sr_tx_flow_t *config);
    202 #endif /* BCM_WARM_BOOT_SUPPORT */
    203     /* Get RX flow status */
    204     int (*get_rx_flow_status)(
    205             int unit, int idx, bcm_tsn_sr_rx_flow_status_t *status);
    206     /* Get TX flow status */
    207     int (*get_tx_flow_status)(
    208             int unit, int idx, bcm_tsn_sr_tx_flow_status_t *status);
    209     /* Reset RX flow  */
    210     int (*reset_rx_flow)(int unit, int idx, uint32 flags);
    211     /* Allocate seqnum history (optimized algorithm) */
    212     int (*seqnum_slice_alloc)(
    213             int unit, int winsize, bcmi_tsn_sr_seqnum_slice_t *slice);
    214     /* Free seqnum history (optimized algorithm) */
    215     int (*seqnum_slice_free)(int unit, bcmi_tsn_sr_seqnum_slice_t slice);
    216     /* Read values from flow seqnum history window */
    217     int (*seqnum_hist_read)(
    218             int unit, int idx, int winsize, bcmi_tsn_sr_seqnum_slice_t slice,
    219             int offset, int max_size, uint8 *history, int *actual);
    220     /* Write values from flow seqnum history window */
    221     int (*seqnum_hist_write)(
    222             int unit, int idx, int winsize, bcmi_tsn_sr_seqnum_slice_t slice,
    223             int offset, int size, uint8 *history);
    224     /* Reset values in flow seqnum history window */
    225     int (*seqnum_hist_reset)(
    226             int unit, int idx, int winsize, bcmi_tsn_sr_seqnum_slice_t slice,
    227             uint32 reset_mode);
    228     /* Clear RX flow config - mtu in HW */
    229     int (*clear_rx_flow_mtu)(int unit, int idx);
    230     /* Clear TX flow config - mtu in HW */
    231     int (*clear_tx_flow_mtu)(int unit, int idx);
    232 } bcmi_tsn_sr_flows_dev_info_t;
    233 
    234 /* SR Port Configuration */
    235 typedef struct tsn_sr_port_dev_info_s {
    236 #ifdef BCM_WARM_BOOT_SUPPORT
    237     int (*sr_port_prp_forwarding_wb_sync)(int unit,
    238                                           soc_scache_handle_t scache_handle);
    239     int (*sr_port_prp_forwarding_wb_reload)(int unit,
    240                                             soc_scache_handle_t scache_handle);
    241 #endif /* BCM_WARM_BOOT_SUPPORT */
    242     int (*sr_port_config_set)(int, bcm_gport_t, bcm_tsn_sr_port_config_t *);
    243     int (*sr_port_config_get)(int, bcm_gport_t, bcm_tsn_sr_port_config_t *);
    244 } tsn_sr_port_dev_info_t;
    245 
    246 #endif /* BCM_TSN_SR_SUPPORT */
    247 
    248 /*
    249  * TSN flow ID conversion between software flow ID and hardware flow ID
    250  */
    251 extern int
    252 bcmi_esw_tsn_hw_flow_id_get(int unit, bcm_tsn_flow_t flow_id, uint32 *hw_id);
    253 extern int
    254 bcmi_esw_tsn_sw_flow_id_get(int unit, uint32 hw_id, bcm_tsn_flow_t *flow_id);
    255 
    256 /*
    257  * TSN flowset reference count control (increase or decrease reference count)
    258  */
    259 extern int
    260 bcmi_esw_tsn_flowset_ref_inc(int unit, bcm_tsn_flowset_t flowset);
    261 extern int
    262 bcmi_esw_tsn_flowset_ref_dec(int unit, bcm_tsn_flowset_t flowset);
    263 
    264 /*
    265  * TSN flow to flowset converstion (identify the flowset based on a flow)
    266  */
    267 extern int
    268 bcmi_esw_tsn_flowset_identify(
    269     int unit,
    270     bcm_tsn_flow_t flow_id,
    271     bcm_tsn_flowset_t *flowset);
    272 
    273 /*
    274  * TSN MTU reference count control (increase or decrease reference count)
    275  */
    276 extern int
    277 bcmi_esw_tsn_mtu_profile_ref_inc(
    278     int unit,
    279     int mtu_profile_id);
    280 extern int
    281 bcmi_esw_tsn_mtu_profile_ref_dec(
    282     int unit,
    283     int mtu_profile_id);
    284 
    285 /*
    286  * TSN STU reference count control (increase or decrease reference count)
    287  */
    288 extern int
    289 bcmi_esw_tsn_stu_profile_ref_inc(
    290     int unit,
    291     int stu_profile_id);
    292 extern int
    293 bcmi_esw_tsn_stu_profile_ref_dec(
    294     int unit,
    295     int stu_profile_id);
    296 
    297 /*
    298  * TSN MTU profile ID conversion between
    299  * software profile ID and hardware profile ID
    300  */
    301 extern int
    302 bcmi_esw_tsn_mtu_hw_profile_id_get(
    303     int unit,
    304     int mtu_profile_id,
    305     bcm_tsn_mtu_profile_type_t *type,
    306     int *hw_profile_id);
    307 extern int
    308 bcmi_esw_tsn_mtu_sw_profile_id_get(
    309     int unit,
    310     bcm_tsn_mtu_profile_type_t type,
    311     int hw_profile_id,
    312     int *mtu_profile_id);
    313 
    314 /*
    315  * TSN STU profile ID conversion between
    316  * software profile ID and hardware profile ID
    317  */
    318 extern int
    319 bcmi_esw_tsn_stu_hw_profile_id_get(
    320     int unit,
    321     int stu_profile_id,
    322     bcm_tsn_stu_profile_type_t *type,
    323     int *hw_profile_id);
    324 extern int
    325 bcmi_esw_tsn_stu_sw_profile_id_get(
    326     int unit,
    327     bcm_tsn_stu_profile_type_t type,
    328     int hw_profile_id,
    329     int *stu_profile_id);
    330 
    331 /*
    332  * TSN flow management platform specific data
    333  */
    334 typedef struct bcmi_tsn_flows_dev_info_s {
    335     /* Get number of TSN flows */
    336     int (*get_num_flows)(int unit, int *flows);
    337     /* Get HW flow ID from flow index */
    338     int (*get_hw_flow_id)(int unit, int fidx, uint32 *hw_id);
    339     /* Get flow index from HW flow ID */
    340     int (*get_sw_flow_idx)(int unit, uint32 hw_id, int *fidx);
    341     /* Check TSN flow config (based on platform HW parameters) */
    342     int (*check_flow_config)(int unit, bcm_tsn_flow_config_t *config);
    343     /* Write flow config to HW */
    344     int (*write_flow)(int unit, int idx, bcm_tsn_flow_config_t *config);
    345 #ifdef BCM_WARM_BOOT_SUPPORT
    346     /* Read flow config from HW (for warm boot) */
    347     int (*read_flow)(int unit, int idx, bcm_tsn_flow_config_t *config);
    348 #endif /* BCM_WARM_BOOT_SUPPORT */
    349     /* Clear flow config in HW */
    350     int (*clear_flow)(int unit, int idx);
    351     /* Clear flow config - mtu in HW */
    352     int (*clear_flow_mtu)(int unit, int idx);
    353 } bcmi_tsn_flows_dev_info_t;
    354 
    355 #if defined(BCM_TSN_SR_SUPPORT)
    356 
    357 /* SR Auto Learn Group ports type enumerations */
    358 typedef enum bcmi_tsn_sr_auto_learn_group_port_type_e {
    359     bcmi_sr_auto_learn_group_l2mc = 0, /* L2MC ports group */
    360     bcmi_sr_auto_learn_group_macp = 1, /* Mac Proxy ports group */
    361     bcmi_sr_auto_learn_group_count = 2 /* Must be the last */
    362 } bcmi_tsn_sr_auto_learn_group_port_type_t;
    363 
    364 /* SR Auto Learn TX/RX flow enumerations */
    365 typedef enum bcmi_tsn_sr_auto_learn_flow_e {
    366     bcmi_sr_auto_learn_flow_tx = 0, /* SR Tx flow */
    367     bcmi_sr_auto_learn_flow_rx = 1, /* SR Rx flow */
    368     bcmi_sr_auto_learn_flow_count = 2 /* Must be the last */
    369 } bcmi_tsn_sr_auto_learn_flow_t;
    370 
    371 /* per-chip SR Auto learn drivers */
    372 typedef struct tsn_sr_auto_learn_info_s {
    373     char *table_name;
    374     int (* table_size_get)(
    375         int unit,
    376         uint32 *table_size);
    377     uint32 max_flow_num[bcmi_sr_auto_learn_flow_count];
    378     int (*group_port_set)(
    379         int unit,
    380         bcmi_tsn_sr_auto_learn_group_port_type_t group_port_type,
    381         bcm_pbmp_t port_pbmp,
    382         int val);
    383     int (*group_port_delete)(
    384         int unit,
    385         bcmi_tsn_sr_auto_learn_group_port_type_t group_port_type,
    386         bcm_pbmp_t port_pbmp);
    387     int (*group_port_reset_all)(
    388         int unit);
    389     int (*flow_id_ctrl_set)(
    390         int unit,
    391         bcmi_tsn_sr_auto_learn_flow_t flow_type,
    392         uint32 current_fid,
    393         uint32 last_fid,
    394         uint32 id_size);
    395     int (*flow_id_ctrl_get)(
    396         int unit,
    397         bcmi_tsn_sr_auto_learn_flow_t flow_type,
    398         uint32 *current,
    399         uint32 *last,
    400         uint32 *id_size);
    401     int (*flow_id_pool_set)(
    402         int unit,
    403         bcmi_tsn_sr_auto_learn_flow_t flow_type,
    404         uint32 prev,
    405         uint32 fid);
    406     int (*flow_id_pool_get)(
    407         int unit,
    408         bcmi_tsn_sr_auto_learn_flow_t flow_type,
    409         uint32 prev,
    410         uint32 *fid);
    411     int (*enable)(
    412         int unit,
    413         int enable);
    414     int (*enable_get)(
    415         int unit,
    416         int *enabled);
    417 } tsn_sr_auto_learn_info_t;
    418 #endif /* BCM_TSN_SR_SUPPORT */
    419 
    420 /*
    421  * TSN event management platform specific data
    422  */
    423  typedef enum bcmi_tsn_evt_inst_type_e {
    424     bcmiTsnEvtCESys = 0,
    425     bcmiTsnEvtCEFlow = 1,
    426     bcmiTsnEvtCEPort = 2,
    427     bcmiTsnEvtWLASys = 3,
    428     bcmiTsnEvtWLAFlow = 4,
    429     bcmiTsnEvtWLBSys = 5,
    430     bcmiTsnEvtWLBFlow = 6,
    431     bcmiTsnEvtSNSys = 7,
    432     bcmiTsnEvtSNFlow = 8,
    433     bcmiTsnEvtCount = 9
    434 } bcmi_tsn_evt_inst_type_t;
    435 
    436 typedef int (*bcmi_esw_tsn_flow_event_notify_cb)(
    437     int unit,
    438     bcm_tsn_event_type_t type,
    439     int multiple,
    440     int hw_flow_id);
    441 
    442 typedef int (*bcmi_esw_tsn_cnt_exceed_notify_cb)(
    443     int unit,
    444     bcm_tsn_stat_t stat_type,
    445     bcm_tsn_stat_threshold_source_t th_src,
    446     int multiple,
    447     int index); /* port_id or hw_flow_id */
    448 
    449 typedef struct bcmi_tsn_events_dev_info_s {
    450     /* Register the event notify callback */
    451     int (*register_flow_event_cb)(int unit,
    452                                   bcmi_esw_tsn_flow_event_notify_cb cb);
    453     int (*register_cnt_exceed_cb)(int unit,
    454                                   bcmi_esw_tsn_cnt_exceed_notify_cb cb);
    455     /* event validate */
    456     int (*validate_event)(int unit, bcmi_tsn_evt_inst_type_t inst_type);
    457     /* Enable/disable event mask */
    458     int (*event_mask_set)(int unit, bcm_tsn_event_type_t event, uint32 enable);
    459     /* Update rx flow information associate with event type */
    460     int (*update_rx_flow)(int unit, int type, int idx,
    461                           int val);
    462     /* Get the flow event state */
    463     int (*event_flow_stat_get)(int unit, bcm_tsn_event_type_t event,
    464                                SHR_BITDCL *flowstate,
    465                                SHR_BITDCL *filterflowstate,
    466                                uint32 flow_number);
    467     /* Clear the flow event state */
    468     int (*event_flow_stat_clear)(int unit, bcm_tsn_event_type_t event,
    469                                  SHR_BITDCL *flowstate, uint32 flow_number);
    470     /* Poll function invoked periodically */
    471     int (*poll)(int unit);
    472 } bcmi_tsn_events_dev_info_t;
    473 
    474 /* per-chip control drivers */
    475 typedef struct tsn_chip_ctrl_info_s {
    476     int (*tsn_chip_ctrl_set)(int, bcm_tsn_control_t, uint32);
    477     int (*tsn_chip_ctrl_get)(int, bcm_tsn_control_t, uint32 *);
    478 } tsn_chip_ctrl_info_t;
    479 
    480 /* per-chip Priority Map drivers */
    481 typedef struct tsn_pri_map_info_s {
    482     char *table_name;
    483     uint32 table_size;
    484     uint32 entry_size;
    485     int (*tsn_pri_map_set)(
    486         int unit,
    487         uint32 sw_idx,
    488         bcm_tsn_pri_map_config_t *config);
    489     int (*tsn_pri_map_get)(
    490         int unit,
    491         uint32 sw_idx,
    492         bcm_tsn_pri_map_config_t *config);
    493     int (*tsn_pri_map_delete)(
    494         int unit,
    495         uint32 sw_idx);
    496     int (*tsn_pri_map_hw_index_get)(
    497         int unit,
    498         uint32 sw_idx,
    499         uint32 *hw_index);
    500     int (*tsn_pri_map_sw_idx_get)(
    501         int unit,
    502         uint32 hw_index,
    503         uint32 *sw_idx);
    504     int (*tsn_pri_map_wb_hw_existed)(
    505         int unit,
    506         uint32 sw_idx);
    507 } tsn_pri_map_info_t;
    508 
    509 typedef struct tsn_mtu_info_s {
    510 #ifdef BCM_WARM_BOOT_SUPPORT
    511     int (*egress_mtu_wb_reload)(
    512         int unit,
    513         int idx,
    514         bcm_tsn_pri_map_config_t *config);
    515 #endif /* BCM_WARM_BOOT_SUPPORT */
    516     const uint32 logical_port_num;
    517     int (*mtu_profile_mem_idx_get)(
    518         int unit,
    519         bcm_tsn_mtu_profile_type_t type,
    520         int *min,
    521         int *max);
    522     int (*mtu_profile_create)(
    523         int unit,
    524         bcm_tsn_mtu_profile_type_t type,
    525         bcm_tsn_mtu_config_t *config,
    526         uint32 *index);
    527     int (*mtu_profile_set)(
    528         int unit,
    529         int index,
    530         bcm_tsn_mtu_profile_type_t type,
    531         bcm_tsn_mtu_config_t *config);
    532     int (*mtu_profile_get)(
    533         int unit,
    534         int index,
    535         bcm_tsn_mtu_profile_type_t type,
    536         bcm_tsn_mtu_config_t *config);
    537     int (*mtu_profile_destroy)(
    538         int unit,
    539         bcm_tsn_mtu_profile_type_t type,
    540         int index);
    541     int (*ingress_mtu_config_set)(
    542         int unit,
    543         bcm_tsn_ingress_mtu_config_t *config);
    544     int (*ingress_mtu_config_get)(
    545         int unit,
    546         bcm_tsn_ingress_mtu_config_t *config);
    547     int (*egress_mtu_port_control_set)(
    548         int unit,
    549         bcm_gport_t port,
    550         bcm_tsn_pri_map_config_t *config);
    551     int (*mtu_profile_decode)(
    552         int unit,
    553         int mtu_profile_id,
    554         bcm_tsn_mtu_profile_type_t *type,
    555         int *index);
    556     int (*mtu_profile_encode)(
    557         int unit,
    558         int index,
    559         bcm_tsn_mtu_profile_type_t type,
    560         int *mtu_profile_id);
    561     int (*mtu_profile_traverse)(
    562         int unit,
    563         bcm_tsn_mtu_profile_traverse_cb cb,
    564         void *user_data);
    565     int (*mtu_profile_mem_refcnt_get)(
    566         int unit,
    567         bcm_tsn_mtu_profile_type_t type,
    568         int index,
    569         int *ref_count);
    570     int (*ingress_mtu_port_control_set)(
    571         int unit,
    572         bcm_gport_t port,
    573         int index);
    574     int (*ingress_mtu_port_control_get)(
    575         int unit,
    576         bcm_gport_t port,
    577         int *index);
    578 } tsn_mtu_info_t;
    579 
    580 typedef struct tsn_stu_info_s {
    581 #ifdef BCM_WARM_BOOT_SUPPORT
    582     int (*egress_stu_wb_reload)(
    583         int unit,
    584         int idx,
    585         bcm_tsn_pri_map_config_t *config);
    586 #endif /* BCM_WARM_BOOT_SUPPORT */
    587     const uint32 logical_port_num;
    588     int (*stu_profile_mem_idx_get)(
    589         int unit,
    590         bcm_tsn_stu_profile_type_t type,
    591         int *min,
    592         int *max);
    593     int (*stu_profile_create)(
    594         int unit,
    595         bcm_tsn_stu_profile_type_t type,
    596         bcm_tsn_stu_config_t *config,
    597         uint32 *index);
    598     int (*stu_profile_set)(
    599         int unit,
    600         int index,
    601         bcm_tsn_stu_profile_type_t type,
    602         bcm_tsn_stu_config_t *config);
    603     int (*stu_profile_get)(
    604         int unit,
    605         int index,
    606         bcm_tsn_stu_profile_type_t type,
    607         bcm_tsn_stu_config_t *config);
    608     int (*stu_profile_destroy)(
    609         int unit,
    610         bcm_tsn_stu_profile_type_t type,
    611         int index);
    612     int (*ingress_stu_config_set)(
    613         int unit,
    614         bcm_tsn_ingress_stu_config_t *config);
    615     int (*ingress_stu_config_get)(
    616         int unit,
    617         bcm_tsn_ingress_stu_config_t *config);
    618     int (*egress_stu_port_control_set)(
    619         int unit,
    620         bcm_gport_t port,
    621         bcm_tsn_pri_map_config_t *config);
    622     int (*stu_profile_decode)(
    623         int unit,
    624         int stu_profile_id,
    625         bcm_tsn_stu_profile_type_t *type,
    626         int *index);
    627     int (*stu_profile_encode)(
    628         int unit,
    629         int index,
    630         bcm_tsn_stu_profile_type_t type,
    631         int *stu_profile_id);
    632     int (*stu_profile_traverse)(
    633         int unit,
    634         bcm_tsn_stu_profile_traverse_cb cb,
    635         void *user_data);
    636     int (*stu_profile_mem_refcnt_get)(
    637         int unit,
    638         bcm_tsn_stu_profile_type_t type,
    639         int index,
    640         int *ref_count);
    641     int (*ingress_stu_port_control_set)(
    642         int unit,
    643         bcm_gport_t port,
    644         int index);
    645     int (*ingress_stu_port_control_get)(
    646         int unit,
    647         bcm_gport_t port,
    648         int *index);
    649 } tsn_stu_info_t;
    650 
    651 /* structure for device specific info */
    652 typedef struct bcmi_esw_tsn_dev_info_s {
    653 #if defined(BCM_TSN_SR_SUPPORT)
    654     /* SR MAC Proxy info */
    655     const tsn_sr_mac_proxy_info_t *tsn_sr_mac_proxy_info;
    656 
    657     /* SR flow management */
    658     const bcmi_tsn_sr_flows_dev_info_t *sr_flows_info;
    659 
    660     /* SR port configuration */
    661     const tsn_sr_port_dev_info_t *sr_port_info;
    662 
    663     /* per-chip SR Auto Learn drivers */
    664     const tsn_sr_auto_learn_info_t *tsn_sr_auto_learn_info;
    665 #endif /* BCM_TSN_SR_SUPPORT */
    666 
    667     /* TSN flow management */
    668     const bcmi_tsn_flows_dev_info_t *tsn_flows_info;
    669 
    670     /* per-chip Priority Map drivers */
    671     const tsn_pri_map_info_t *tsn_pri_map_info[bcmTsnPriMapTypeCount];
    672 
    673     /* per-chip MTU & STU control drivers */
    674     const tsn_mtu_info_t *tsn_mtu_info;
    675     const tsn_stu_info_t *tsn_stu_info;
    676 
    677     /* TSN event management */
    678     const bcmi_tsn_events_dev_info_t    *tsn_event_info;
    679     /* per-chip control drivers */
    680     const tsn_chip_ctrl_info_t *tsn_chip_ctrl_info;
    681 } bcmi_esw_tsn_dev_info_t;
    682 
    683 /*
    684  * TSN Priority Map conversion between software Map ID and hardware Index
    685  */
    686 extern int
    687 bcmi_esw_tsn_pri_map_hw_index_get(
    688     int unit,
    689     bcm_tsn_pri_map_t map_id,
    690     bcm_tsn_pri_map_type_t *map_type,
    691     uint32 *hw_index);
    692 
    693 extern int
    694 bcmi_esw_tsn_pri_map_map_id_get(
    695     int unit,
    696     bcm_tsn_pri_map_type_t map_type,
    697     uint32 hw_index,
    698     bcm_tsn_pri_map_t *map_id);
    699 
    700 /*
    701  * TSN Priority Map reference count control (increase or decrease reference
    702  * count)
    703  */
    704 extern int
    705 bcmi_esw_tsn_pri_map_ref_cnt_dec(
    706     int unit,
    707     bcm_tsn_pri_map_t map_id);
    708 
    709 extern int
    710 bcmi_esw_tsn_pri_map_ref_cnt_inc(
    711     int unit,
    712     bcm_tsn_pri_map_t map_id);
    713 
    714 extern int
    715 bcmi_esw_tsn_pri_map_ref_cnt_get(
    716     int unit,
    717     bcm_tsn_pri_map_t map_id,
    718     uint32 *ref_cnt);
    719 
    720 #if defined(BCM_WARM_BOOT_SUPPORT)
    721 /*
    722  * TSN Priority Map warmboot recovery function provided for mtu/stu module
    723  */
    724 extern int
    725 bcmi_esw_tsn_pri_map_mtu_stu_wb_set(
    726     int unit,
    727     bcm_tsn_pri_map_t map_id,
    728     bcm_tsn_pri_map_config_t *config);
    729 
    730 /* TSN Warmboot Sync */
    731 extern int
    732 bcm_esw_tsn_sync(int unit);
    733 
    734 #endif /* BCM_WARM_BOOT_SUPPORT */
    735 
    736 #endif /* BCM_TSN_SUPPORT */
    737 
    738 #endif /* _BCM_INT_TSN_H_ */