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_taf.h (7214B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        tsn_taf.h
      8  * Purpose:     Definitions for TSN TAF.
      9  */
     10 
     11 #ifndef _BCM_INT_TSN_TAF_H_
     12 #define _BCM_INT_TSN_TAF_H_
     13 
     14 #include <soc/defs.h>
     15 #include <bcm/tsn.h>
     16 #include <bcm_int/esw/tsn_stat.h>
     17 
     18 #if defined(BCM_TSN_SUPPORT)
     19 #define BCMI_TSN_TAF_GATE_NUM_MAX            (128)
     20 #define BCMI_TSN_TAF_PROFILE_NUM_MAX         (200)
     21 
     22 /* internal TAF profile data structure */
     23 typedef struct bcmi_tsn_taf_schedule_entry_s bcmi_tsn_taf_schedule_entry_t;
     24 
     25 typedef struct bcmi_tsn_taf_profile_s {
     26     /* data maintain at esw layer */
     27     int                             taf_gate;
     28     bcm_tsn_taf_profile_state_t     status;
     29     bcm_tsn_taf_profile_t           data;
     30     bcm_ptp_timestamp_t             config_change_time;
     31 
     32     /* data maintain at chip-specific layer */
     33     bcmi_tsn_taf_schedule_entry_t   *schedule;
     34 } bcmi_tsn_taf_profile_t;
     35 
     36 /* TAF schedule entry, double linked list */
     37 struct bcmi_tsn_taf_schedule_entry_s {
     38     /* data maintain at chip-specific layer */
     39     bcmi_tsn_taf_profile_t *taf_profile;
     40     bcmi_tsn_taf_schedule_entry_t *prev;
     41     bcmi_tsn_taf_schedule_entry_t *next;
     42     bcm_ptp_timestamp_t schedule_time;
     43 };
     44 
     45 /* internal TAF event hanlder */
     46 typedef struct bcmi_tsn_taf_event_handler_s bcmi_tsn_taf_event_handler_t;
     47 struct bcmi_tsn_taf_event_handler_s {
     48     bcm_tsn_taf_event_cb cb;
     49     void *user_data;
     50     bcmi_tsn_taf_event_handler_t *next;
     51 };
     52 
     53 /* per-chip control drivers */
     54 typedef struct bcmi_tsn_taf_dev_info_s {
     55     /* function set */
     56     int (*tsn_taf_init)(int);
     57     int (*tsn_taf_cleanup)(int);
     58     int (*tsn_taf_gate_create)(int, int, int *);
     59     int (*tsn_taf_gate_traverse)(int, bcm_tsn_taf_gate_traverse_cb, void *);
     60     int (*tsn_taf_gate_destroy)(int, int);
     61     int (*tsn_taf_gate_check)(int, int);
     62     int (*tsn_taf_status_get)(int, int, bcm_tsn_taf_status_t, uint32 *);
     63     int (*tsn_taf_global_control_get)(int, bcm_tsn_taf_control_t, uint32 *);
     64     int (*tsn_taf_global_control_set)(int, bcm_tsn_taf_control_t, uint32);
     65     int (*tsn_taf_port_control_get)(int, bcm_gport_t,
     66                                     bcm_tsn_control_t, uint32 *);
     67     int (*tsn_taf_port_control_set)(int, bcm_gport_t,
     68                                     bcm_tsn_control_t, uint32);
     69     int (*tsn_taf_gate_control_get)(int, int, bcm_tsn_taf_control_t, uint32 *);
     70     int (*tsn_taf_gate_control_set)(int, int, bcm_tsn_taf_control_t, uint32);
     71     int (*tsn_taf_gate_pri_map_set)(int, uint32, bcm_tsn_pri_map_config_t *);
     72     int (*tsn_taf_gate_pri_map_get)(int, uint32, bcm_tsn_pri_map_config_t *);
     73     int (*tsn_taf_gate_pri_map_delete)(int, uint32);
     74     int (*tsn_taf_calendar_param_check)(int, int, bcm_tsn_taf_profile_t *);
     75     int (*tsn_taf_calendar_resource_alloc)(int, int, bcm_tsn_taf_profile_t *);
     76     int (*tsn_taf_calendar_resource_free)(int, int, bcm_tsn_taf_profile_t *);
     77     int (*tsn_taf_calendar_kickoff)(int, int, bcmi_tsn_taf_profile_t *);
     78     int (*tsn_taf_calendar_profile_create)(int, bcm_tsn_taf_profile_t *,
     79                                            bcm_tsn_taf_profile_id_t *,
     80                                            bcmi_tsn_taf_profile_t **);
     81     int (*tsn_taf_calendar_profile_get)(int, bcm_tsn_taf_profile_id_t,
     82                                         bcmi_tsn_taf_profile_t **);
     83     int (*tsn_taf_calendar_profile_destroy)(int, bcm_tsn_taf_profile_id_t);
     84     int (*tsn_taf_calendar_profile_traverse)(int, int,
     85                                              bcm_tsn_taf_profile_traverse_cb,
     86                                              void *);
     87     int (*tsn_taf_schedule_insert)(int, int, bcm_ptp_timestamp_t *,
     88                                    bcmi_tsn_taf_profile_t *);
     89     int (*tsn_taf_schedule_remove)(int, int,
     90                                    bcmi_tsn_taf_profile_t *);
     91 
     92     int (*tsn_taf_schedule_pick)(int, int,
     93                                  bcmi_tsn_taf_profile_t *,
     94                                  bcmi_tsn_taf_profile_t **);
     95 
     96     int (*tsn_taf_schedule_exist)(int, bcmi_tsn_taf_profile_t *, int *);
     97     int (*tsn_taf_schedule_get)(int, bcmi_tsn_taf_profile_t *,
     98                                 bcm_ptp_timestamp_t *);
     99     int (*tsn_taf_event_register)(int, int, bcm_tsn_taf_event_types_t,
    100                                   bcm_tsn_taf_event_cb, void *);
    101     int (*tsn_taf_event_unregister)(int, int, bcm_tsn_taf_event_types_t,
    102                                     bcm_tsn_taf_event_cb);
    103     int (*tsn_taf_event_notify)(int, int, bcm_tsn_taf_event_type_t);
    104     int (*tsn_taf_interrupt_handle_start)(int);
    105     int (*tsn_taf_interrupt_handle_tod)(int, int *);
    106     int (*tsn_taf_interrupt_handle_switch)(int, int *, SHR_BITDCL *, uint32);
    107     int (*tsn_taf_interrupt_handle_error)(int, int *, SHR_BITDCL *, uint32);
    108     int (*tsn_taf_interrupt_handle_user_cb)(int);
    109     int (*tsn_taf_interrupt_handle_finish)(int);
    110     int (*tsn_taf_gate_max_bytes_profile_create)(int, int, uint64, int *);
    111     int (*tsn_taf_gate_max_bytes_profile_set)(int, int, int, uint64);
    112     int (*tsn_taf_gate_max_bytes_profile_get)(int, int, int, uint64 *);
    113     int (*tsn_taf_gate_max_bytes_profile_destroy)(int, int, int);
    114     int (*tsn_taf_gate_max_bytes_profile_traverse)(
    115         int, int, bcm_tsn_taf_gate_max_bytes_profile_traverse_cb, void *);
    116     int (*tsn_taf_cosq_mapping_profile_create)(int, int *);
    117     int (*tsn_taf_cosq_mapping_profile_set)(int, int, bcm_cos_t,
    118                                             bcm_cos_queue_t);
    119     int (*tsn_taf_cosq_mapping_profile_get)(int, int, bcm_cos_t,
    120                                             bcm_cos_queue_t *);
    121     int (*tsn_taf_cosq_mapping_profile_destroy)(int, int);
    122     int (*tsn_taf_cosq_mapping_profile_traverse)(
    123         int, bcm_tsn_taf_cosq_mapping_profile_traverse_cb, void *);
    124     int (*tsn_taf_gate_stat_counter_sync)(int, int);
    125     int (*tsn_taf_gate_stat_counter_access)(int, int, uint32,
    126                                             bcm_tsn_taf_gate_stat_t *, uint64 *,
    127                                             bcmi_tsn_stat_counter_action_t);
    128 #if defined(BCM_WARM_BOOT_SUPPORT)
    129     int (*tsn_taf_get_scache_size)(int, int *);
    130     int (*tsn_taf_sync)(int, uint8 *);
    131     int (*tsn_taf_reload)(int, uint8 *);
    132 #endif /* BCM_WARM_BOOT_SUPPORT */
    133     /* data set */
    134     uint32 (*tsn_taf_gate_profile_num)(int);
    135     uint32 tsn_taf_gate_intpri_num;
    136 } bcmi_tsn_taf_dev_info_t;
    137 
    138 extern int bcmi_gh2_taf_gate_pri_map_hw_idx_get(
    139             int unit, uint32 sw_idx, uint32 *hw_idx);
    140 extern int bcmi_gh2_taf_gate_pri_map_sw_idx_get(
    141             int unit, uint32 hw_idx, uint32 *sw_idx);
    142 extern int bcmi_esw_tsn_taf_port_control_set(
    143             int unit, bcm_gport_t gport, bcm_tsn_control_t type, uint32 arg);
    144 extern int bcmi_esw_tsn_taf_port_control_get(
    145             int unit, bcm_gport_t gport, bcm_tsn_control_t type, uint32 *arg);
    146 extern int bcmi_esw_tsn_taf_init(int unit);
    147 extern int bcmi_esw_tsn_taf_coldboot_init(int unit);
    148 extern void bcmi_esw_tsn_taf_cleanup(int unit);
    149 extern tsn_pri_map_info_t bcmi_taf_gate_pri_map_info;
    150 #endif /* BCM_TSN_SUPPORT */
    151 #endif  /* _BCM_INT_TSN_TAF_H_ */