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

st_msg.h (5560B)


      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:    shr_st_msg.h
      8  */
      9 
     10 #ifndef SHR_ST_MSG_H_
     11 #define SHR_ST_MSG_H_
     12 
     13 #include <soc/shared/st.h>
     14 
     15 #ifdef BCM_UKERNEL
     16 #define __COMPILER_ATTR__ __attribute__ ((packed, aligned(4)))
     17 #else
     18 #define __COMPILER_ATTR__
     19 #endif
     20 
     21 /*
     22  * ST Initialization control message
     23  */
     24 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_init_s {
     25     /* Initialization flags */
     26     uint32 flags;
     27 
     28     /* Upper 32 bits of init time */
     29     uint32 init_time_u;
     30 
     31     /* Lower 32 bits of init time */
     32     uint32 init_time_l;
     33 
     34     /* Max length of the export packet */
     35     uint16 max_export_pkt_length;
     36 
     37     /* Number of instances */
     38     uint16 num_instances;
     39 
     40     /* Number of collectors */
     41     uint16 num_collectors;
     42 
     43 } shr_st_msg_ctrl_init_t;
     44 
     45 /*
     46  * ST system ID set/get messages
     47  */
     48 typedef struct __COMPILER_ATTR__ shr_st_msg_system_id_s {
     49     /* Length of the system ID */
     50     uint16 system_id_length;
     51 
     52     /* System ID */
     53     uint8 system_id[SHR_ST_MAX_SYSTEM_ID_LENGTH];
     54 
     55 } shr_st_msg_system_id_t;
     56 
     57 /*
     58  * ST ports add
     59  */
     60 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_ports_add_s {
     61     /* Number of ports to monitor */
     62     uint16 num_ports;
     63 
     64     /* List of logical ports */
     65     uint16 lports[SHR_ST_MAX_PORTS];
     66 
     67     /* List of physical ports */
     68     uint16 pports[SHR_ST_MAX_PORTS];
     69 
     70     /* List of MMU ports */
     71     uint16 mports[SHR_ST_MAX_PORTS];
     72 } shr_st_msg_ctrl_ports_add_t;
     73 
     74 /*
     75  * ST ports get
     76  */
     77 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_ports_get_s {
     78     /* Number of ports being monitored */
     79     uint16 num_ports;
     80 
     81     /* List of logical ports */
     82     uint16 lports[SHR_ST_MAX_PORTS];
     83 } shr_st_msg_ctrl_ports_get_t;
     84 
     85 /*
     86  * ST ports delete
     87  */
     88 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_ports_delete_s {
     89     /* Number of ports being monitored */
     90     uint16 num_ports;
     91 
     92     /* List of logical ports */
     93     uint16 lports[SHR_ST_MAX_PORTS];
     94 } shr_st_msg_ctrl_ports_delete_t;
     95 
     96 /*
     97  * ST instance create
     98  */
     99 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_instance_create_s {
    100     /* Stat types */
    101     uint32 stat_types[SHR_ST_MAX_PORTS];
    102 
    103     /* Component Id */
    104     uint32 component_id;
    105 
    106     /* Number of ports to monitor */
    107     uint16 num_ports;
    108 
    109     /* List of logical ports */
    110     uint16 lports[SHR_ST_MAX_PORTS];
    111 
    112     /* Instance Id */
    113     uint16 instance_id;
    114 
    115     /* Interface Name lengths */
    116     uint16 if_name_lengths[SHR_ST_MAX_PORTS];
    117 
    118     /* Interface names */
    119     uint8 if_names[SHR_ST_MAX_PORTS][SHR_ST_MAX_IF_NAME_LENGTH];
    120 
    121 } shr_st_msg_ctrl_instance_create_t;
    122 
    123 /*
    124  * ST instance get
    125  */
    126 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_instance_get_s {
    127     /* Stat types */
    128     uint32 stat_types[SHR_ST_MAX_PORTS];
    129 
    130     /* Component Id */
    131     uint32 component_id;
    132 
    133     /* Number of ports being monitored */
    134     uint16 num_ports;
    135 
    136     /* List of logical ports */
    137     uint16 lports[SHR_ST_MAX_PORTS];
    138 
    139     /* Interface Name lengths */
    140     uint16 if_name_lengths[SHR_ST_MAX_PORTS];
    141 
    142     /* Collector Id */
    143     uint16 collector_id;
    144 
    145     /* Interface names */
    146     uint8 if_names[SHR_ST_MAX_PORTS][SHR_ST_MAX_IF_NAME_LENGTH];
    147 
    148 } shr_st_msg_ctrl_instance_get_t;
    149 
    150 #define SHR_ST_MSG_CTRL_COLLECTOR_FLAGS_UDP_CHECKSUM (1 << 0)
    151 
    152 /*
    153  * Create PB collector
    154  */
    155 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_collector_create_s {
    156     /* Flags */
    157     uint32 flags;
    158 
    159     /* Checksum of IP header excluding length */
    160     uint32 ip_base_checksum;
    161 
    162     /* UDP psuedo header checksum */
    163     uint32 udp_base_checksum;
    164 
    165     /* Software handle for collector */
    166     uint16 id;
    167 
    168     /* Length of the encapsulation */
    169     uint16 encap_length;
    170 
    171     /* Max size of the packet that can be sent to collector */
    172     uint16 mtu;
    173 
    174     /* Offset to start of IP header in the encap */
    175     uint16 ip_offset;
    176 
    177     /* Offset to start of UDP header in the encap */
    178     uint16 udp_offset;
    179 
    180     /* Number of port info to encode in a single packet */
    181     uint16 num_port_in_pkt;
    182 
    183     /* Collector encapsulation */
    184     uint8 encap[SHR_ST_MAX_COLLECTOR_ENCAP_LENGTH];
    185 } shr_st_msg_ctrl_collector_create_t;
    186 
    187 
    188 /*
    189  * Attach instance to collector
    190  */
    191 typedef struct __COMPILER_ATTR__ shr_st_msg_ctrl_instance_collector_attach_s {
    192     /* Instance Id */
    193     uint16 instance_id;
    194 
    195     /* Collector Id */
    196     uint16 collector_id;
    197 
    198     /* Export interval in microseconds */
    199     uint32 export_interval_usecs;
    200 } shr_st_msg_ctrl_instance_collector_attach_t;
    201 
    202 /*
    203  * Instance export statistics
    204  */
    205 typedef struct __COMPILER_ATTR__ shr_st_msg_instance_export_stats_s {
    206     /* Number of pkts transmitted */
    207     uint32 tx_pkts_hi;
    208     uint32 tx_pkts_lo;
    209 
    210     /* Number of tx pkts that failed */
    211     uint32 tx_pkt_fails_hi;
    212     uint32 tx_pkt_fails_lo;
    213 
    214     /* Instance Id */
    215     uint16 instance_id;
    216 
    217     /* Collector Id */
    218     uint16 collector_id;
    219 
    220 } shr_st_msg_instance_export_stats_t;
    221 
    222 /*
    223  *  ST control messages
    224  */
    225 typedef union shr_st_msg_ctrl_s {
    226     shr_st_msg_ctrl_init_t             init;
    227     shr_st_msg_ctrl_ports_add_t        ports_add;
    228     shr_st_msg_ctrl_ports_get_t        ports_get;
    229     shr_st_msg_ctrl_ports_delete_t     ports_delete;
    230     shr_st_msg_ctrl_instance_create_t  instance_create;
    231     shr_st_msg_ctrl_instance_get_t     instance_get;
    232     shr_st_msg_ctrl_collector_create_t coll_create;
    233     shr_st_msg_ctrl_instance_collector_attach_t instance_collector_attach;
    234     shr_st_msg_instance_export_stats_t instance_export_stats;
    235 } shr_st_msg_ctrl_t;
    236 
    237 
    238 #endif /* SHR_ST_MSG_H_ */