udf.h (46672B)
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 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_UDF_H__ 14 #define __BCM_UDF_H__ 15 16 #include <bcm/types.h> 17 #include <bcm/field.h> 18 19 /* Options to control UDF allocation */ 20 #define BCM_UDF_CREATE_O_NONE (0) /* Default. */ 21 #define BCM_UDF_CREATE_O_WITHID (1 << 0) /* Use input UDF ID instead 22 of allocating one. */ 23 #define BCM_UDF_CREATE_O_REPLACE (1 << 1) /* Replace/Update existing 24 UDF object. */ 25 #define BCM_UDF_CREATE_O_FLEXHASH (1 << 2) /* UDF allocation will be 26 adjusted for use by flex 27 hashing feature. */ 28 #define BCM_UDF_CREATE_O_FIELD_INGRESS (1 << 3) /* UDF allocation will be 29 adjusted for use by 30 Ingress stage FP. */ 31 #define BCM_UDF_CREATE_O_FIELD_LOOKUP (1 << 4) /* UDF allocation will be 32 adjusted for use by Lookup 33 stage FP. */ 34 #define BCM_UDF_CREATE_O_SHARED_HWID (1 << 5) /* Use same hardware 35 resources as 'shared_udf' */ 36 #define BCM_UDF_CREATE_O_POLICER_GROUP (1 << 6) /* UDF allocation will be 37 adjusted for use by global 38 (service) meter. */ 39 #define BCM_UDF_CREATE_O_UDFHASH (1 << 7) /* UDF allocation will be 40 adjusted for use by udf 41 hashing feature. */ 42 #define BCM_UDF_CREATE_O_RANGE_CHECK (1 << 8) /* UDF allocation will be 43 adjusted for use by Range 44 checker. */ 45 #define BCM_UDF_CREATE_O_FLEX_COUNTER (1 << 9) /* UDF allocation will be 46 adjusted for use by 47 Flexible Counter. */ 48 49 /* UDF Packet Format Options */ 50 #define BCM_UDF_PKT_FORMAT_CREATE_O_NONE 0 /* Default. */ 51 #define BCM_UDF_PKT_FORMAT_CREATE_O_WITHID (1 << 0) /* Create packet format 52 with given ID */ 53 #define BCM_UDF_PKT_FORMAT_CREATE_O_REPLACE (1 << 1) /* Update existing packet 54 format */ 55 56 /* Packet format options */ 57 typedef uint32 bcm_udf_pkt_format_options_t; 58 59 /* Flags to be used with bcm_udf_t.flags */ 60 #define BCM_UDF_F_ADJUST_IP4_OPTIONS (1 << 1) /* Adjust offset accounting 61 IP4 options */ 62 #define BCM_UDF_F_ADJUST_IP6_OPTIONS (1 << 2) /* Adjust offset accounting 63 IP6 Extension Headers */ 64 65 /* Base header the switch can parse. */ 66 typedef enum bcm_udf_layer_e { 67 bcmUdfLayerL2Header = 1, /* Start of L2 header in the Packet */ 68 bcmUdfLayerL3OuterHeader = 2, /* Start of outer L3 header in the packet */ 69 bcmUdfLayerL3InnerHeader = 3, /* Start of inner L3 header in the packet */ 70 bcmUdfLayerL4OuterHeader = 4, /* Start of outer L4 header in the packet */ 71 bcmUdfLayerL4InnerHeader = 5, /* Start of outer L4 header in the packet */ 72 bcmUdfLayerHigigHeader = 6, /* Start of Higig header in the packet */ 73 bcmUdfLayerHigig2Header = 7, /* Start of Higig2 header in the packet */ 74 bcmUdfLayerTunnelHeader = 8, /* Start of outermost tunnel header in the 75 Packet */ 76 bcmUdfLayerTunnelPayload = 9, /* Start of outermost tunnel payload in the 77 Packet */ 78 bcmUdfLayerUserPayload = 10, /* Start of application payload in the 79 Packet. */ 80 bcmUdfLayerCount /* Unused. Always last in the list */ 81 } bcm_udf_layer_t; 82 83 #define BCM_UDF_LAYER \ 84 { \ 85 "L2Header", \ 86 "L3OuterHeader", \ 87 "L3InnerHeader", \ 88 "L4OuterHeader", \ 89 "L4InnerHeader", \ 90 "HigigHeader", \ 91 "Higig2Header", \ 92 "TunnelHeader", \ 93 "TunnelPayload", \ 94 "UserPayload" \ 95 } 96 97 /* UDF structure. */ 98 typedef struct bcm_udf_s { 99 uint32 flags; /* See BCM_UDF_F_XXX */ 100 bcm_udf_layer_t layer; /* UDF base offset. bcmUdfLayerXxx */ 101 int start; /* Relative offset in bits (from the 'layer') in the 102 packet */ 103 uint32 width; /* width of data in bits to extract */ 104 bcm_pbmp_t ports; /* ports (must belong to a single pipe) associate 105 with the udf_offset: used only in PipeLocal 106 operation supported devices */ 107 } bcm_udf_t; 108 109 /* UDF allocation hints. */ 110 typedef struct bcm_udf_alloc_hints_s { 111 uint32 flags; /* See BCM_UDF_CREATE_O_xxx */ 112 bcm_udf_id_t shared_udf; /* Used when BCM_UDF_CREATE_O_SHARED_HWID is set */ 113 bcm_field_qset_t qset; /* Field group qset for optimal H/W resource 114 allocation */ 115 } bcm_udf_alloc_hints_t; 116 117 /* Packet format based UDF specification structure. */ 118 typedef struct bcm_udf_pkt_format_info_s { 119 int prio; /* Priority of the UDF */ 120 bcm_ethertype_t ethertype; /* Ethertype in the packet */ 121 bcm_ethertype_t ethertype_mask; /* Ethertype Mask */ 122 uint8 ip_protocol; /* IP protocol field in the packet */ 123 uint8 ip_protocol_mask; /* IP protocol Mask */ 124 uint16 l2; /* L2 packet format. 125 (BCM_PKT_FORMAT_L2_XXX) */ 126 uint16 vlan_tag; /* Vlan tag format. 127 (BCM_PKT_FORMAT_VLAN_XXX) */ 128 uint16 outer_ip; /* Outer IP header type. 129 (BCM_PKT_FORMAT_IP_XXX) */ 130 uint16 inner_ip; /* Inner IP header type. 131 (BCM_PKT_FORMAT_IP_XXX) */ 132 uint16 tunnel; /* Tunnel type. 133 (BCM_PKT_FORMAT_TUNNEL_XXX) */ 134 uint16 mpls; /* Mpls labels. 135 (BCM_PKT_FORMAT_MPLS_XXX) */ 136 uint16 fibre_chan_outer; /* Fibre Channel outer header type. 137 (BCM_PKT_FORMAT_FIBRE_CHAN_XXX) */ 138 uint16 fibre_chan_inner; /* Fibre Channel inner header 139 type.(BCM_PKT_FORMAT_FIBRE_CHAN_XXX) */ 140 uint16 higig; /* HIGIG packet 141 format.(BCM_PKT_FORMAT_HIGIG_XXX) */ 142 uint16 vntag; /* NIV packet 143 format.(BCM_PKT_FORMAT_VNTAG_XXX) */ 144 uint16 etag; /* Extender tag packet 145 format.(BCM_PKT_FORMAT_ETAG_XXX) */ 146 uint16 cntag; /* CNTAG packet 147 format.(BCM_PKT_FORMAT_CNTAG_XXX) */ 148 uint16 icnm; /* ICNM packet 149 format.(BCM_PKT_FORMAT_ICNM_XXX) */ 150 uint16 subport_tag; /* SUBPORT_TAG packet format. 151 (BCM_PKT_FORMAT_SUBPORT_TAG_XXX) */ 152 int class_id; /* id used by the IFP Key Selection 153 Mechanism. Range 0~255 */ 154 uint16 inner_protocol; /* Inner protocol field in the packet. 155 Inner_ip should be set to 156 BCM_PKT_FORMAT_IP_NONE to make this 157 take effect. IP-IN-IP type GRE should 158 take original API sequence. */ 159 uint16 inner_protocol_mask; /* Inner protocol mask. */ 160 uint32 l4_dst_port; /* TCP or UDP Destination Port number. */ 161 uint32 l4_dst_port_mask; /* TCP or UDP Destination Port number 162 mask. */ 163 uint8 opaque_tag_type; /* Tag type field in the opaque tag. */ 164 uint8 opaque_tag_type_mask; /* Mask for tag type field in the opaque 165 tag. */ 166 uint8 int_pkt; /* Inband Telemetry packet indicator. */ 167 uint8 src_port; /* Logical Source Port number. */ 168 uint8 src_port_mask; /* Logical Source Port number mask. */ 169 uint8 lb_pkt_type; /* Loopback Packet Type. 170 (BCM_PKT_FORMAT_LB_TYPE_XXX) */ 171 uint16 first_2bytes_after_mpls_bos; /* First 2 bytes after BOS in an mpls 172 packet. */ 173 uint16 first_2bytes_after_mpls_bos_mask; /* Mask for first 2 bytes after BOS in 174 an mpls packet. */ 175 } bcm_udf_pkt_format_info_t; 176 177 /* Maxmium bytes of UDF Hash */ 178 #define BCM_UDF_HASH_MAX_LENGTH 4 179 180 /* UDF hashing configuration. */ 181 typedef struct bcm_udf_hash_config_s { 182 uint32 flags; /* Reserved for future usage. Must be 183 zero today. */ 184 bcm_udf_id_t udf_id; /* UDF object id */ 185 int mask_length; /* Length of mask bytes. Must equal to 186 the width of the UDF object. */ 187 uint8 hash_mask[BCM_UDF_HASH_MAX_LENGTH]; /* Array of mask fields. Index 0 is MSB 188 of mask. */ 189 } bcm_udf_hash_config_t; 190 191 /* UDF hashing engine selection. */ 192 #define BCM_UDF_HASH_CONFIG_ENGINE_0 0x00000001 /* UDF is used by hash engine 193 0. */ 194 #define BCM_UDF_HASH_CONFIG_ENGINE_1 0x00000002 /* UDF is used by hash engine 195 1. */ 196 197 /* Options to control UDF hashing adding. */ 198 #define BCM_UDF_HASH_ADD_O_NONE 0 /* Default, add new entry to 199 list. */ 200 #define BCM_UDF_HASH_ADD_O_REPLACE (1 << 0) /* Modify the entry which is 201 already in list */ 202 203 /* Initializes the UDF structure */ 204 extern void bcm_udf_t_init( 205 bcm_udf_t *udf_info); 206 207 /* Initializes the UDF alloc hints structure */ 208 extern void bcm_udf_alloc_hints_t_init( 209 bcm_udf_alloc_hints_t *udf_hints); 210 211 /* Initialize the UDF packet format structure */ 212 extern void bcm_udf_pkt_format_info_t_init( 213 bcm_udf_pkt_format_info_t *pkt_format); 214 215 /* Initialize UDF hashing configuration structure. */ 216 extern void bcm_udf_hash_config_t_init( 217 bcm_udf_hash_config_t *info); 218 219 #ifndef BCM_HIDE_DISPATCHABLE 220 221 /* Initialize UDF module */ 222 extern int bcm_udf_init( 223 int unit); 224 225 /* Detach UDF module */ 226 extern int bcm_udf_detach( 227 int unit); 228 229 /* Creates a UDF object */ 230 extern int bcm_udf_create( 231 int unit, 232 bcm_udf_alloc_hints_t *hints, 233 bcm_udf_t *udf_info, 234 bcm_udf_id_t *udf_id); 235 236 /* Fetches the UDF object created in the system */ 237 extern int bcm_udf_get( 238 int unit, 239 bcm_udf_id_t udf_id, 240 bcm_udf_t *udf_info); 241 242 /* Fetches all existing UDF ids */ 243 extern int bcm_udf_get_all( 244 int unit, 245 int max, 246 bcm_udf_id_t *udf_id_list, 247 int *actual); 248 249 /* Destroys the UDF object */ 250 extern int bcm_udf_destroy( 251 int unit, 252 bcm_udf_id_t udf_id); 253 254 /* Create a packet format entry */ 255 extern int bcm_udf_pkt_format_create( 256 int unit, 257 bcm_udf_pkt_format_options_t options, 258 bcm_udf_pkt_format_info_t *pkt_format, 259 bcm_udf_pkt_format_id_t *pkt_format_id); 260 261 /* Retrieve packet format info given the packet format Id */ 262 extern int bcm_udf_pkt_format_info_get( 263 int unit, 264 bcm_udf_pkt_format_id_t pkt_format_id, 265 bcm_udf_pkt_format_info_t *pkt_format); 266 267 /* Destroy existing packet format entry */ 268 extern int bcm_udf_pkt_format_destroy( 269 int unit, 270 bcm_udf_pkt_format_id_t pkt_format_id); 271 272 /* Adds packet format entry to UDF object */ 273 extern int bcm_udf_pkt_format_add( 274 int unit, 275 bcm_udf_id_t udf_id, 276 bcm_udf_pkt_format_id_t pkt_format_id); 277 278 /* Deletes packet format spec associated with the UDF */ 279 extern int bcm_udf_pkt_format_get( 280 int unit, 281 bcm_udf_pkt_format_id_t pkt_format_id, 282 int max, 283 bcm_udf_id_t *udf_id_list, 284 int *actual); 285 286 /* Deletes packet format spec associated with the UDF */ 287 extern int bcm_udf_pkt_format_delete( 288 int unit, 289 bcm_udf_id_t udf_id, 290 bcm_udf_pkt_format_id_t pkt_format_id); 291 292 /* Retrieves the user defined format specification configuration from UDF */ 293 extern int bcm_udf_pkt_format_get_all( 294 int unit, 295 bcm_udf_id_t udf_id, 296 int max, 297 bcm_udf_pkt_format_id_t *pkt_format_id_list, 298 int *actual); 299 300 /* Deletes all packet format specs associated with the UDF */ 301 extern int bcm_udf_pkt_format_delete_all( 302 int unit, 303 bcm_udf_id_t udf_id); 304 305 /* Add UDF id into hashing list and configure it. */ 306 extern int bcm_udf_hash_config_add( 307 int unit, 308 uint32 options, 309 bcm_udf_hash_config_t *config); 310 311 /* Delete UDF id from hashing list. */ 312 extern int bcm_udf_hash_config_delete( 313 int unit, 314 bcm_udf_hash_config_t *config); 315 316 /* Delete all UDF id from hashing list. */ 317 extern int bcm_udf_hash_config_delete_all( 318 int unit); 319 320 /* Get UDF hashing configuration of a certain id. */ 321 extern int bcm_udf_hash_config_get( 322 int unit, 323 bcm_udf_hash_config_t *config); 324 325 /* Get all added UDF ids from list. */ 326 extern int bcm_udf_hash_config_get_all( 327 int unit, 328 int max, 329 bcm_udf_hash_config_t *config_list, 330 int *actual); 331 332 #endif /* BCM_HIDE_DISPATCHABLE */ 333 334 /* 335 * List of UDF operational modes supported: used only in PipeLocal 336 * operation supported devices 337 */ 338 typedef enum bcm_udf_oper_mode_e { 339 bcmUdfOperModeGlobal = 0, /* UDF Operational Global Mode Value. */ 340 bcmUdfOperModePipeLocal = 1, /* UDF Operational Pipe Local Mode Value. */ 341 bcmUdfOperModeCount = 2 /* Always last. Not a usable value. */ 342 } bcm_udf_oper_mode_t; 343 344 #define BCM_UDF_OPER_MODE_STRINGS \ 345 { \ 346 "Global", \ 347 "PipeLocal" \ 348 } 349 350 #ifndef BCM_HIDE_DISPATCHABLE 351 352 /* 353 * Configure udf operation mode: used only in PipeLocal operation 354 * supported devices 355 */ 356 extern int bcm_udf_oper_mode_set( 357 int unit, 358 bcm_udf_oper_mode_t mode); 359 360 /* 361 * Retrieves current udf operation mode: used only in PipeLocal operation 362 * supported devices 363 */ 364 extern int bcm_udf_oper_mode_get( 365 int unit, 366 bcm_udf_oper_mode_t *mode); 367 368 #endif /* BCM_HIDE_DISPATCHABLE */ 369 370 /* Base header the switch can parse. */ 371 typedef enum bcm_udf_abstract_pkt_format_e { 372 bcmUdfAbstractPktFormatLlc = 0, /* Abstract from the start of first byte 373 of LLC Header. */ 374 bcmUdfAbstractPktFormatInnerLlc = 1, /* Abstract from the start of Inner 375 header's first byte of LLC Header. */ 376 bcmUdfAbstractPktFormatUnknownL3 = 2, /* Abstract from the start of first byte 377 after unknown ethertype. */ 378 bcmUdfAbstractPktFormatInnerUnknownL3 = 3, /* Abstract from the start of inner 379 header's first byte after unknown 380 ethertype. */ 381 bcmUdfAbstractPktFormatKnownNonIp = 4, /* Abstract from the start of first byte 382 after Known non-ip ethertype (other 383 than Known IPv4/6 and FcoE/Mim/MPLS 384 tunnels). */ 385 bcmUdfAbstractPktFormatInnerKnownNonIp = 5, /* Abstract from the start of Inner 386 header's first byte after Known 387 non-ip ethertype (other than Known 388 IPv4/6 and FcoE/Mim/MPLS tunnels). */ 389 bcmUdfAbstractPktFormatKnownL3Mim = 6, /* Abstract from the start of MiM 390 Header. */ 391 bcmUdfAbstractPktFormatKnownL3FcoeStdEncap = 7, /* Abstract from the start of FcoE with 392 Standard or Encapsulation Header. */ 393 bcmUdfAbstractPktFormatKnownL3FcoeVftIfr = 8, /* Abstract from the start of FcoE with 394 Virtual Fabric Tag (VFT) or Inter 395 Fabric Routing (IFR) Header. */ 396 bcmUdfAbstractPktFormatKnownL3MplsOneLabel = 9, /* Abstract from the start of MPLS 397 Header with one label. */ 398 bcmUdfAbstractPktFormatKnownL3MplsTwoLabel = 10, /* Abstract from the start of MPLS 399 Header with two labels. */ 400 bcmUdfAbstractPktFormatKnownL3MplsThreeLabel = 11, /* Abstract from the start of MPLS 401 Header with three labels. */ 402 bcmUdfAbstractPktFormatKnownL3MplsFourLabel = 12, /* Abstract from the start of MPLS 403 Header with four labels. */ 404 bcmUdfAbstractPktFormatKnownL3MplsMoreThanFourLabel = 13, /* Abstract from the start of MPLS 405 Header with more than four labels. */ 406 bcmUdfAbstractPktFormatUnknownL4 = 14, /* Abstract from the start of first byte 407 of unknown L4 Header. */ 408 bcmUdfAbstractPktFormatInnerUnknownL4 = 15, /* Abstract from the start of Inner 409 header's first byte of unknown L4 410 Header. */ 411 bcmUdfAbstractPktFormatUdpUnknownL5 = 16, /* Abstract from the start of first byte 412 of unknown L5 after UDP Header. */ 413 bcmUdfAbstractPktFormatInnerUdpUnknownL5 = 17, /* Abstract from the start of Inner 414 header's first byte of unknown L5 415 after UDP Header. */ 416 bcmUdfAbstractPktFormatUdpGpeGeneve = 18, /* Abstract from the start of first byte 417 of known L5 Geneve header after UDP. */ 418 bcmUdfAbstractPktFormatUdpBfd = 19, /* Abstract from the start of first byte 419 of known L5 BFD header after UDP. */ 420 bcmUdfAbstractPktFormatInnerUdpBfd = 20, /* Abstract from the start of Inner 421 header's first byte of known L5 BFD 422 header after UDP. */ 423 bcmUdfAbstractPktFormatUdpVxlan = 21, /* Abstract from the start of first byte 424 of known L5 VXLAN header after UDP. */ 425 bcmUdfAbstractPktFormatUdp1588 = 22, /* Abstract from the start of first byte 426 of known L5 1588 header after UDP. */ 427 bcmUdfAbstractPktFormatTcpUnknownL5 = 23, /* Abstract from the start of first byte 428 of unknown L5 header after TCP. */ 429 bcmUdfAbstractPktFormatInnerTcpUnknownL5 = 24, /* Abstract from the start of Inner 430 header's first byte of unknown L5 431 header after TCP. */ 432 bcmUdfAbstractPktFormatSctpUnknownL5 = 25, /* Abstract from the start of first byte 433 of unknown L5 header after SCTP. */ 434 bcmUdfAbstractPktFormatInnerSctpUnknownL5 = 26, /* Abstract from the start of Inner 435 header's first byte of unknown L5 436 header after SCTP. */ 437 bcmUdfAbstractPktFormatGreWithoutKey = 27, /* Abstract from the start of first byte 438 of L4 header for GRE packets without 439 key flag set (C=0/1, R=0/1 and K=0). */ 440 bcmUdfAbstractPktFormatGreWithKey = 28, /* Abstract from the start of first byte 441 of L4 header for GRE packets with key 442 flag set (C=1, R=0/1 and K=1). */ 443 bcmUdfAbstractPktFormatGreWithoutChecksumRouting = 29, /* Abstract from the start of first byte 444 of L4 header for GRE packets (with 445 flags C=0, R=0 and K=1). */ 446 bcmUdfAbstractPktFormatL2GreWithoutChecksumRouting = 30, /* Abstract from the start of first byte 447 of L4 header for L2-GRE packets (with 448 flags C=0, R=0, K=1). */ 449 bcmUdfAbstractPktFormatL2GreWithoutRouting = 31, /* Abstract from the start of first byte 450 of L4 header for L2-GRE packets (with 451 flags R=0, C=1, K=1). */ 452 bcmUdfAbstractPktFormatAchNonIp = 32, /* Abstract from the start of ACH Header 453 for a NonIp packet. */ 454 bcmUdfAbstractPktFormatUdpINT = 33, /* Abstract from the start of first byte 455 of UDP header to match on port based 456 INT (Inband-Telemetry) header 457 payload. */ 458 bcmUdfAbstractPktFormatTcpUnknownL5WithIpExtnHdr = 34, /* Abstract from the start of first byte 459 of TCP header for unknown L5 packet. */ 460 bcmUdfAbstractPktFormatL3GreUnknownPayload = 35, /* Abstract from the start of first byte 461 of L3 GRE header for unknown GRE type 462 packets. */ 463 bcmUdfAbstractPktFormatGreWithKeyRouting = 36, /* Abstract from the start of first byte 464 of L4 header for GRE packets (with 465 key and routing flag set K=1, R=1, 466 C=0/1). */ 467 bcmUdfAbstractPktFormatL2GreWithKeyRouting = 37, /* Abstract from the start of first byte 468 of L4 header for L2-GRE packets (with 469 flags K=1, R=1, C=0/1). */ 470 bcmUdfAbstractPktFormatInnerUdp1588 = 38, /* Abstract from the start of Inner 471 header's first byte of known L5 1588 472 header after UDP. */ 473 bcmUdfAbstractPktFormatTcpINT = 39, /* Abstract from the start of first byte 474 of TCP header to match on INT 475 (Inband-Telemetry) header payload. */ 476 bcmUdfAbstractPktFormatKnownL3FcoeUnknownRctl = 40, /* Abstract from the start of FcoE with 477 Unknown R_CTL. */ 478 bcmUdfAbstractPktFormatHiGigPpd0 = 41, /* Abstract from the start of HiGig 479 System Header. */ 480 bcmUdfAbstractPktFormatHiGigPpd0EHType0 = 42, /* Abstract from the start of HiGig 481 System Header. */ 482 bcmUdfAbstractPktFormatHiGigPpd0EHType1 = 43, /* Abstract from the start of HiGig 483 System Header. */ 484 bcmUdfAbstractPktFormatHiGigPpd0EHType2 = 44, /* Abstract from the start of HiGig 485 System Header. */ 486 bcmUdfAbstractPktFormatHiGigPpd2 = 45, /* Abstract from the start of HiGig 487 System Header. */ 488 bcmUdfAbstractPktFormatHiGigPpd2EHType0 = 46, /* Abstract from the start of HiGig 489 System Header. */ 490 bcmUdfAbstractPktFormatHiGigPpd2EHType1 = 47, /* Abstract from the start of HiGig 491 System Header. */ 492 bcmUdfAbstractPktFormatHiGigPpd2EHType2 = 48, /* Abstract from the start of HiGig 493 System Header. */ 494 bcmUdfAbstractPktFormatGpeIOAM = 49, /* Abstract from the start of GPE IOAM. */ 495 bcmUdfAbstractPktFormatKnownMplsMcast = 50, /* Abstract from the start of MPLS 496 Multicast header. */ 497 bcmUdfAbstractPktFormatLoopbackHdrType0 = 51, /* Abstract from the start of Loopback 498 Type 0 System Header. */ 499 bcmUdfAbstractPktFormatLoopbackHdrType1 = 52, /* Abstract from the start of Loopback 500 Type 1 System Header. */ 501 bcmUdfAbstractPktFormatL3Ipv4Fragmented = 53, /* Abstract from the start of L3 for 502 IPv4 Fragmented packets (that is, 503 non-zero fragmented offset) without 504 IP options. */ 505 bcmUdfAbstractPktFormatL3Ipv4FragmentedWithOptions = 54, /* Abstract from the start of L3 for 506 IPv4 Fragmented packets with IP 507 options (that is, non-zero fragmented 508 offset). */ 509 bcmUdfAbstractPktFormatL3Ipv4WithoutOptions = 55, /* Abstract from the start of L3 for 510 IPv4 packets without IP options. */ 511 bcmUdfAbstractPktFormatL3Ipv4WithOptions = 56, /* Abstract from the start of L3 for 512 IPv4 packets with IP options. */ 513 bcmUdfAbstractPktFormatL3Ipv6 = 57, /* Abstract from the start of L3 for 514 IPv6 packet. */ 515 bcmUdfAbstractPktFormatL2 = 58, /* Abstract from the start of first byte 516 of L2 header. */ 517 bcmUdfAbstractPktFormatL2Untagged = 59, /* Abstract from the start of 14 bytes 518 after L2 header without VLAN tag. */ 519 bcmUdfAbstractPktFormatL2OuterVlanTag = 60, /* Abstract from the start of 14 bytes 520 after L2 header with single outer 521 VLAN tag. */ 522 bcmUdfAbstractPktFormatL2InnerVlanTag = 61, /* Abstract from the start of 14 bytes 523 after L2 header with single inner 524 VLAN tag. */ 525 bcmUdfAbstractPktFormatL2DoubleVlanTag = 62, /* Abstract from the start of 14 bytes 526 after L2 header with double VLAN tag. */ 527 bcmUdfAbstractPktFormatL2GbpTag = 63, /* Abstract from the start of 14 bytes 528 after L2 header with GBP tag (without 529 VLAN tag). */ 530 bcmUdfAbstractPktFormatL2OuterVlanWithGbpTag = 64, /* Abstract from the start of 14 bytes 531 after L2 header with single outer 532 vlan and GBP tags. */ 533 bcmUdfAbstractPktFormatL2InnerVlanWithGbpTag = 65, /* Abstract from the start of 14 bytes 534 after L2 header with single inner 535 vlan and GBP tags. */ 536 bcmUdfAbstractPktFormatL2DoubleVlanWithGbpTag = 66, /* Abstract from the start of 14 bytes 537 after L2 header with double vlan and 538 GBP tag. */ 539 bcmUdfAbstractPktFormatL2Vntag = 67, /* Abstract from the start of 14 bytes 540 after L2 header with VNTAG (without 541 vlan tag). */ 542 bcmUdfAbstractPktFormatL2OuterVlanWithVntag = 68, /* Abstract from the start of 14 bytes 543 after L2 header with single outer 544 vlan tag and VNTAG. */ 545 bcmUdfAbstractPktFormatL2InnerVlanWithVntag = 69, /* Abstract from the start of 14 bytes 546 after L2 header with single inner 547 vlan tag and VNTAG. */ 548 bcmUdfAbstractPktFormatL2DoubleVlanWithVntag = 70, /* Abstract from the start of 14 bytes 549 after L2 header with double vlan tag 550 and VNTAG. */ 551 bcmUdfAbstractPktFormatL2Etag = 71, /* Abstract from the start of 14 bytes 552 after L2 header with ETAG (without 553 vlan tag). */ 554 bcmUdfAbstractPktFormatL2OuterVlanEtag = 72, /* Abstract from the start of 14 bytes 555 after L2 header with single outer 556 vlan tag and ETAG. */ 557 bcmUdfAbstractPktFormatL2InnerVlanEtag = 73, /* Abstract from the start of 14 bytes 558 after L2 header with single inner 559 vlan tag and ETAG. */ 560 bcmUdfAbstractPktFormatL2DoubleVlanEtag = 74, /* Abstract from the start of 14 bytes 561 after L2 header with double vlan tag 562 and ETAG. */ 563 bcmUdfAbstractPktFormatInnerL3Ipv4 = 75, /* Abstract from the start of Inner 564 header's first byte of L3 IPv4 565 header. */ 566 bcmUdfAbstractPktFormatInnerL3Ipv4Fragmented = 76, /* Abstract from the start of Inner 567 header's first byte of L3 IPv4 header 568 with non-zero fragment offset. */ 569 bcmUdfAbstractPktFormatInnerL3Ipv6 = 77, /* Abstract from the start of Inner L3 570 header's first byte of L3 IPv6 571 header. */ 572 bcmUdfAbstractPktFormatInnerL2Untagged = 78, /* Abstract from the start of 12 bytes 573 after Inner L2 header with no VLAN 574 tag. */ 575 bcmUdfAbstractPktFormatInnerL2OuterVlanTag = 79, /* Abstract from the start of 12 bytes 576 after Inner L2 header with no VLAN 577 tag. */ 578 bcmUdfAbstractPktFormatInnerL2InnerVlanTag = 80, /* Abstract from the start of 12 bytes 579 after Inner L2 header with single 580 outer VLAN tag. */ 581 bcmUdfAbstractPktFormatInnerL2DoubleVlanTag = 81, /* Abstract from the start of 12 bytes 582 after Inner L2 header with single 583 inner VLAN tag. */ 584 bcmUdfAbstractPktFormatInnerL2GbpTag = 82, /* Abstract from the start of 12 bytes 585 after Inner L2 header with GBP tag 586 (without VLAN tag). */ 587 bcmUdfAbstractPktFormatInnerL2OuterVlanWithGbpTag = 83, /* Abstract from the start of 12 bytes 588 after Inner L2 header with single 589 outer vlan and GBP tags. */ 590 bcmUdfAbstractPktFormatInnerL2InnerVlanWithGbpTag = 84, /* Abstract from the start of 12 bytes 591 after Inner L2 header with single 592 inner vlan and GBP tags. */ 593 bcmUdfAbstractPktFormatInnerL2DoubleVlanWithGbpTag = 85, /* Abstract from the start of 12 bytes 594 after Inner L2 header with double 595 vlan and GBP tags. */ 596 bcmUdfAbstractPktFormatUnknownL3CustomEtherType1 = 86, /* Abstract from the start of first byte 597 of L3 with unknown custom ethertype 598 1. */ 599 bcmUdfAbstractPktFormatUnknownL3CustomEtherType2 = 87, /* Abstract from the start of first byte 600 of L3 with unknown custom ethertype 601 2. */ 602 bcmUdfAbstractPktFormatUnknownL3CustomIpProtocol1 = 88, /* Abstract from the start of first byte 603 of L4 with unknown custom IP Protocol 604 1. */ 605 bcmUdfAbstractPktFormatUnknownL3CustomIpProtocol2 = 89, /* Abstract from the start of first byte 606 of L4 with unknown custom IP Protocol 607 2. */ 608 bcmUdfAbstractPktFormatUnknownL3CustomUdpDstPort1 = 90, /* Abstract from the start of first byte 609 of L4 with unknown custom UDP 610 destination port 1. */ 611 bcmUdfAbstractPktFormatUnknownL3CustomUdpDstPort2 = 91, /* Abstract from the start of first byte 612 of L4 with unknown custom UDP 613 destination port 2. */ 614 bcmUdfAbstractPktFormatInnerUnknownL3CustomEtherType1 = 92, /* Abstract from the start of first byte 615 of Inner L3 with unknown custom 616 ethertype 1. */ 617 bcmUdfAbstractPktFormatInnerUnknownL3CustomEtherType2 = 93, /* Abstract from the start of first byte 618 of Inner L3 with unknown custom 619 ethertype 2. */ 620 bcmUdfAbstractPktFormatInnerUnknownL3CustomIpProtocol1 = 94, /* Abstract from the start of first byte 621 of Inner L4 with unknown custom IP 622 Protocol 1. */ 623 bcmUdfAbstractPktFormatInnerUnknownL3CustomIpProtocol2 = 95, /* Abstract from the start of first byte 624 of Inner L4 with unknown custom IP 625 Protocol 2. */ 626 bcmUdfAbstractPktFormatInnerUnknownL3CustomUdpDstPort1 = 96, /* Abstract from the start of first byte 627 of Inner L4 with unknown custom UDP 628 destination port 1. */ 629 bcmUdfAbstractPktFormatInnerUnknownL3CustomUdpDstPort2 = 97, /* Abstract from the start of first byte 630 of Inner L4 with unknown custom UDP 631 destination port 2. */ 632 bcmUdfAbstractPktFormatUdpProbeBasedINT = 98, /* Abstract from the start of first byte 633 of UDP header to match on probe based 634 INT (Inband-Telemetry) header 635 payload. */ 636 bcmUdfAbstractPktFormatLastCount = 99 /* Unused. Always last in the list */ 637 } bcm_udf_abstract_pkt_format_t; 638 639 #define BCM_UDF_ABSTRACT_PKT_FORMAT \ 640 { \ 641 "Llc", \ 642 "InnerLlc", \ 643 "UnknownL3", \ 644 "InnerUnknownL3", \ 645 "KnownNonIp", \ 646 "InnerKnownNonIp", \ 647 "KnownL3Mim", \ 648 "KnownL3FcoeStdEncap", \ 649 "KnownL3FcoeVftIfr", \ 650 "KnownL3MplsOneLabel", \ 651 "KnownL3MplsTwoLabel", \ 652 "KnownL3MplsThreeLabel", \ 653 "KnownL3MplsFourLabel", \ 654 "KnownL3MplsMoreThanFourLabel", \ 655 "UnknownL4", \ 656 "InnerUnknownL4", \ 657 "UdpUnknownL5", \ 658 "InnerUdpUnknownL5", \ 659 "UdpGpeGeneve", \ 660 "UdpBfd", \ 661 "InnerUdpBfd", \ 662 "UdpVxlan", \ 663 "Udp1588", \ 664 "TcpUnknownL5", \ 665 "InnerTcpUnknownL5", \ 666 "SctpUnknownL5", \ 667 "InnerSctpUnknownL5", \ 668 "GreWithoutKey", \ 669 "GreWithKey", \ 670 "GreWithoutChecksumRouting", \ 671 "L2GreWithoutChecksumRouting", \ 672 "L2GreWithoutRouting", \ 673 "AchNonIp", \ 674 "UdpINT", \ 675 "TcpUnknownL5WithIpExtnHdr", \ 676 "L3GreUnknownPayload", \ 677 "GreWithKeyRouting", \ 678 "L2GreWithKeyRouting", \ 679 "InnerUdp1588", \ 680 "TcpINT", \ 681 "KnownL3FcoeUnknownRctl", \ 682 "HiGigPpd0", \ 683 "HiGigPpd0EHType0", \ 684 "HiGigPpd0EHType1", \ 685 "HiGigPpd0EHType2", \ 686 "HiGigPpd2", \ 687 "HiGigPpd2EHType0", \ 688 "HiGigPpd2EHType1", \ 689 "HiGigPpd2EHType2", \ 690 "GpeIOAM", \ 691 "KnownMplsMcast", \ 692 "LoopbackHdrType0", \ 693 "LoopbackHdrType1", \ 694 "L3Ipv4Fragmented", \ 695 "L3Ipv4FragmentedWithOptions", \ 696 "L3Ipv4WithoutOptions", \ 697 "L3Ipv4WithOptions", \ 698 "L3Ipv6", \ 699 "L2", \ 700 "L2Untagged", \ 701 "L2OuterVlanTag", \ 702 "L2InnerVlanTag", \ 703 "L2DoubleVlanTag", \ 704 "L2GbpTag", \ 705 "L2OuterVlanWithGbpTag", \ 706 "L2InnerVlanWithGbpTag", \ 707 "L2DoubleVlanWithGbpTag", \ 708 "L2Vntag", \ 709 "L2OuterVlanWithVntag", \ 710 "L2InnerVlanWithVntag", \ 711 "L2DoubleVlanWithVntag", \ 712 "L2Etag", \ 713 "L2OuterVlanEtag", \ 714 "L2InnerVlanEtag", \ 715 "L2DoubleVlanEtag", \ 716 "InnerL3Ipv4", \ 717 "InnerL3Ipv4Fragmented", \ 718 "InnerL3Ipv6", \ 719 "InnerL2Untagged", \ 720 "InnerL2OuterVlanTag", \ 721 "InnerL2InnerVlanTag", \ 722 "InnerL2DoubleVlanTag", \ 723 "InnerL2GbpTag", \ 724 "InnerL2OuterVlanWithGbpTag", \ 725 "InnerL2InnerVlanWithGbpTag", \ 726 "InnerL2DoubleVlanWithGbpTag", \ 727 "UnknownL3CustomEtherType1", \ 728 "UnknownL3CustomEtherType2", \ 729 "UnknownL3CustomIpProtocol1", \ 730 "UnknownL3CustomIpProtocol2", \ 731 "UnknownL3CustomUdpDstPort1", \ 732 "UnknownL3CustomUdpDstPort2", \ 733 "InnerUnknownL3CustomEtherType1", \ 734 "InnerUnknownL3CustomEtherType2", \ 735 "InnerUnknownL3CustomIpProtocol1", \ 736 "InnerUnknownL3CustomIpProtocol2", \ 737 "InnerUnknownL3CustomUdpDstPort1", \ 738 "InnerUnknownL3CustomUdpDstPort2", \ 739 "UdpProbeBasedINT" \ 740 } 741 742 /* UDF tunnel term flow types. */ 743 typedef enum bcm_udf_tunnel_term_flow_type_e { 744 bcmUdfTunnelTermFlowTypeMimWithIpPayload = 0, /* MiM with IP Payload. */ 745 bcmUdfTunnelTermFlowTypeMimWithoutIpPayload = 1, /* MiM without IP Payload. */ 746 bcmUdfTunnelTermFlowTypeL2MplsWithIpPayload = 2, /* L2 MPLS with IP Payload. */ 747 bcmUdfTunnelTermFlowTypeL2MplsWithoutIpPayload = 3, /* L2 MPLS without IP Payload. */ 748 bcmUdfTunnelTermFlowTypeL2GreWithIpPayload = 4, /* L2 GRE with IP Payload. */ 749 bcmUdfTunnelTermFlowTypeL2GreWithoutIpPayload = 5, /* L2 GRE without IP Payload. */ 750 bcmUdfTunnelTermFlowTypeVxlanWithIpPayload = 6, /* VxLAN with IP Payload. */ 751 bcmUdfTunnelTermFlowTypeVxlanWithoutIpPayload = 7, /* VxLAN without IP Payload. */ 752 bcmUdfTunnelTermFlowTypeL3Mpls = 8, /* L3 MPLS. */ 753 bcmUdfTunnelTermFlowTypeL3Tunnel = 9, /* L3 Tunnel. */ 754 bcmUdfTunnelTermFlowTypeL3GpeGeneve = 10, /* L3 Gpe Geneve. */ 755 bcmUdfTunnelTermFlowTypeLastCount = 11 /* Unused. Always last in the list */ 756 } bcm_udf_tunnel_term_flow_type_t; 757 758 #define BCM_UDF_TUNNEL_TERM_FLOW_TYPE \ 759 { \ 760 "MimWithIpPayload", \ 761 "MimWithoutIpPayload", \ 762 "L2MplsWithIpPayload", \ 763 "L2MplsWithoutIpPayload", \ 764 "L2GreWithIpPayload", \ 765 "L2GreWithoutIpPayload", \ 766 "VxlanWithIpPayload", \ 767 "VxlanWithoutIpPayload", \ 768 "L3Mpls", \ 769 "L3Tunnel", \ 770 "L3GpeGeneve" \ 771 } 772 773 /* UDF Chunk Information Structure. */ 774 typedef struct bcm_udf_chunk_info_s { 775 int offset; /* Relative offset in bits (Starts from 776 base offset of given abstract packet 777 format) in the packet */ 778 uint32 width; /* width of data in bits to extract */ 779 uint32 chunk_bmap; /* Chunk bitmap (Each bit in the bitmap 780 represents 1 chunk (2 bytes) */ 781 bcm_udf_abstract_pkt_format_t abstract_pkt_format; /* Abstract Packet Format (one of the 782 format from 783 'bcm_udf_abstract_pkt_format_t') */ 784 } bcm_udf_chunk_info_t; 785 786 /* Initializes the UDF Chunk Info structure */ 787 extern void bcm_udf_chunk_info_t_init( 788 bcm_udf_chunk_info_t *udf_chunk_info); 789 790 /* Pkt Base offset. */ 791 typedef enum bcm_udf_pkt_base_offset_e { 792 bcmUdfPktBaseOffsetStartOfOuterL2 = 0, /* Base offset from the start of Outer 793 L2 Header. */ 794 bcmUdfPktBaseOffsetStartOfOuterLlc = 1, /* Base offset from the start of Outer 795 LLC Header. */ 796 bcmUdfPktBaseOffsetStartOfTunnel = 2, /* Base offset from the start of Tunnel 797 Header. */ 798 bcmUdfPktBaseOffsetStartOfOuterL3 = 3, /* Base offset from the start of Outer 799 L3 Header. */ 800 bcmUdfPktBaseOffsetStartOfOuterL4 = 4, /* Base offset from the start of Outer 801 L4 Header. */ 802 bcmUdfPktBaseOffsetStartOfOuterL5 = 5, /* Base offset from the start of Outer 803 L5 Header. */ 804 bcmUdfPktBaseOffsetStartOfInnerL2 = 6, /* Base offset from the start of Inner 805 L2 Header. */ 806 bcmUdfPktBaseOffsetStartOfInnerLlc = 7, /* Base offset from the start of Inner 807 LLC Header. */ 808 bcmUdfPktBaseOffsetStartOfInnerL3 = 8, /* Base offset from the start of Inner 809 L3 Header. */ 810 bcmUdfPktBaseOffsetStartOfInnerL4 = 9, /* Base offset from the start of Inner 811 L4 Header. */ 812 bcmUdfPktBaseOffsetStartOfInnerL5 = 10, /* Base offset from the start of Inner 813 L5 Header. */ 814 bcmUdfPktBaseOffsetStartOfSystemHeader = 11, /* Base offset from the start of system 815 header (HiGig or Loopback). */ 816 bcmUdfPktBaseOffsetStartOf14bytesAfterOuterL2 = 12, /* Base offset from the start of 14 817 bytes after Outer L2 Header. (For 818 example: In-case of L2 Single tagged 819 packet, it is start of 802.1p 820 priority field after TPID.) */ 821 bcmUdfPktBaseOffsetStartOf12bytesAfterInnerL2 = 13, /* Base offset from the start of 12 822 bytes after Outer L2 Header. */ 823 bcmUdfPktBaseOffsetStartOfGpe = 14, /* Base offset from the start of GPE 824 Header. */ 825 bcmUdfPktBaseOffsetLastCount = 15 /* Unused. Always last in the list */ 826 } bcm_udf_pkt_base_offset_t; 827 828 #define BCM_UDF_PKT_BASE_OFFSET \ 829 { \ 830 "StartOfOuterL2", \ 831 "StartOfOuterLlc", \ 832 "StartOfTunnel", \ 833 "StartOfOuterL3", \ 834 "StartOfOuterL4", \ 835 "StartOfOuterL5", \ 836 "StartOfInnerL2", \ 837 "StartOfInnerLlc", \ 838 "StartOfInnerL3", \ 839 "StartOfInnerL4", \ 840 "StartOfInnerL5", \ 841 "StartOfSystemHeader", \ 842 "StartOf14bytesAfterOuterL2", \ 843 "StartOf12bytesAfterInnerL2", \ 844 "StartOfGpe" \ 845 } 846 847 /* UDF Abstract Packet Format Information Structure. */ 848 typedef struct bcm_udf_abstract_pkt_format_info_s { 849 bcm_udf_pkt_base_offset_t base_offset; /* Relative offset of 850 'bcmUdfPktBaseOffsetXX' type (from 851 'bcm_udf_pkt_base_offset_t') */ 852 uint32 num_chunks_max; /* Maximum number of chunks supported by 853 the abstract packet format */ 854 uint32 chunk_bmap_used; /* Bitmap of Chunks already used by the 855 abstract packet format */ 856 uint32 unavail_chunk_bmap; /* Bitmap of Chunks unavailable/reserved */ 857 } bcm_udf_abstract_pkt_format_info_t; 858 859 #ifndef BCM_HIDE_DISPATCHABLE 860 861 /* 862 * API to retrieve Abstract packet format information. To create a UDF 863 * object for a given abstract packet format, user needs to know the 864 * information about the start base offset in the packet header and 865 * number of chunks supported and consumed to extract the UDF fields. 866 */ 867 extern int bcm_udf_abstract_pkt_format_info_get( 868 int unit, 869 bcm_udf_abstract_pkt_format_t abstract_pkt_format, 870 bcm_udf_abstract_pkt_format_info_t *pkt_format_info); 871 872 /* Creates a UDF object */ 873 extern int bcm_udf_chunk_create( 874 int unit, 875 bcm_udf_alloc_hints_t *hints, 876 bcm_udf_chunk_info_t *udf_chunk_info, 877 bcm_udf_id_t *udf_id); 878 879 /* Get a UDF object information. */ 880 extern int bcm_udf_chunk_info_get( 881 int unit, 882 bcm_udf_id_t udf_id, 883 bcm_udf_chunk_info_t *udf_chunk_info); 884 885 /* 886 * Retrieve the list of UDF Objects associated with a given abstract 887 * packet format 888 */ 889 extern int bcm_udf_abstract_pkt_format_object_list_get( 890 int unit, 891 bcm_udf_abstract_pkt_format_t abstract_pkt_format, 892 int max, 893 bcm_udf_id_t *udf_id_list, 894 int *actual); 895 896 /* API to retrieve the chunk information supported for Range Checker. */ 897 extern int bcm_udf_range_checker_chunk_info_get( 898 int unit, 899 uint8 *num_chunks, 900 uint32 *chunk_bmap); 901 902 /* API to assign the chunk bitmaps to the tunnel termination flows. */ 903 extern int bcm_udf_flow_based_chunk_arrange_set( 904 int unit, 905 bcm_udf_tunnel_term_flow_type_t flow_type, 906 uint32 chunk_bmap); 907 908 /* 909 * API to retrieve the chunk bitmaps information for a given tunnel 910 * termination flow. 911 */ 912 extern int bcm_udf_flow_based_chunk_arrange_get( 913 int unit, 914 bcm_udf_tunnel_term_flow_type_t flow_type, 915 uint32 *chunk_bmap); 916 917 #endif /* BCM_HIDE_DISPATCHABLE */ 918 919 #endif /* __BCM_UDF_H__ */