oob.h (10064B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_OOB_H__ 11 #define __BCM_OOB_H__ 12 13 #include <bcm/types.h> 14 15 #define BCM_OOB_FC_TX_FCN_EN 0x00000001 /* Fast Congestion Notification 16 Enable Flag */ 17 #define BCM_OOB_FC_TX_ING_EN 0x00000002 /* OOB FC Tx Ingress Congestion 18 Notification Enable Flag */ 19 #define BCM_OOB_FC_TX_EGR_EN 0x00000004 /* OOB FC Tx Egress Congestion 20 Notification Enable Flag */ 21 #define BCM_OOB_FC_TX_POOL_EN 0x00000008 /* OOB FC Tx Pool Congestion 22 Notification Enable Flag */ 23 24 /* 25 * Enum that controls the way the egress queues congetion state will be 26 * reported via OOB FC Tx 27 */ 28 typedef enum bcm_oob_egress_mode_e { 29 bcmOOBFCTxReportUCOnly = 0, /* OOB FC Tx only reports unicast queues 30 congestion state only. */ 31 bcmOOBFCTxReportMCOnly = 1, /* OOB FC Tx only reports multicast queues 32 congestion state only. */ 33 bcmOOBFCTxReportCos = 2, /* OOB FC Tx only reports Cos queues level 34 congestion state. */ 35 bcmOOBFCTxReportUCAndMC = 3, /* OOB FC Tx only reports both UC and MC 36 queues congestion state. */ 37 bcmOOBFCTxReportCount = 4 /* Must be last. */ 38 } bcm_oob_egress_mode_t; 39 40 /* OOB FC TX global configuration settings. */ 41 typedef struct bcm_oob_fc_tx_config_s { 42 uint32 flags; /* Enable flags */ 43 uint8 inter_pkt_gap; /* Inter Packet Gap in Clock cycles */ 44 bcm_service_pool_id_t gcs_id; /* Global Congestion Service Pool ID */ 45 bcm_oob_egress_mode_t egr_mode; /* Egress Congestion Reporting Mode */ 46 } bcm_oob_fc_tx_config_t; 47 48 /* OOB FC TX Egress Queue configuration settings. */ 49 typedef struct bcm_oob_fc_tx_queue_config_s { 50 bcm_cos_queue_t cosq; /* UC or MC queue number */ 51 uint8 queue_enable; /* Enable/disable queue congestion reporting */ 52 uint32 queue_offset; /* Queue bit offset within OOBFC message */ 53 } bcm_oob_fc_tx_queue_config_t; 54 55 /* Initializing OOB Flow Control Tx Queue configuration structure */ 56 extern void bcm_oob_fc_tx_queue_config_t_init( 57 bcm_oob_fc_tx_queue_config_t *config); 58 59 #ifndef BCM_HIDE_DISPATCHABLE 60 61 /* Set / get OOB Flow control Tx Queue configuration profile */ 62 extern int bcm_oob_fc_tx_queue_profile_set( 63 int unit, 64 int profile_id, 65 int count, 66 bcm_oob_fc_tx_queue_config_t *config); 67 68 /* Set / get OOB Flow control Tx Queue configuration profile */ 69 extern int bcm_oob_fc_tx_queue_profile_get( 70 int unit, 71 int profile_id, 72 int max_count, 73 bcm_oob_fc_tx_queue_config_t *config, 74 int *count); 75 76 /* Set / Get logical port to OOB port mapping(s) */ 77 extern int bcm_oob_fc_tx_port_mapping_set( 78 int unit, 79 int count, 80 int *port_array, 81 int *oob_port_array); 82 83 /* Set / Get logical port to OOB port mapping(s) */ 84 extern int bcm_oob_fc_tx_port_mapping_get( 85 int unit, 86 int max_count, 87 int *port_array, 88 int *oob_port_array, 89 int *count); 90 91 #endif /* BCM_HIDE_DISPATCHABLE */ 92 93 /* Initializing OOB Flow Control Tx global configuration structure */ 94 extern void bcm_oob_fc_tx_config_t_init( 95 bcm_oob_fc_tx_config_t *config); 96 97 /* OOB FC TX Channel info. */ 98 typedef struct bcm_oob_fc_tx_info_s { 99 uint8 ing_base; /* Ingress Channel Base */ 100 uint8 ucast_base; /* Unicast Queue Channel Base */ 101 uint8 mcast_base; /* Multicast Queue Channel Base */ 102 uint8 cos_base; /* Cos Queue Channel Base */ 103 uint8 pool_base; /* Pool Channel Base */ 104 } bcm_oob_fc_tx_info_t; 105 106 /* Initializing OOB Flow Control Tx global information */ 107 extern void bcm_oob_fc_tx_info_t_init( 108 bcm_oob_fc_tx_info_t *info); 109 110 /* OOB FC RX Interface Configuration. */ 111 typedef struct bcm_oob_fc_rx_config_s { 112 uint8 channel_base; /* Channel Base of the first HCFC packet for OOB FC Rx 113 Interface */ 114 int enable; /* enable=1 (Enable) and enable=0 (Disable) OOB FC Rx 115 Interface */ 116 } bcm_oob_fc_rx_config_t; 117 118 /* Initializes the configuration for given OOB Flow Control Rx Interface. */ 119 extern void bcm_oob_fc_rx_config_t_init( 120 bcm_oob_fc_rx_config_t *config); 121 122 #ifndef BCM_HIDE_DISPATCHABLE 123 124 /* Configures the OOB Flow Control Tx global configuration */ 125 extern int bcm_oob_fc_tx_config_set( 126 int unit, 127 bcm_oob_fc_tx_config_t *config); 128 129 /* Configures the OOB Flow Control Tx global configuration */ 130 extern int bcm_oob_fc_tx_config_get( 131 int unit, 132 bcm_oob_fc_tx_config_t *config); 133 134 /* Retrieve the OOB Flow Control Tx global information */ 135 extern int bcm_oob_fc_tx_info_get( 136 int unit, 137 bcm_oob_fc_tx_info_t *info); 138 139 /* 140 * Multiple set of OOB Flow Control Rx interface side traffic class to 141 * priority mapping 142 */ 143 extern int bcm_oob_fc_rx_port_tc_mapping_multi_set( 144 int unit, 145 bcm_oob_fc_rx_intf_id_t intf_id, 146 bcm_gport_t gport, 147 int array_count, 148 uint32 *tc, 149 uint32 *pri_bmp); 150 151 /* 152 * Multiple get OOB Flow Control Rx interface side traffic class to 153 * priority mapping 154 */ 155 extern int bcm_oob_fc_rx_port_tc_mapping_multi_get( 156 int unit, 157 bcm_oob_fc_rx_intf_id_t intf_id, 158 bcm_gport_t gport, 159 int array_max, 160 uint32 *tc, 161 uint32 *pri_bmp, 162 int *array_count); 163 164 /* 165 * Set OOB Flow Control Rx interface side traffic class to priority 166 * mapping 167 */ 168 extern int bcm_oob_fc_rx_port_tc_mapping_set( 169 int unit, 170 bcm_oob_fc_rx_intf_id_t intf_id, 171 bcm_gport_t gport, 172 uint32 tc, 173 uint32 pri_bmp); 174 175 /* 176 * Get OOB Flow Control Rx interface side traffic class to priority 177 * mapping 178 */ 179 extern int bcm_oob_fc_rx_port_tc_mapping_get( 180 int unit, 181 bcm_oob_fc_rx_intf_id_t intf_id, 182 bcm_gport_t gport, 183 uint32 tc, 184 uint32 *pri_bmp); 185 186 /* Set the configuration for given OOB Flow Control Rx Interface. */ 187 extern int bcm_oob_fc_rx_config_set( 188 int unit, 189 bcm_oob_fc_rx_intf_id_t intf_id, 190 bcm_oob_fc_rx_config_t *config, 191 int array_count, 192 bcm_gport_t *gport_array); 193 194 /* Get the configuration for given OOB Flow Control Rx Interface. */ 195 extern int bcm_oob_fc_rx_config_get( 196 int unit, 197 bcm_oob_fc_rx_intf_id_t intf_id, 198 bcm_oob_fc_rx_config_t *config, 199 int array_max, 200 bcm_gport_t *gport_array, 201 int *array_count); 202 203 /* 204 * Get the flow control byte number of a port on a given OOB Flow Control 205 * Rx interface. 206 */ 207 extern int bcm_oob_fc_rx_port_offset_get( 208 int unit, 209 bcm_oob_fc_rx_intf_id_t intf_id, 210 bcm_gport_t gport, 211 uint32 *offset); 212 213 #endif /* BCM_HIDE_DISPATCHABLE */ 214 215 #define BCM_OOB_STATS_TIMESTAMP_EN 0x00000001 /* Enable Flag for reporting 216 Timestamp */ 217 #define BCM_OOB_STATS_POOL_EN 0x00000002 /* Enable Flag for reporting 218 Instantaneous service pool 219 size */ 220 #define BCM_OOB_STATS_QUEUE_EN 0x00000004 /* Enable Flag for reporting 221 Instantaneous UC Queue size */ 222 223 #define BCM_OOB_STATS_INGRESS 0x01 /* Ingress side resource */ 224 #define BCM_OOB_STATS_EGRESS 0x02 /* Egress side resource */ 225 226 /* OOB Stats global configuration settings. */ 227 typedef struct bcm_oob_stats_config_s { 228 uint32 flags; /* Enable flags */ 229 uint8 inter_pkt_gap; /* Inter Packet Gap in Clock cycles */ 230 uint8 config_id; /* Global Config ID */ 231 } bcm_oob_stats_config_t; 232 233 #ifndef BCM_HIDE_DISPATCHABLE 234 235 /* Set the OOB Stats global configuration parameters */ 236 extern int bcm_oob_stats_config_set( 237 int unit, 238 bcm_oob_stats_config_t *config); 239 240 /* Get the OOB Stats global configuration parameters */ 241 extern int bcm_oob_stats_config_get( 242 int unit, 243 bcm_oob_stats_config_t *config); 244 245 #endif /* BCM_HIDE_DISPATCHABLE */ 246 247 /* Initialize the OOB Stats global configuration parameters. */ 248 extern void bcm_oob_stats_config_t_init( 249 bcm_oob_stats_config_t *config); 250 251 #ifndef BCM_HIDE_DISPATCHABLE 252 253 /* Multiple set of OOB Stats service pool list configuration */ 254 extern int bcm_oob_stats_pool_mapping_multi_set( 255 int unit, 256 int array_count, 257 int *offset_array, 258 uint8 *dir_array, 259 bcm_service_pool_id_t *pool_array); 260 261 /* Multiple get of OOB Stats service pool list configuration */ 262 extern int bcm_oob_stats_pool_mapping_multi_get( 263 int unit, 264 int array_max, 265 int *offset_array, 266 uint8 *dir_array, 267 bcm_service_pool_id_t *pool_array, 268 int *array_count); 269 270 /* Set of OOB Stats service pool list configuration */ 271 extern int bcm_oob_stats_pool_mapping_set( 272 int unit, 273 int offset, 274 uint8 dir, 275 bcm_service_pool_id_t pool); 276 277 /* Get of OOB Stats service pool list configuration */ 278 extern int bcm_oob_stats_pool_mapping_get( 279 int unit, 280 int offset, 281 uint8 *dir, 282 bcm_service_pool_id_t *pool); 283 284 /* Multiple set of OOB Stats Unicast queue list configuration */ 285 extern int bcm_oob_stats_queue_mapping_multi_set( 286 int unit, 287 int array_count, 288 int *offset_array, 289 bcm_gport_t *gport_array); 290 291 /* Multiple get of OOB Stats Unicast queue list configuration */ 292 extern int bcm_oob_stats_queue_mapping_multi_get( 293 int unit, 294 int array_max, 295 int *offset_array, 296 bcm_gport_t *gport_array, 297 int *array_count); 298 299 /* Set of OOB Stats Unicast queue list configuration */ 300 extern int bcm_oob_stats_queue_mapping_set( 301 int unit, 302 int offset, 303 bcm_gport_t gport); 304 305 /* Get of OOB Stats Unicast queue list configuration */ 306 extern int bcm_oob_stats_queue_mapping_get( 307 int unit, 308 int offset, 309 bcm_gport_t *gport); 310 311 #endif /* BCM_HIDE_DISPATCHABLE */ 312 313 #endif /* __BCM_OOB_H__ */