cosq_latency.h (9871B)
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/latency/cosq_latency.h 8 * Reserved.$ 9 */ 10 11 #ifndef _DNX_COSQ_LATENCY_H_INCLUDED_ 12 /* 13 * { 14 */ 15 #define _DNX_COSQ_LATENCY_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 24 /* 25 * Defines 26 * { 27 */ 28 #define DNX_COSQ_LATENCY_INGRESS_RESOURCE "COSQ_LATENCY_INGRESS" 29 #define DNX_COSQ_LATENCY_END_TO_END_RESOURCE "COSQ_LATENCY_END_TO_END" 30 #define DNX_COSQ_LATENCY_END_TO_END_AQM_RESOURCE "COSQ_LATENCY_END_TO_END_AQM" 31 #define DNX_COSQ_LATENCY_QUARTET_QUEUES_TEMPLATE_NAME "cosq latency quartet queues profiles" 32 33 #define DNX_COSQ_LATENCY_AQM_FLOW_ID_RESOURCE "COSQ_LATENCY_AQM_FLOW_ID_RESOURCE" 34 35 /* 36 * } 37 */ 38 39 /** 40 * \brief 41 * init cosq latency sub-module. 42 * \param [in] unit -unit id 43 * \return 44 * shr_error_e 45 * \remark 46 * NONE 47 * \see 48 * NONE 49 */ 50 shr_error_e dnx_cosq_latency_init( 51 int unit); 52 53 /** 54 * \brief 55 * de-init cosq latency sub-module. 56 * \param [in] unit -unit id 57 * \return 58 * shr_error_e 59 * \remark 60 * NONE 61 * \see 62 * NONE 63 */ 64 shr_error_e dnx_cosq_latency_deinit( 65 int unit); 66 67 /** 68 * \brief 69 * function get gport and a single property of the latency profile and call the relevant function to set it. 70 * \param [in] unit -unit id 71 * \param [in] port - latency gport 72 * \param [in] cosq - offset/index of the object.relevant just for type bin 73 * \param [in] type - property type of the profile 74 * \param [in] arg - the value of the property 75 * \return 76 * shr_error_e 77 * \remark 78 * None 79 * \see 80 * NONE 81 */ 82 shr_error_e dnx_cosq_latency_profile_set( 83 int unit, 84 bcm_gport_t port, 85 bcm_cos_queue_t cosq, 86 bcm_cosq_control_t type, 87 int arg); 88 89 /** 90 * \brief 91 * function get gport and get a single property value of the latency profile 92 * \param [in] unit -unit id 93 * \param [in] port - latency gport 94 * \param [in] cosq - offset/index of the object.relevant just for type bin 95 * \param [in] type - property type of the profile 96 * \param [out] arg - the value of the property 97 * \return 98 * shr_error_e 99 * \remark 100 * None 101 * \see 102 * NONE 103 */ 104 shr_error_e dnx_cosq_latency_profile_get( 105 int unit, 106 bcm_gport_t port, 107 bcm_cos_queue_t cosq, 108 bcm_cosq_control_t type, 109 int *arg); 110 111 /** 112 * \brief 113 * callback print function for template manager. print the queue quartet latency profile 114 * \param [in] unit -unit id 115 * \param [in] data -const pointer to profile data 116 * \return 117 * void 118 * \remark 119 * NONE 120 * \see 121 * NONE 122 */ 123 void dnx_cosq_latency_queue_template_print_cb( 124 int unit, 125 const void *data); 126 127 /** 128 * \brief 129 * handle the mapping from queue (base of 4) to latency profile. 130 * \param [in] unit -unit id 131 * \param [in] core - core id 132 * \param [in] flags - NONE 133 * \param [in] qid - the queue id to map. 134 * \param [in] lat_profile_id - the latency profile that the queue will be mapped to 135 * \return 136 * shr_error_e 137 * \remark 138 * The queue quartet profile contain two properties: {TC_MAP, latency-profile}. 139 * This routine map queue to queue quartet profile and queue quartet profile to latency-profile. 140 * the TC_MAP is not being handled in this function. 141 * Since we are using template manager, we need to give all properties of the profile. 142 * therefore, we read the TC_MAP from WH and build the tm info based on the user lat_profile_id and tc_map. 143 * \see 144 * NONE 145 */ 146 shr_error_e dnx_cosq_latency_ingress_queue_map_set( 147 int unit, 148 int core, 149 int flags, 150 int qid, 151 int lat_profile_id); 152 153 /** 154 * \brief 155 * get the mapped latency profile for a given base quartet queue 156 * \param [in] unit -unit id 157 * \param [in] core - core id 158 * \param [in] flags - NONE 159 * \param [in] qid - the queue id to map. 160 * \param [out] lat_profile_id - the latency profile that the queue is mapped to 161 * \return 162 * shr_error_e 163 * \remark 164 * NONE 165 * \see 166 * NONE 167 */ 168 shr_error_e dnx_cosq_latency_ingress_queue_map_get( 169 int unit, 170 int core, 171 int flags, 172 int qid, 173 int *lat_profile_id); 174 175 /** 176 * \brief 177 * determine if end to end latency is per port or per flow 178 * \param [in] unit -unit id 179 * \param [in] enable - TRUE/FALSE 180 * \return 181 * shr_error_e 182 * \remark 183 * NONE 184 * \see 185 * NONE 186 */ 187 shr_error_e dnx_cosq_latency_end_to_end_per_port_set( 188 int unit, 189 int enable); 190 191 /** 192 * \brief 193 * get if end to end latency is per port or per flow 194 * \param [in] unit -unit id 195 * \param [in] enable - TRUE/FALSE 196 * \return 197 * shr_error_e 198 * \remark 199 * NONE 200 * \see 201 * NONE 202 */ 203 shr_error_e dnx_cosq_latency_end_to_end_per_port_get( 204 int unit, 205 int *enable); 206 207 /** 208 * \brief 209 * map a gport (destination port) to end to end latency profile 210 * \param [in] unit -unit id 211 * \param [in] flags - NONE 212 * \param [in] gport_to_map - destination port 213 * \param [in] profile_id - latency profile_id 214 * \return 215 * shr_error_e 216 * \remark 217 * NONE 218 * \see 219 * NONE 220 */ 221 shr_error_e dnx_cosq_latency_end_to_end_port_map_set( 222 int unit, 223 uint32 flags, 224 bcm_gport_t gport_to_map, 225 int profile_id); 226 227 /** 228 * \brief 229 * get the end to end latency profile id that the gport (destination port) is map to. 230 * \param [in] unit -unit id 231 * \param [in] flags - NONE 232 * \param [in] gport_to_map - destination port 233 * \param [out] profile_id - latency profile_id 234 * \return 235 * shr_error_e 236 * \remark 237 * NONE 238 * \see 239 * NONE 240 */ 241 shr_error_e dnx_cosq_latency_end_to_end_port_map_get( 242 int unit, 243 uint32 flags, 244 bcm_gport_t gport_to_map, 245 int *profile_id); 246 247 /** 248 * \brief 249 * function set ingress latency, dispatch according to type - 250 * ingress latency profile configuration or ingless latency voq 251 * settings 252 * \param [in] unit -unit id 253 * \param [in] port - profile_id 254 * \param [in] cosq - offset/index of the range.relevant just for type bin 255 * \param [in] type - type 256 * \param [in] arg - the value of the property 257 * \return 258 * shr_error_e 259 * \remark 260 * All threshold are in nano second units, same as the latency units. 261 * \see 262 * NONE 263 */ 264 shr_error_e dnx_cosq_latency_config_set( 265 int unit, 266 bcm_gport_t port, 267 bcm_cos_queue_t cosq, 268 bcm_cosq_control_t type, 269 int arg); 270 271 /** 272 * \brief 273 * function get ingress latency, dispatch according to type - 274 * ingress latency profile configuration or ingless latency voq 275 * settings 276 * \param [in] unit -unit id 277 * \param [in] port - profile_id 278 * \param [in] cosq - offset/index of the range.relevant just for type bin 279 * \param [in] type - type 280 * \param [out] arg - the value of the property 281 * \return 282 * shr_error_e 283 * \remark 284 * All threshold are in nano second units, same as the latency units. 285 * \see 286 * NONE 287 */ 288 shr_error_e dnx_cosq_latency_config_get( 289 int unit, 290 bcm_gport_t port, 291 bcm_cos_queue_t cosq, 292 bcm_cosq_control_t type, 293 int *arg); 294 295 /** 296 * \brief - 297 * Generic API function used for getting configuration of cosq 298 * controls related to latency parameters 299 * 300 * \param [in] unit - Unit-ID 301 * \param [in] flags - flags 302 * \param [in] gport - voq rate class 303 * \param [in] key - key according to type 304 * \param [in] type - latency type 305 * \param [in] arg - the value of the param 306 * \return 307 * See shr_error_e 308 * \remark 309 * * None 310 * \see 311 * * None 312 */ 313 shr_error_e dnx_cosq_latency_cosq_param_set( 314 int unit, 315 uint32 flags, 316 bcm_gport_t gport, 317 uint32 key, 318 bcm_cosq_generic_control_t type, 319 uint32 arg); 320 321 /** 322 * \brief - 323 * Generic API function used for getting configuration of cosq 324 * controls related to latency parameters 325 * 326 * \param [in] unit - Unit-ID 327 * \param [in] flags - flags 328 * \param [in] gport - voq rate class 329 * \param [in] key - key according to type 330 * \param [in] type - latency type 331 * \param [out] arg - the value of the param 332 * \return 333 * See shr_error_e 334 * \remark 335 * * None 336 * \see 337 * * None 338 */ 339 shr_error_e dnx_cosq_latency_cosq_param_get( 340 int unit, 341 uint32 flags, 342 bcm_gport_t gport, 343 uint32 key, 344 bcm_cosq_generic_control_t type, 345 uint32 *arg); 346 347 /** 348 * \brief 349 * function get AQM flow id gport and map it to End to End AQM 350 * lateny profile gport/ port and tc 351 * \param [in] unit -unit id 352 * \param [in] port - aqm flow id gport 353 * \param [in] cosq - offset/index 354 * \param [in] type - property type of the profile 355 * \param [in] arg - the value of the property 356 * \return 357 * shr_error_e 358 * \remark 359 * None 360 * \see 361 * NONE 362 */ 363 shr_error_e dnx_cosq_latency_aqm_flow_profile_mapping_set( 364 int unit, 365 bcm_gport_t port, 366 bcm_cos_queue_t cosq, 367 bcm_cosq_control_t type, 368 int arg); 369 370 /** 371 * \brief 372 * function get AQM flow id gport and get the mapping to End to 373 * End AQM lateny profile gport/ port and tc 374 * \param [in] unit - unit id 375 * \param [in] port - latency gport 376 * \param [in] cosq - offset/index 377 * \param [in] type - property type of the profile 378 * \param [out] arg - the value of the property 379 * \return 380 * shr_error_e 381 * \remark 382 * None 383 * \see 384 * NONE 385 */ 386 shr_error_e dnx_cosq_latency_aqm_flow_profile_mapping_get( 387 int unit, 388 bcm_gport_t port, 389 bcm_cos_queue_t cosq, 390 bcm_cosq_control_t type, 391 int *arg); 392 393 /** 394 * \brief - allocate new gport for E2E latency AQM flow ID 395 * 396 * \param [in] unit - unit 397 * \param [in] flags - flags - with/without id 398 * \param [out] gport - allocated gport 399 * 400 * \return 401 * \remark 402 * * None 403 * \see 404 * * None 405 */ 406 shr_error_e dnx_cosq_latency_aqm_flow_id_gport_add( 407 int unit, 408 uint32 flags, 409 bcm_gport_t * gport); 410 411 /** 412 * \brief - remove gport E2E latency AQM flow ID 413 * 414 * \param [in] unit - unit 415 * \param [out] gport - allocated gport 416 * 417 * \return 418 * \remark 419 * * None 420 * \see 421 * * None 422 */ 423 shr_error_e dnx_cosq_latency_aqm_flow_id_gport_delete( 424 int unit, 425 bcm_gport_t gport); 426 427 /** } */ 428 #endif /*_DNX_COSQ_LATENCY_H_INCLUDED_ */