flow_int.h (10808B)
1 /* 2 * DO NOT EDIT THIS FILE! 3 * This file is auto-generated. 4 * Edits to this file will be lost when it is regenerated. 5 * 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 11 #ifndef BCMINT_LTSW_FLOW_INT_H 12 #define BCMINT_LTSW_FLOW_INT_H 13 14 #include <bcm/types.h> 15 16 #include <sal/sal_types.h> 17 18 /*! 19 * \brief Defines handle ID for each flow. 20 */ 21 typedef struct bcmint_flow_handle_rec_s { 22 23 /*! A string to identify flow. */ 24 char *flow_name; 25 26 /*! Internal ID for flow. */ 27 uint32_t flow_handle; 28 29 } bcmint_flow_handle_rec_t; 30 31 /*! 32 * \brief FLOW vairant specific LT field description. 33 */ 34 typedef struct bcmint_flow_fld_s { 35 36 /*! LT field name. */ 37 const char *name; 38 39 } bcmint_flow_fld_t; 40 41 /*! 42 * \brief FLOW vairant specific LT description. 43 */ 44 typedef struct bcmint_flow_lt_s { 45 46 /*! LT name. */ 47 const char *name; 48 49 /*! Bitmap of valid fields. */ 50 uint64_t fld_bmp; 51 52 /*! LT fields. */ 53 const bcmint_flow_fld_t *flds; 54 55 } bcmint_flow_lt_t; 56 57 /*! 58 * \brief FLOW variant specific LT database description. 59 */ 60 typedef struct bcmint_flow_lt_db_s { 61 62 /*! LT bitmap. */ 63 uint32_t lt_bmp; 64 65 /*! LT array. */ 66 const bcmint_flow_lt_t *lts; 67 68 } bcmint_flow_lt_db_t; 69 70 /*! 71 * \brief EGR_DVP variant specific LT fields. 72 */ 73 typedef enum bcmint_flow_fld_egr_dvp_s { 74 75 /*! Layer 2 MTU check value. */ 76 BCMINT_LTSW_FLOW_FLD_EGR_DVP_L2_MTU_VALUE = 0, 77 78 /*! Process control 2. */ 79 BCMINT_LTSW_FLOW_FLD_EGR_DVP_PROCESS_CTRL_2 = 1, 80 81 /*! EGR_DVP vairant specific LT field count. */ 82 BCMINT_LTSW_FLOW_FLD_EGR_DVP_FLD_CNT = 2 83 84 } bcmint_flow_fld_egr_dvp_t; 85 86 #define BCMINT_FLOW_FLD_EGR_DVP_STR \ 87 { \ 88 "L2_MTU_VALUE", \ 89 "PROCESS_CTRL_2", \ 90 "FLD_CNT" \ 91 } 92 93 /*! 94 * \brief FLOW variant specific LTs. 95 */ 96 typedef enum bcmint_flow_lt_id_s { 97 98 /*! LT EGR_DVP. */ 99 BCMINT_LTSW_FLOW_LT_EGR_DVP = 0, 100 101 /*! FLOW variant specific LT count. */ 102 BCMINT_LTSW_FLOW_LT_CNT = 1 103 104 } bcmint_flow_lt_id_t; 105 106 #define BCMINT_FLOW_LT_ID_STR \ 107 { \ 108 "EGR_DVP", \ 109 "CNT" \ 110 } 111 112 /*! 113 * \brief Flow HA subcomponent ID. 114 */ 115 typedef enum bcmint_flow_ha_sub_comp_id_s { 116 117 /*! HA sub component id for tunnel ID mapping. */ 118 bcmintFlowHaTnlInitIdMap = 0, 119 120 /*! HA sub component id for L2 ingress interface mapping. */ 121 bcmintFlowHaL2iifMap = 1, 122 123 /*! HA sub component id for VP match info. */ 124 bcmintFlowHaVpMatch = 2, 125 126 /*! Flow HA sub component ID count. */ 127 bcmintFlowHaCount = 3 128 129 } bcmint_flow_ha_sub_comp_id_t; 130 131 #define BCMINT_FLOW_HA_SUB_COMP_ID_STR \ 132 { \ 133 "TnlInitIdMap", \ 134 "L2iifMap", \ 135 "VpMatch" \ 136 } 137 138 /*! 139 * \brief Internal ID for flow. 140 */ 141 /*! Virtual Extensible LAN With IPv4 Encapsulation. */ 142 #define BCMINT_FLOW_ID_CLASSIC_VXLAN 1 143 144 /*! Generic Network Virtualization Encapsulation. */ 145 #define BCMINT_FLOW_ID_GENEVE 2 146 147 /*! Generic Protocol Extension for VXLAN. */ 148 #define BCMINT_FLOW_ID_GPE 3 149 150 /*! In-band Network Telemetry. */ 151 #define BCMINT_FLOW_ID_INT 4 152 153 /*! MPLS packets over generic routing encapsulation. */ 154 #define BCMINT_FLOW_ID_MPLS_OVER_GRE 5 155 156 /*! Network Service Header. */ 157 #define BCMINT_FLOW_ID_NSH 6 158 159 /*! Virtual Extensible LAN With IPv6 Encapsulation. */ 160 #define BCMINT_FLOW_ID_VXLAN 7 161 162 /*! 163 * \brief Internal ID for flow function. 164 */ 165 /*! Flow function ID start delimiter. */ 166 #define BCMINT_FLOW_FUNC_ID_START 0 167 168 /*! Flow match ID. */ 169 #define BCMINT_FLOW_FUNC_MATCH_ID 1 170 171 /*! Flow encap ID */ 172 #define BCMINT_FLOW_FUNC_ENCAP_ID 2 173 174 /*! Flow tunnel initiator ID */ 175 #define BCMINT_FLOW_FUNC_TUNNEL_INITIATOR_ID 3 176 177 /*! Flow tunnel terminator ID */ 178 #define BCMINT_FLOW_FUNC_TUNNEL_TERMINATOR_ID 4 179 180 /*! Flow encap set ID */ 181 #define BCMINT_FLOW_FUNC_ENCAP_SET_ID 5 182 183 /*! Flow L2 switch ID */ 184 #define BCMINT_FLOW_FUNC_L2_SWITCH_ID 6 185 186 /*! Flow L3 host lookup ID */ 187 #define BCMINT_FLOW_FUNC_L3_HOST_ID 7 188 189 /*! Flow L3 route lookup ID */ 190 #define BCMINT_FLOW_FUNC_L3_ROUTE_ID 8 191 192 /*! Flow egress object ID */ 193 #define BCMINT_FLOW_FUNC_EGRESS_OBJ_ID 9 194 195 /*! Flow egress interface ID */ 196 #define BCMINT_FLOW_FUNC_EGRESS_INTF_ID 10 197 198 /*! Flow function ID end delimiter */ 199 #define BCMINT_FLOW_FUNC_ID_END 11 200 201 /*! 202 * \brief Internal ID for logical field. 203 */ 204 /*! Device ID */ 205 #define BCMINT_FLOW_LF_ID_INT_DEVICE_ID 1 206 207 /*! Template ID */ 208 #define BCMINT_FLOW_LF_ID_INT_TEMPLATE_ID 2 209 210 /*! Opaque meta data 1 */ 211 #define BCMINT_FLOW_LF_ID_INT_OPAQUE_MD1 3 212 213 /*! Opaque meta data 2 */ 214 #define BCMINT_FLOW_LF_ID_INT_OPAQUE_MD2 4 215 216 /*! Invalid logical field ID. */ 217 #define BCMINT_FLOW_LF_ID_INVALID (0xFFFFFFFF) 218 219 /*! Max length of logical field name. */ 220 #define BCMINT_FLOW_LF_NAME_LEN_MAX (0x20) 221 222 /*! 223 * \brief Defines mapping of logical field name and internal ID. 224 */ 225 typedef struct bcmint_flow_lf_map_rec_s { 226 227 /*! A string to identify legacy logical field name. */ 228 char *lf_name; 229 230 /*! Internal ID for logical field. */ 231 uint32_t lf_id; 232 233 /*! A string to identify new logical field name. */ 234 const char *new_lf_name; 235 236 } bcmint_flow_lf_map_rec_t; 237 238 /*! 239 * \brief Internal ID for flow option. 240 */ 241 /*! VXLAN IPv6 match, lookup VNID to assign VFI. */ 242 #define BCMINT_FLOW_OPT_ID_LOOKUP_VNID_ASSIGN_VFI 1 243 244 /*! VXLAN IPv6 match, lookup IPv6 SIP to assign SVP. */ 245 #define BCMINT_FLOW_OPT_ID_LOOKUP_IPV6_SIP_ASSIGN_SVP 2 246 247 /*! VXLAN IPv6 encap, lookup DVP 7 VFI to assign VNID. */ 248 #define BCMINT_FLOW_OPT_ID_LOOKUP_DVP_VFI_ASSIGN_VNID 3 249 250 /*! VXLAN IPv6 encap, lookup VFI to assign VNID. */ 251 #define BCMINT_FLOW_OPT_ID_LOOKUP_VFI_ASSIGN_VNID 4 252 253 /*! VXLAN IPv6 encap_set, VFI as lookup key. */ 254 #define BCMINT_FLOW_OPT_ID_IPV6_EVXLT_KEY_TYPE_VFI 5 255 256 /*! VXLAN IPv6 encap_set, VFI and DVP as lookup key. */ 257 #define BCMINT_FLOW_OPT_ID_IPV6 6 258 259 /*! VXLAN IPv6 terminator, lookup IPv6 DIP. */ 260 #define BCMINT_FLOW_OPT_ID_LOOKUP_IPV6_DIP_TERM_TUNNEL 7 261 262 /*! VXLAN IPv6 initiator, use entropy as flow label. */ 263 #define BCMINT_FLOW_OPT_ID_IPV6_FLOW_LABEL_USE_ENTROPY 8 264 265 /*! INT encap_set, assign device ID and template ID. */ 266 #define BCMINT_FLOW_OPT_ID_ASSIGN_DEVICE_ID_TEMPLATE_ID 9 267 268 /*! flow option ID for not care case. */ 269 #define BCMINT_FLOW_OPT_ID_ANY (0xFFFFFFFF - 1) 270 271 /*! Max length of flow option name. */ 272 #define BCMINT_FLOW_OPT_NAME_LEN_MAX (0x40) 273 274 /*! 275 * \brief Defines mapping of option name and internal ID. 276 */ 277 typedef struct bcmint_flow_op_map_rec_s { 278 279 /*! A string to identify legacy logical field name. */ 280 char *op_name; 281 282 /*! Internal ID for logical field. */ 283 uint32_t op_id; 284 285 } bcmint_flow_op_map_rec_t; 286 287 /*! Max length of logical table name. */ 288 #define BCMINT_FLOW_LT_NAME_LEN_MAX (0x20) 289 290 /*! 291 * \brief Defines mapping of internal option ID and logical table name. 292 */ 293 typedef struct bcmint_flow_op_lt_map_rec_s { 294 295 /*! Internal ID for flow option. */ 296 uint32_t op_id; 297 298 /*! A string to identify logical table name. */ 299 const char *lt_name; 300 301 } bcmint_flow_op_lt_map_rec_t; 302 303 /*! 304 * \brief Enumerator for mapping info type. 305 */ 306 typedef enum bcmint_flow_mapping_info_type_s { 307 308 /*! Flow handle. */ 309 INFO_SEL_HANDLE = 0, 310 311 /*! Flow option. */ 312 INFO_SEL_OP = 1, 313 314 /*! Logical field. */ 315 INFO_SEL_LOGICAL_FIELD = 2, 316 317 /*! Flow option to logical table. */ 318 INFO_SEL_OP_LOGICAL_TABLE = 3, 319 320 /*! Mapping info type count. */ 321 INFO_SEL_CNT = 4 322 323 } bcmint_flow_mapping_info_type_t; 324 325 #define BCMINT_FLOW_MAPPING_INFO_TYPE_STR \ 326 { \ 327 "HANDLE", \ 328 "OP", \ 329 "LOGICAL_FIELD", \ 330 "OP_LOGICAL_TABLE", \ 331 "CNT" \ 332 } 333 334 /*! 335 * \brief Enumerator for HW operation type. 336 */ 337 typedef enum bcmint_flow_hw_opt_type_s { 338 339 /*! Get info from table. */ 340 HW_OPT_GET = 0, 341 342 /*! Set info to table. */ 343 HW_OPT_SET = 1, 344 345 /*! Clear table entry. */ 346 HW_OPT_CLR = 2, 347 348 /*! Operation type count. */ 349 HW_OPT_CNT = 3 350 351 } bcmint_flow_hw_opt_type_t; 352 353 #define BCMINT_FLOW_HW_OPT_TYPE_STR \ 354 { \ 355 "GET", \ 356 "SET", \ 357 "CLR", \ 358 "CNT" \ 359 } 360 361 /*! Reserved VNID for internal use. */ 362 #define BCMINT_FLOW_VNID_RESERVED (0x0) 363 364 /*! Reserved class ID for internal use */ 365 #define BCMINT_FLOW_CLASS_ID_RESERVED (0x0) 366 367 /*! Reserved virtual port for internal use */ 368 #define BCMINT_FLOW_VP_RESERVED (0x0) 369 370 /*! Reserved VFI for internal use */ 371 #define BCMINT_FLOW_VFI_RESERVED (0x0) 372 373 /*! Reserved L3 ingress interface for internal use */ 374 #define BCMINT_FLOW_L3_IIF_RESERVED (0x0) 375 376 /*! Reserved egress tunnel index for internal use */ 377 #define BCMINT_FLOW_EGR_TUNNEL_RESERVED (0x0) 378 379 /*! Default VP group for clear operation. */ 380 #define BCMINT_FLOW_VP_GROUP_DEF (0x0) 381 382 /*! Default network VP group for clear operation */ 383 #define BCMINT_FLOW_NETWORK_GROUP_DEF (0x0) 384 385 /*! 386 * \brief Check if given FLOW VPN is valid. 387 * 388 * \param [in] unit Unit Number. 389 * \param [in] vpn VPN ID. 390 * 391 * \retval SHR_E_NONE No errors. 392 * \retval !SHR_E_NONE Failure. 393 */ 394 extern int 395 bcmint_flow_vpn_is_valid( 396 int unit, 397 bcm_vpn_t vpn); 398 399 /*! 400 * \brief Get physical tunnel index based on logical tunnel index. 401 * 402 * \param [in] unit Unit Number. 403 * \param [in] soft_tnl_idx Logical tunnel index. 404 * \param [out] tnl_idx Physical tunnel index. 405 * 406 * \retval SHR_E_NONE No errors. 407 * \retval !SHR_E_NONE Failure. 408 */ 409 extern int 410 bcmint_flow_tunnel_idx_get( 411 int unit, 412 uint32_t soft_tnl_idx, 413 uint32_t *tnl_idx); 414 415 /*! 416 * \brief Set physical tunnel index to logical tunnel index mapping. 417 * 418 * \param [in] unit Unit Number. 419 * \param [in] soft_tnl_idx Logical tunnel index. 420 * \param [in] tnl_idx Physical tunnel index. 421 * 422 * \retval SHR_E_NONE No errors. 423 * \retval !SHR_E_NONE Failure. 424 */ 425 extern int 426 bcmint_flow_tunnel_idx_set( 427 int unit, 428 uint32_t soft_tnl_idx, 429 uint32_t tnl_idx); 430 431 /*! 432 * \brief Get physical tunnel index based on logical tunnel index during warmboot. 433 * 434 * \param [in] unit Unit Number. 435 * \param [in] soft_tnl_idx Logical tunnel index. 436 * \param [out] tnl_idx Physical tunnel index. 437 * 438 * \retval SHR_E_NONE No errors. 439 * \retval !SHR_E_NONE Failure. 440 */ 441 extern int 442 bcmint_flow_warmboot_tunnel_idx_get( 443 int unit, 444 uint32_t soft_tnl_idx, 445 uint32_t *tnl_idx); 446 447 /*! 448 * \brief Get logical tunnel index based on physical tunnel index. 449 * 450 * \param [in] unit Unit Number. 451 * \param [in] tnl_idx Physical tunnel index. 452 * \param [out] soft_tnl_idx Logical tunnel index. 453 * 454 * \retval SHR_E_NONE No errors. 455 * \retval !SHR_E_NONE Failure. 456 */ 457 extern int 458 bcmint_flow_tunnel_sw_idx_get( 459 int unit, 460 uint32_t tnl_idx, 461 uint32_t *soft_tnl_idx); 462 463 /*! 464 * \brief Get the LT info with a LT ID. 465 * 466 * \param [in] unit Unit Number. 467 * \param [in] lt_id LT ID. 468 * \param [out] lt_info LT info. 469 * 470 * \retval SHR_E_NONE No errors. 471 * \retval !SHR_E_NONE Failure. 472 */ 473 extern int 474 bcmint_flow_lt_get( 475 int unit, 476 bcmint_flow_lt_id_t lt_id, 477 const bcmint_flow_lt_t **lt_info); 478 479 #endif /* BCMINT_LTSW_FLOW_INT_H */