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

udf.h (64739B)


      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_UDF_H__
     11 #define __BCM_UDF_H__
     12 
     13 #include <bcm/types.h>
     14 #include <bcm/field.h>
     15 
     16 /* Options to control UDF allocation */
     17 #define BCM_UDF_CREATE_O_NONE           (0)        /* Default. */
     18 #define BCM_UDF_CREATE_O_WITHID         (1 << 0)   /* Use input UDF ID instead
     19                                                       of allocating one. */
     20 #define BCM_UDF_CREATE_O_REPLACE        (1 << 1)   /* Replace/Update existing
     21                                                       UDF object. */
     22 #define BCM_UDF_CREATE_O_FLEXHASH       (1 << 2)   /* UDF allocation will be
     23                                                       adjusted for use by flex
     24                                                       hashing feature. */
     25 #define BCM_UDF_CREATE_O_FIELD_INGRESS  (1 << 3)   /* UDF allocation will be
     26                                                       adjusted for use by
     27                                                       Ingress stage FP. */
     28 #define BCM_UDF_CREATE_O_FIELD_LOOKUP   (1 << 4)   /* UDF allocation will be
     29                                                       adjusted for use by Lookup
     30                                                       stage FP. */
     31 #define BCM_UDF_CREATE_O_SHARED_HWID    (1 << 5)   /* Use same hardware
     32                                                       resources as 'shared_udf' */
     33 #define BCM_UDF_CREATE_O_POLICER_GROUP  (1 << 6)   /* UDF allocation will be
     34                                                       adjusted for use by global
     35                                                       (service) meter. */
     36 #define BCM_UDF_CREATE_O_UDFHASH        (1 << 7)   /* UDF allocation will be
     37                                                       adjusted for use by udf
     38                                                       hashing feature. */
     39 #define BCM_UDF_CREATE_O_RANGE_CHECK    (1 << 8)   /* UDF allocation will be
     40                                                       adjusted for use by Range
     41                                                       checker. */
     42 #define BCM_UDF_CREATE_O_FLEX_COUNTER   (1 << 9)   /* UDF allocation will be
     43                                                       adjusted for use by
     44                                                       Flexible Counter. */
     45 
     46 /* UDF Packet Format Options */
     47 #define BCM_UDF_PKT_FORMAT_CREATE_O_NONE    0          /* Default. */
     48 #define BCM_UDF_PKT_FORMAT_CREATE_O_WITHID  (1 << 0)   /* Create packet format
     49                                                           with given ID */
     50 #define BCM_UDF_PKT_FORMAT_CREATE_O_REPLACE (1 << 1)   /* Update existing packet
     51                                                           format */
     52 
     53 /* Packet format options */
     54 typedef uint32 bcm_udf_pkt_format_options_t;
     55 
     56 /* Flags to be used with bcm_udf_t.flags */
     57 #define BCM_UDF_F_ADJUST_IP4_OPTIONS    (1 << 1)   /* Adjust offset accounting
     58                                                       IP4 options */
     59 #define BCM_UDF_F_ADJUST_IP6_OPTIONS    (1 << 2)   /* Adjust offset accounting
     60                                                       IP6 Extension Headers */
     61 
     62 /* Base header the switch can parse. */
     63 typedef enum bcm_udf_layer_e {
     64     bcmUdfLayerL2Header = 1,        /* Start of L2 header in the Packet */
     65     bcmUdfLayerL3OuterHeader = 2,   /* Start of outer L3 header in the packet */
     66     bcmUdfLayerL3InnerHeader = 3,   /* Start of inner L3 header in the packet */
     67     bcmUdfLayerL4OuterHeader = 4,   /* Start of outer L4 header in the packet */
     68     bcmUdfLayerL4InnerHeader = 5,   /* Start of outer L4 header in the packet */
     69     bcmUdfLayerHigigHeader = 6,     /* Start of HiGig header in the packet */
     70     bcmUdfLayerHigig2Header = 7,    /* Start of HiGig2 header in the packet */
     71     bcmUdfLayerTunnelHeader = 8,    /* Start of outermost tunnel header in the
     72                                        Packet */
     73     bcmUdfLayerTunnelPayload = 9,   /* Start of outermost tunnel payload in the
     74                                        Packet */
     75     bcmUdfLayerUserPayload = 10,    /* Start of application payload in the
     76                                        Packet. */
     77     bcmUdfLayerCount                /* Unused. Always last in the list */
     78 } bcm_udf_layer_t;
     79 
     80 #define BCM_UDF_LAYER \
     81 { \
     82     "L2Header", \
     83     "L3OuterHeader", \
     84     "L3InnerHeader", \
     85     "L4OuterHeader", \
     86     "L4InnerHeader", \
     87     "HigigHeader", \
     88     "Higig2Header", \
     89     "TunnelHeader", \
     90     "TunnelPayload", \
     91     "UserPayload"  \
     92 }
     93 
     94 /* UDF structure. */
     95 typedef struct bcm_udf_s {
     96     uint32 flags;           /* See BCM_UDF_F_XXX */
     97     bcm_udf_layer_t layer;  /* UDF base offset. bcmUdfLayerXxx */
     98     int start;              /* Relative offset in bits (from the 'layer') in the
     99                                packet */
    100     uint32 width;           /* width of data in bits to extract */
    101     bcm_pbmp_t ports;       /* ports (must belong to a single pipe) associate
    102                                with the udf_offset: used only in PipeLocal
    103                                operation supported devices */
    104 } bcm_udf_t;
    105 
    106 /* UDF allocation hints. */
    107 typedef struct bcm_udf_alloc_hints_s {
    108     uint32 flags;               /* See BCM_UDF_CREATE_O_xxx */
    109     bcm_udf_id_t shared_udf;    /* Used when BCM_UDF_CREATE_O_SHARED_HWID is set */
    110     bcm_field_qset_t qset;      /* Field group qset for optimal H/W resource
    111                                    allocation */
    112 } bcm_udf_alloc_hints_t;
    113 
    114 /* Packet format based UDF specification structure. */
    115 typedef struct bcm_udf_pkt_format_info_s {
    116     int prio;                           /* Priority of the UDF */
    117     bcm_ethertype_t ethertype;          /* EtherType in the packet */
    118     bcm_ethertype_t ethertype_mask;     /* EtherType Mask */
    119     uint8 ip_protocol;                  /* IP protocol field in the packet */
    120     uint8 ip_protocol_mask;             /* IP protocol Mask */
    121     uint16 l2;                          /* L2 packet format.
    122                                            (BCM_PKT_FORMAT_L2_XXX) */
    123     uint16 vlan_tag;                    /* Vlan tag format.
    124                                            (BCM_PKT_FORMAT_VLAN_XXX) */
    125     uint16 outer_ip;                    /* Outer IP header type.
    126                                            (BCM_PKT_FORMAT_IP_XXX) */
    127     uint16 inner_ip;                    /* Inner IP header type.
    128                                            (BCM_PKT_FORMAT_IP_XXX) */
    129     uint16 tunnel;                      /* Tunnel type.
    130                                            (BCM_PKT_FORMAT_TUNNEL_XXX) */
    131     uint16 mpls;                        /* Mpls labels.
    132                                            (BCM_PKT_FORMAT_MPLS_XXX) */
    133     uint16 fibre_chan_outer;            /* Fibre Channel outer header type.
    134                                            (BCM_PKT_FORMAT_FIBRE_CHAN_XXX) */
    135     uint16 fibre_chan_inner;            /* Fibre Channel inner header
    136                                            type.(BCM_PKT_FORMAT_FIBRE_CHAN_XXX) */
    137     uint16 higig;                       /* HIGIG packet
    138                                            format.(BCM_PKT_FORMAT_HIGIG_XXX) */
    139     uint16 vntag;                       /* NIV packet
    140                                            format.(BCM_PKT_FORMAT_VNTAG_XXX) */
    141     uint16 etag;                        /* Extender tag packet
    142                                            format.(BCM_PKT_FORMAT_ETAG_XXX) */
    143     uint16 cntag;                       /* CNTAG packet
    144                                            format.(BCM_PKT_FORMAT_CNTAG_XXX) */
    145     uint16 icnm;                        /* ICNM packet
    146                                            format.(BCM_PKT_FORMAT_ICNM_XXX) */
    147     uint16 subport_tag;                 /* SUBPORT_TAG packet format.
    148                                            (BCM_PKT_FORMAT_SUBPORT_TAG_XXX) */
    149     int class_id;                       /* id used by the IFP Key Selection
    150                                            Mechanism. Range 0~255 */
    151     uint16 inner_protocol;              /* Inner protocol field in the packet.
    152                                            Inner_ip should be set to
    153                                            BCM_PKT_FORMAT_IP_NONE to make this
    154                                            take effect. IP-IN-IP type GRE should
    155                                            take original API sequence. */
    156     uint16 inner_protocol_mask;         /* Inner protocol mask. */
    157     uint32 l4_dst_port;                 /* TCP or UDP Destination Port number. */
    158     uint32 l4_dst_port_mask;            /* TCP or UDP Destination Port number
    159                                            mask. */
    160     uint8 opaque_tag_type;              /* Tag type field in the opaque tag. */
    161     uint8 opaque_tag_type_mask;         /* Mask for tag type field in the opaque
    162                                            tag. */
    163     uint8 int_pkt;                      /* Inband Telemetry packet indicator. */
    164     uint8 src_port;                     /* Logical Source Port number. */
    165     uint8 src_port_mask;                /* Logical Source Port number mask. */
    166     uint8 lb_pkt_type;                  /* Loopback Packet Type.
    167                                            (BCM_PKT_FORMAT_LB_TYPE_XXX) */
    168     uint16 first_2bytes_after_mpls_bos; /* First 2 bytes after BOS in an mpls
    169                                            packet. */
    170     uint16 first_2bytes_after_mpls_bos_mask; /* Mask for first 2 bytes after BOS in
    171                                            an mpls packet. */
    172     uint8 outer_ifa;                    /* Outer IFA header
    173                                            (BCM_PKT_FORMAT_IFA_XXX) */
    174     uint8 inner_ifa;                    /* Inner IFA header
    175                                            (BCM_PKT_FORMAT_IFA_XXX) */
    176 } bcm_udf_pkt_format_info_t;
    177 
    178 /* Maxmium bytes of UDF Hash */
    179 #define BCM_UDF_HASH_MAX_LENGTH 4          
    180 
    181 /* UDF hashing configuration. */
    182 typedef struct bcm_udf_hash_config_s {
    183     uint32 flags;                       /* Reserved for future usage. Must be
    184                                            zero today. */
    185     bcm_udf_id_t udf_id;                /* UDF object id */
    186     int mask_length;                    /* Length of mask bytes. Must equal to
    187                                            the width of the UDF object. */
    188     uint8 hash_mask[BCM_UDF_HASH_MAX_LENGTH]; /* Array of mask fields. Index 0 is MSB
    189                                            of mask. */
    190 } bcm_udf_hash_config_t;
    191 
    192 /* UDF hashing engine selection. */
    193 #define BCM_UDF_HASH_CONFIG_ENGINE_0    0x00000001 /* UDF is used by hash engine
    194                                                       0. */
    195 #define BCM_UDF_HASH_CONFIG_ENGINE_1    0x00000002 /* UDF is used by hash engine
    196                                                       1. */
    197 
    198 /* Options to control UDF hashing adding. */
    199 #define BCM_UDF_HASH_ADD_O_NONE     0          /* Default, add new entry to
    200                                                   list. */
    201 #define BCM_UDF_HASH_ADD_O_REPLACE  (1 << 0)   /* Modify the entry which is
    202                                                   already in list */
    203 
    204 /* Initializes the UDF structure */
    205 extern void bcm_udf_t_init(
    206     bcm_udf_t *udf_info);
    207 
    208 /* Initializes the UDF alloc hints structure */
    209 extern void bcm_udf_alloc_hints_t_init(
    210     bcm_udf_alloc_hints_t *udf_hints);
    211 
    212 /* Initialize the UDF packet format structure */
    213 extern void bcm_udf_pkt_format_info_t_init(
    214     bcm_udf_pkt_format_info_t *pkt_format);
    215 
    216 /* Initialize the UDF hashing configuration structure */
    217 extern void bcm_udf_hash_config_t_init(
    218     bcm_udf_hash_config_t *info);
    219 
    220 #ifndef BCM_HIDE_DISPATCHABLE
    221 
    222 /* Initialize UDF module */
    223 extern int bcm_udf_init(
    224     int unit);
    225 
    226 /* Detach UDF module */
    227 extern int bcm_udf_detach(
    228     int unit);
    229 
    230 /* Creates a UDF object */
    231 extern int bcm_udf_create(
    232     int unit, 
    233     bcm_udf_alloc_hints_t *hints, 
    234     bcm_udf_t *udf_info, 
    235     bcm_udf_id_t *udf_id);
    236 
    237 /* Fetches the UDF object created in the system */
    238 extern int bcm_udf_get(
    239     int unit, 
    240     bcm_udf_id_t udf_id, 
    241     bcm_udf_t *udf_info);
    242 
    243 /* Fetches all existing UDF ids */
    244 extern int bcm_udf_get_all(
    245     int unit, 
    246     int max, 
    247     bcm_udf_id_t *udf_id_list, 
    248     int *actual);
    249 
    250 /* Destroys the UDF object */
    251 extern int bcm_udf_destroy(
    252     int unit, 
    253     bcm_udf_id_t udf_id);
    254 
    255 /* Create a packet format entry */
    256 extern int bcm_udf_pkt_format_create(
    257     int unit, 
    258     bcm_udf_pkt_format_options_t options, 
    259     bcm_udf_pkt_format_info_t *pkt_format, 
    260     bcm_udf_pkt_format_id_t *pkt_format_id);
    261 
    262 /* Retrieve packet format info given the packet format Id */
    263 extern int bcm_udf_pkt_format_info_get(
    264     int unit, 
    265     bcm_udf_pkt_format_id_t pkt_format_id, 
    266     bcm_udf_pkt_format_info_t *pkt_format);
    267 
    268 /* Destroy existing packet format entry */
    269 extern int bcm_udf_pkt_format_destroy(
    270     int unit, 
    271     bcm_udf_pkt_format_id_t pkt_format_id);
    272 
    273 /* Adds packet format entry to UDF object */
    274 extern int bcm_udf_pkt_format_add(
    275     int unit, 
    276     bcm_udf_id_t udf_id, 
    277     bcm_udf_pkt_format_id_t pkt_format_id);
    278 
    279 /* Deletes packet format spec associated with the UDF */
    280 extern int bcm_udf_pkt_format_get(
    281     int unit, 
    282     bcm_udf_pkt_format_id_t pkt_format_id, 
    283     int max, 
    284     bcm_udf_id_t *udf_id_list, 
    285     int *actual);
    286 
    287 /* Deletes packet format spec associated with the UDF */
    288 extern int bcm_udf_pkt_format_delete(
    289     int unit, 
    290     bcm_udf_id_t udf_id, 
    291     bcm_udf_pkt_format_id_t pkt_format_id);
    292 
    293 /* Retrieves the user defined format specification configuration from UDF */
    294 extern int bcm_udf_pkt_format_get_all(
    295     int unit, 
    296     bcm_udf_id_t udf_id, 
    297     int max, 
    298     bcm_udf_pkt_format_id_t *pkt_format_id_list, 
    299     int *actual);
    300 
    301 /* Deletes all packet format specs associated with the UDF */
    302 extern int bcm_udf_pkt_format_delete_all(
    303     int unit, 
    304     bcm_udf_id_t udf_id);
    305 
    306 /* Add UDF id into UDF hashing list */
    307 extern int bcm_udf_hash_config_add(
    308     int unit, 
    309     uint32 options, 
    310     bcm_udf_hash_config_t *config);
    311 
    312 /* Delete UDF id from UDF hashing list */
    313 extern int bcm_udf_hash_config_delete(
    314     int unit, 
    315     bcm_udf_hash_config_t *config);
    316 
    317 /* Delete all UDF id from UDF hashing list */
    318 extern int bcm_udf_hash_config_delete_all(
    319     int unit);
    320 
    321 /* Get UDF hashing configuration of a certain id */
    322 extern int bcm_udf_hash_config_get(
    323     int unit, 
    324     bcm_udf_hash_config_t *config);
    325 
    326 /* Get all added UDF ids from list */
    327 extern int bcm_udf_hash_config_get_all(
    328     int unit, 
    329     int max, 
    330     bcm_udf_hash_config_t *config_list, 
    331     int *actual);
    332 
    333 #endif /* BCM_HIDE_DISPATCHABLE */
    334 
    335 /* 
    336  * List of UDF operational modes supported: used only in PipeLocal
    337  * operation supported devices
    338  */
    339 typedef enum bcm_udf_oper_mode_e {
    340     bcmUdfOperModeGlobal = 0,       /* UDF Operational Global Mode Value. */
    341     bcmUdfOperModePipeLocal = 1,    /* UDF Operational Pipe Local Mode Value. */
    342     bcmUdfOperModeCount = 2         /* Always last. Not a usable value. */
    343 } bcm_udf_oper_mode_t;
    344 
    345 #define BCM_UDF_OPER_MODE_STRINGS \
    346 { \
    347     "Global", \
    348     "PipeLocal"  \
    349 }
    350 
    351 #ifndef BCM_HIDE_DISPATCHABLE
    352 
    353 /* Set UDF operation mode */
    354 extern int bcm_udf_oper_mode_set(
    355     int unit, 
    356     bcm_udf_oper_mode_t mode);
    357 
    358 /* get UDF operation mode */
    359 extern int bcm_udf_oper_mode_get(
    360     int unit, 
    361     bcm_udf_oper_mode_t *mode);
    362 
    363 #endif /* BCM_HIDE_DISPATCHABLE */
    364 
    365 /* Base header the switch can parse. */
    366 typedef enum bcm_udf_abstract_pkt_format_e {
    367     bcmUdfAbstractPktFormatLlc = 0,     /* Abstract from the start of first byte
    368                                            of LLC Header. */
    369     bcmUdfAbstractPktFormatInnerLlc = 1, /* Abstract from the start of Inner
    370                                            header's first byte of LLC Header. */
    371     bcmUdfAbstractPktFormatUnknownL3 = 2, /* Abstract from the start of first byte
    372                                            after unknown EtherType. */
    373     bcmUdfAbstractPktFormatInnerUnknownL3 = 3, /* Abstract from the start of inner
    374                                            header's first byte after unknown
    375                                            EtherType. */
    376     bcmUdfAbstractPktFormatKnownNonIp = 4, /* Abstract from the start of first byte
    377                                            after Known non-ip EtherType (other
    378                                            than Known IPv4/6 and FCoE/Mim/MPLS
    379                                            tunnels). */
    380     bcmUdfAbstractPktFormatInnerKnownNonIp = 5, /* Abstract from the start of Inner
    381                                            header's first byte after Known
    382                                            non-ip EtherType (other than Known
    383                                            IPv4/6 and FCoE/Mim/MPLS tunnels). */
    384     bcmUdfAbstractPktFormatKnownL3Mim = 6, /* Abstract from the start of MiM
    385                                            Header. */
    386     bcmUdfAbstractPktFormatKnownL3FcoeStdEncap = 7, /* Abstract from the start of FCoE with
    387                                            Standard or Encapsulation Header. */
    388     bcmUdfAbstractPktFormatKnownL3FcoeVftIfr = 8, /* Abstract from the start of FCoE with
    389                                            Virtual Fabric Tag (VFT) or Inter
    390                                            Fabric Routing (IFR) Header. */
    391     bcmUdfAbstractPktFormatKnownL3MplsOneLabel = 9, /* Abstract from the start of MPLS
    392                                            Header with one label. */
    393     bcmUdfAbstractPktFormatKnownL3MplsTwoLabel = 10, /* Abstract from the start of MPLS
    394                                            Header with two labels. */
    395     bcmUdfAbstractPktFormatKnownL3MplsThreeLabel = 11, /* Abstract from the start of MPLS
    396                                            Header with three labels. */
    397     bcmUdfAbstractPktFormatKnownL3MplsFourLabel = 12, /* Abstract from the start of MPLS
    398                                            Header with four labels. */
    399     bcmUdfAbstractPktFormatKnownL3MplsMoreThanFourLabel = 13, /* Abstract from the start of MPLS
    400                                            Header with more than four labels. */
    401     bcmUdfAbstractPktFormatUnknownL4 = 14, /* Abstract from the start of first byte
    402                                            of unknown L4 Header. */
    403     bcmUdfAbstractPktFormatInnerUnknownL4 = 15, /* Abstract from the start of Inner
    404                                            header's first byte of unknown L4
    405                                            Header. */
    406     bcmUdfAbstractPktFormatUdpUnknownL5 = 16, /* Abstract from the start of first byte
    407                                            of unknown L5 after UDP Header. */
    408     bcmUdfAbstractPktFormatInnerUdpUnknownL5 = 17, /* Abstract from the start of Inner
    409                                            header's first byte of unknown L5
    410                                            after UDP Header. */
    411     bcmUdfAbstractPktFormatUdpGpeGeneve = 18, /* Abstract from the start of first byte
    412                                            of known L5 Geneve header after UDP. */
    413     bcmUdfAbstractPktFormatUdpBfd = 19, /* Abstract from the start of first byte
    414                                            of known L5 BFD header after UDP. */
    415     bcmUdfAbstractPktFormatInnerUdpBfd = 20, /* Abstract from the start of Inner
    416                                            header's first byte of known L5 BFD
    417                                            header after UDP. */
    418     bcmUdfAbstractPktFormatUdpVxlan = 21, /* Abstract from the start of first byte
    419                                            of known L5 VXLAN header after UDP. */
    420     bcmUdfAbstractPktFormatUdp1588 = 22, /* Abstract from the start of first byte
    421                                            of known L5 1588 header after UDP. */
    422     bcmUdfAbstractPktFormatTcpUnknownL5 = 23, /* Abstract from the start of first byte
    423                                            of unknown L5 header after TCP. */
    424     bcmUdfAbstractPktFormatInnerTcpUnknownL5 = 24, /* Abstract from the start of Inner
    425                                            header's first byte of unknown L5
    426                                            header after TCP. */
    427     bcmUdfAbstractPktFormatSctpUnknownL5 = 25, /* Abstract from the start of first byte
    428                                            of unknown L5 header after SCTP. */
    429     bcmUdfAbstractPktFormatInnerSctpUnknownL5 = 26, /* Abstract from the start of Inner
    430                                            header's first byte of unknown L5
    431                                            header after SCTP. */
    432     bcmUdfAbstractPktFormatGreWithoutKey = 27, /* Abstract from the start of first byte
    433                                            of L4 header for GRE packets without
    434                                            key flag set (C=0/1, R=0/1 and K=0). */
    435     bcmUdfAbstractPktFormatGreWithKey = 28, /* Abstract from the start of first byte
    436                                            of L4 header for GRE packets with key
    437                                            flag set (C=1, R=0/1 and K=1). */
    438     bcmUdfAbstractPktFormatGreWithoutChecksumRouting = 29, /* Abstract from the start of first byte
    439                                            of L4 header for GRE packets (with
    440                                            flags C=0, R=0 and K=1). */
    441     bcmUdfAbstractPktFormatL2GreWithoutChecksumRouting = 30, /* Abstract from the start of first byte
    442                                            of L4 header for L2-GRE packets (with
    443                                            flags C=0, R=0, K=1). */
    444     bcmUdfAbstractPktFormatL2GreWithoutRouting = 31, /* Abstract from the start of first byte
    445                                            of L4 header for L2-GRE packets (with
    446                                            flags R=0, C=1, K=1). */
    447     bcmUdfAbstractPktFormatAchNonIp = 32, /* Abstract from the start of ACH Header
    448                                            for a NonIp packet. */
    449     bcmUdfAbstractPktFormatUdpINT = 33, /* Abstract from the start of first byte
    450                                            of UDP header to match on port based
    451                                            INT (Inband-Telemetry) header
    452                                            payload. */
    453     bcmUdfAbstractPktFormatTcpUnknownL5WithIpExtnHdr = 34, /* Abstract from the start of first byte
    454                                            of TCP header for unknown L5 packet. */
    455     bcmUdfAbstractPktFormatL3GreUnknownPayload = 35, /* Abstract from the start of first byte
    456                                            of L3 GRE header for unknown GRE type
    457                                            packets. */
    458     bcmUdfAbstractPktFormatGreWithKeyRouting = 36, /* Abstract from the start of first byte
    459                                            of L4 header for GRE packets (with
    460                                            key and routing flag set K=1, R=1,
    461                                            C=0/1). */
    462     bcmUdfAbstractPktFormatL2GreWithKeyRouting = 37, /* Abstract from the start of first byte
    463                                            of L4 header for L2-GRE packets (with
    464                                            flags K=1, R=1, C=0/1). */
    465     bcmUdfAbstractPktFormatInnerUdp1588 = 38, /* Abstract from the start of Inner
    466                                            header's first byte of known L5 1588
    467                                            header after UDP. */
    468     bcmUdfAbstractPktFormatTcpINT = 39, /* Abstract from the start of first byte
    469                                            of TCP header to match on INT
    470                                            (Inband-Telemetry) header payload. */
    471     bcmUdfAbstractPktFormatKnownL3FcoeUnknownRctl = 40, /* Abstract from the start of FCoE with
    472                                            Unknown R_CTL. */
    473     bcmUdfAbstractPktFormatHiGigPpd0 = 41, /* Abstract from the start of HiGig
    474                                            System Header. */
    475     bcmUdfAbstractPktFormatHiGigPpd0EHType0 = 42, /* Abstract from the start of HiGig
    476                                            System Header. */
    477     bcmUdfAbstractPktFormatHiGigPpd0EHType1 = 43, /* Abstract from the start of HiGig
    478                                            System Header. */
    479     bcmUdfAbstractPktFormatHiGigPpd0EHType2 = 44, /* Abstract from the start of HiGig
    480                                            System Header. */
    481     bcmUdfAbstractPktFormatHiGigPpd2 = 45, /* Abstract from the start of HiGig
    482                                            System Header. */
    483     bcmUdfAbstractPktFormatHiGigPpd2EHType0 = 46, /* Abstract from the start of HiGig
    484                                            System Header. */
    485     bcmUdfAbstractPktFormatHiGigPpd2EHType1 = 47, /* Abstract from the start of HiGig
    486                                            System Header. */
    487     bcmUdfAbstractPktFormatHiGigPpd2EHType2 = 48, /* Abstract from the start of HiGig
    488                                            System Header. */
    489     bcmUdfAbstractPktFormatGpeIOAM = 49, /* Abstract from the start of GPE IOAM. */
    490     bcmUdfAbstractPktFormatKnownMplsMcast = 50, /* Abstract from the start of MPLS
    491                                            Multicast header. */
    492     bcmUdfAbstractPktFormatLoopbackHdrType0 = 51, /* Abstract from the start of Loopback
    493                                            Type 0 System Header. */
    494     bcmUdfAbstractPktFormatLoopbackHdrType1 = 52, /* Abstract from the start of Loopback
    495                                            Type 1 System Header. */
    496     bcmUdfAbstractPktFormatL3Ipv4Fragmented = 53, /* Abstract from the start of L3 for
    497                                            IPv4 Fragmented packets (that is,
    498                                            non-zero fragmented offset) without
    499                                            IP options. */
    500     bcmUdfAbstractPktFormatL3Ipv4FragmentedWithOptions = 54, /* Abstract from the start of L3 for
    501                                            IPv4 Fragmented packets with IP
    502                                            options (that is, non-zero fragmented
    503                                            offset). */
    504     bcmUdfAbstractPktFormatL3Ipv4WithoutOptions = 55, /* Abstract from the start of L3 for
    505                                            IPv4 packets without IP options. */
    506     bcmUdfAbstractPktFormatL3Ipv4WithOptions = 56, /* Abstract from the start of L3 for
    507                                            IPv4 packets with IP options. */
    508     bcmUdfAbstractPktFormatL3Ipv6 = 57, /* Abstract from the start of L3 for
    509                                            IPv6 packet. */
    510     bcmUdfAbstractPktFormatL2 = 58,     /* Abstract from the start of first byte
    511                                            of L2 header. */
    512     bcmUdfAbstractPktFormatL2Untagged = 59, /* Abstract from the start of 14 bytes
    513                                            after L2 header without VLAN tag. */
    514     bcmUdfAbstractPktFormatL2OuterVlanTag = 60, /* Abstract from the start of 14 bytes
    515                                            after L2 header with single outer
    516                                            VLAN tag. */
    517     bcmUdfAbstractPktFormatL2InnerVlanTag = 61, /* Abstract from the start of 14 bytes
    518                                            after L2 header with single inner
    519                                            VLAN tag. */
    520     bcmUdfAbstractPktFormatL2DoubleVlanTag = 62, /* Abstract from the start of 14 bytes
    521                                            after L2 header with double VLAN tag. */
    522     bcmUdfAbstractPktFormatL2GbpTag = 63, /* Abstract from the start of 14 bytes
    523                                            after L2 header with GBP tag (without
    524                                            VLAN tag). */
    525     bcmUdfAbstractPktFormatL2OuterVlanWithGbpTag = 64, /* Abstract from the start of 14 bytes
    526                                            after L2 header with single outer
    527                                            vlan and GBP tags. */
    528     bcmUdfAbstractPktFormatL2InnerVlanWithGbpTag = 65, /* Abstract from the start of 14 bytes
    529                                            after L2 header with single inner
    530                                            vlan and GBP tags. */
    531     bcmUdfAbstractPktFormatL2DoubleVlanWithGbpTag = 66, /* Abstract from the start of 14 bytes
    532                                            after L2 header with double vlan and
    533                                            GBP tag. */
    534     bcmUdfAbstractPktFormatL2Vntag = 67, /* Abstract from the start of 14 bytes
    535                                            after L2 header with VNTAG (without
    536                                            vlan tag). */
    537     bcmUdfAbstractPktFormatL2OuterVlanWithVntag = 68, /* Abstract from the start of 14 bytes
    538                                            after L2 header with single outer
    539                                            vlan tag and VNTAG. */
    540     bcmUdfAbstractPktFormatL2InnerVlanWithVntag = 69, /* Abstract from the start of 14 bytes
    541                                            after L2 header with single inner
    542                                            vlan tag and VNTAG. */
    543     bcmUdfAbstractPktFormatL2DoubleVlanWithVntag = 70, /* Abstract from the start of 14 bytes
    544                                            after L2 header with double vlan tag
    545                                            and VNTAG. */
    546     bcmUdfAbstractPktFormatL2Etag = 71, /* Abstract from the start of 14 bytes
    547                                            after L2 header with ETAG (without
    548                                            vlan tag). */
    549     bcmUdfAbstractPktFormatL2OuterVlanEtag = 72, /* Abstract from the start of 14 bytes
    550                                            after L2 header with single outer
    551                                            vlan tag and ETAG. */
    552     bcmUdfAbstractPktFormatL2InnerVlanEtag = 73, /* Abstract from the start of 14 bytes
    553                                            after L2 header with single inner
    554                                            vlan tag and ETAG. */
    555     bcmUdfAbstractPktFormatL2DoubleVlanEtag = 74, /* Abstract from the start of 14 bytes
    556                                            after L2 header with double vlan tag
    557                                            and ETAG. */
    558     bcmUdfAbstractPktFormatInnerL3Ipv4 = 75, /* Abstract from the start of Inner
    559                                            header's first byte of L3 IPv4
    560                                            header. */
    561     bcmUdfAbstractPktFormatInnerL3Ipv4Fragmented = 76, /* Abstract from the start of Inner
    562                                            header's first byte of L3 IPv4 header
    563                                            with non-zero fragment offset. */
    564     bcmUdfAbstractPktFormatInnerL3Ipv6 = 77, /* Abstract from the start of Inner L3
    565                                            header's first byte of L3 IPv6
    566                                            header. */
    567     bcmUdfAbstractPktFormatInnerL2Untagged = 78, /* Abstract from the start of 12 bytes
    568                                            after Inner L2 header with no VLAN
    569                                            tag. */
    570     bcmUdfAbstractPktFormatInnerL2OuterVlanTag = 79, /* Abstract from the start of 12 bytes
    571                                            after Inner L2 header with no VLAN
    572                                            tag. */
    573     bcmUdfAbstractPktFormatInnerL2InnerVlanTag = 80, /* Abstract from the start of 12 bytes
    574                                            after Inner L2 header with single
    575                                            outer VLAN tag. */
    576     bcmUdfAbstractPktFormatInnerL2DoubleVlanTag = 81, /* Abstract from the start of 12 bytes
    577                                            after Inner L2 header with single
    578                                            inner VLAN tag. */
    579     bcmUdfAbstractPktFormatInnerL2GbpTag = 82, /* Abstract from the start of 12 bytes
    580                                            after Inner L2 header with GBP tag
    581                                            (without VLAN tag). */
    582     bcmUdfAbstractPktFormatInnerL2OuterVlanWithGbpTag = 83, /* Abstract from the start of 12 bytes
    583                                            after Inner L2 header with single
    584                                            outer vlan and GBP tags. */
    585     bcmUdfAbstractPktFormatInnerL2InnerVlanWithGbpTag = 84, /* Abstract from the start of 12 bytes
    586                                            after Inner L2 header with single
    587                                            inner vlan and GBP tags. */
    588     bcmUdfAbstractPktFormatInnerL2DoubleVlanWithGbpTag = 85, /* Abstract from the start of 12 bytes
    589                                            after Inner L2 header with double
    590                                            vlan and GBP tags. */
    591     bcmUdfAbstractPktFormatUnknownL3CustomEtherType1 = 86, /* Abstract from the start of first byte
    592                                            of L3 with unknown custom EtherType
    593                                            1. */
    594     bcmUdfAbstractPktFormatUnknownL3CustomEtherType2 = 87, /* Abstract from the start of first byte
    595                                            of L3 with unknown custom EtherType
    596                                            2. */
    597     bcmUdfAbstractPktFormatUnknownL3CustomIpProtocol1 = 88, /* Abstract from the start of first byte
    598                                            of L4 with unknown custom IP Protocol
    599                                            1. */
    600     bcmUdfAbstractPktFormatUnknownL3CustomIpProtocol2 = 89, /* Abstract from the start of first byte
    601                                            of L4 with unknown custom IP Protocol
    602                                            2. */
    603     bcmUdfAbstractPktFormatUnknownL3CustomUdpDstPort1 = 90, /* Abstract from the start of first byte
    604                                            of L4 with unknown custom UDP
    605                                            destination port 1. */
    606     bcmUdfAbstractPktFormatUnknownL3CustomUdpDstPort2 = 91, /* Abstract from the start of first byte
    607                                            of L4 with unknown custom UDP
    608                                            destination port 2. */
    609     bcmUdfAbstractPktFormatInnerUnknownL3CustomEtherType1 = 92, /* Abstract from the start of first byte
    610                                            of Inner L3 with unknown custom
    611                                            EtherType 1. */
    612     bcmUdfAbstractPktFormatInnerUnknownL3CustomEtherType2 = 93, /* Abstract from the start of first byte
    613                                            of Inner L3 with unknown custom
    614                                            EtherType 2. */
    615     bcmUdfAbstractPktFormatInnerUnknownL3CustomIpProtocol1 = 94, /* Abstract from the start of first byte
    616                                            of Inner L4 with unknown custom IP
    617                                            Protocol 1. */
    618     bcmUdfAbstractPktFormatInnerUnknownL3CustomIpProtocol2 = 95, /* Abstract from the start of first byte
    619                                            of Inner L4 with unknown custom IP
    620                                            Protocol 2. */
    621     bcmUdfAbstractPktFormatInnerUnknownL3CustomUdpDstPort1 = 96, /* Abstract from the start of first byte
    622                                            of Inner L4 with unknown custom UDP
    623                                            destination port 1. */
    624     bcmUdfAbstractPktFormatInnerUnknownL3CustomUdpDstPort2 = 97, /* Abstract from the start of first byte
    625                                            of Inner L4 with unknown custom UDP
    626                                            destination port 2. */
    627     bcmUdfAbstractPktFormatUdpProbeBasedINT = 98, /* Abstract from the start of first byte
    628                                            of UDP header to match on probe based
    629                                            INT (Inband-Telemetry) header
    630                                            payload. */
    631     bcmUdfAbstractPktFormatMacsecDecrypt = 99, /* Abstract from the start of the first
    632                                            byte of L2 for the incoming MACSEC
    633                                            decrypted packet. */
    634     bcmUdfAbstractPktFormatGpeIOAMEdgeToEdge = 100, /* Abstract from the start of the first
    635                                            byte of GPE header with IOAM type as
    636                                            E2E (Edge to Edge). */
    637     bcmUdfAbstractPktFormatUdpVxlanWithoutExtnHdr = 101, /* Start of first byte of UDP Header
    638                                            Without Extension header. */
    639     bcmUdfAbstractPktFormatUdp1588WithoutExtnHdr = 102, /* Start of first byte of UDP Header
    640                                            Without Extension header. */
    641     bcmUdfAbstractPktFormatUdpBfdWithoutExtnHdr = 103, /* Start of first byte of UDP Header
    642                                            Without Extension header. */
    643     bcmUdfAbstractPktFormatUdpProbeBasedINTWithoutExtnHdr = 104, /* Abstract from the start of first byte
    644                                            of UDP header to match on probe based
    645                                            INT (Inband-Telemetry) without
    646                                            extension header payload */
    647     bcmUdfAbstractPktFormatUdpINTWithoutExtnHdr = 105, /* Start of first byte of L4 UDP header
    648                                            for INT (Inband-Telemetry) packet
    649                                            without extension header. */
    650     bcmUdfAbstractPktFormatInnerTcpUnknownL5WithoutExtnHdr = 106, /* To extract Unknown L5 payload fields
    651                                            without extension header, the base
    652                                            start offset should be the first byte
    653                                            of inner TCP Header. */
    654     bcmUdfAbstractPktFormatUdpUnknownL5WithoutExtnHdr = 107, /* To extract Unknown L5 payload fields,
    655                                            the base start offset should be the
    656                                            first byte of UDP Header without
    657                                            extension header. */
    658     bcmUdfAbstractPktFormatInnerUdpBfdWithoutExtnHdr = 108, /* Start of first byte of Inner UDP
    659                                            Header Without Extension header. */
    660     bcmUdfAbstractPktFormatL2Cntag = 109, /* Start of first byte of L2 Cntag */
    661     bcmUdfAbstractPktFormatArp = 110,   /* Start of first byte of ARP */
    662     bcmUdfAbstractPktFormatIpv6HdrAuthExt1 = 111, /* Start of first byte of IPv6
    663                                            Authentication first extension header */
    664     bcmUdfAbstractPktFormatIpv6HdrAuthExt2 = 112, /* Start of first byte of IPv6
    665                                            Authentication second extension
    666                                            header */
    667     bcmUdfAbstractPktFormatL2EtherType = 113, /* Start of first byte of L2 Ethertype */
    668     bcmUdfAbstractPktFormatL3Ipv6HdrFragExt1 = 114, /* Start of first byte of L3 IPV4
    669                                            Fragmented first extension header */
    670     bcmUdfAbstractPktFormatL3Ipv6HdrFragExt2 = 115, /* Start of first byte of L3 IPV4
    671                                            Fragmented second extension header */
    672     bcmUdfAbstractPktFormatGpe = 116,   /* Start of first byte of GPE header */
    673     bcmUdfAbstractPktFormatGre = 117,   /* Start of first byte of Gre Header */
    674     bcmUdfAbstractPktFormatGreWithChecksum = 118, /* Start of first byte of Gre Header
    675                                            with Checksum flag */
    676     bcmUdfAbstractPktFormatGreWithSequence = 119, /* Start of first byte of GRE Header
    677                                            with Sequence flag */
    678     bcmUdfAbstractPktFormatIcmp = 120,  /* Start of first byte of ICMP header */
    679     bcmUdfAbstractPktFormatIgmp = 121,  /* Start of first byte of IGMP header */
    680     bcmUdfAbstractPktFormatL3Ipv4 = 122, /* Start of first byte of L3 IPv4 Header */
    681     bcmUdfAbstractPktFormatMplsAch = 123, /* Start of first byte of MPLS Ach */
    682     bcmUdfAbstractPktFormatMplsCw = 124, /* Start of first byte of MPLS Control
    683                                            word */
    684     bcmUdfAbstractPktFormatKnownL3MplsFiveLabel = 125, /* Start of first byte of Mpls with five
    685                                            labels */
    686     bcmUdfAbstractPktFormatKnownL3MplsSixLabel = 126, /* Start of first byte of Mpls with six
    687                                            labels */
    688     bcmUdfAbstractPktFormatKnownL3MplsSevenLabel = 127, /* Start of first byte of Mpls with
    689                                            seven labels */
    690     bcmUdfAbstractPktFormatRarp = 128,  /* Start of first byte of RARP */
    691     bcmUdfAbstractPktFormatL3RoutExt1 = 129, /* Start of first byte of L3 Route First
    692                                            Extension Header */
    693     bcmUdfAbstractPktFormatL3RoutExt2 = 130, /* Start of first byte of L3 Route
    694                                            Second Extension Header */
    695     bcmUdfAbstractPktFormatL4Tcp = 131, /* Start of first byte of L4 TCP header */
    696     bcmUdfAbstractPktFormatL4Udp = 132, /* Start of first byte of L4 UDF header */
    697     bcmUdfAbstractPktFormatUnknownL5 = 133, /* Start of first byte of Unknown L5
    698                                            header */
    699     bcmUdfAbstractPktFormatInnerL2Cntag = 134, /* Start of first byte of Inner L2 CNTAG */
    700     bcmUdfAbstractPktFormatInnerL2Etag = 135, /* Start of first byte of Inner L2 Etag */
    701     bcmUdfAbstractPktFormatInnerL2 = 136, /* Start of first byte of Inner L2
    702                                            Header */
    703     bcmUdfAbstractPktFormatInnerL2Vntag = 137, /* Start of first byte of Inner L2 VNTAG */
    704     bcmUdfAbstractPktFormatInnerArp = 138, /* Start of first byte of Inner ARP */
    705     bcmUdfAbstractPktFormatInnerIpv6HdrAuthExt1 = 139, /* Start of first byte of Inner IPv6
    706                                            Authentication First Extension Header */
    707     bcmUdfAbstractPktFormatInnerIpv6HdrAuthExt2 = 140, /* Start of first byte of Inner IPv6
    708                                            Authentication Second Extension
    709                                            Header */
    710     bcmUdfAbstractPktFormatInnerL2EtherType = 141, /* Start of first byte of Inner L2
    711                                            Ethertype */
    712     bcmUdfAbstractPktFormatInnerL3Ipv6HdrFragExt1 = 142, /* Start of first byte of Inner L3 IPv6
    713                                            fragmentation first extension header */
    714     bcmUdfAbstractPktFormatInnerL3Ipv6HdrFragExt2 = 143, /* Start of first byte of Inner L3 IPv6
    715                                            fragmentation second extension header */
    716     bcmUdfAbstractPktFormatInnerIcmp = 144, /* Start of first byte of Inner ICMP */
    717     bcmUdfAbstractPktFormatInnerIgmp = 145, /* Start of first byte of Inner IGMP */
    718     bcmUdfAbstractPktFormatInnerRarp = 146, /* Start of first byte of Inner RARP */
    719     bcmUdfAbstractPktFormatInnerL4Tcp = 147, /* Start of first byte of Inner L4 TCP
    720                                            header */
    721     bcmUdfAbstractPktFormatInnerL4Udp = 148, /* Start of first byte of Inner L4 UDP
    722                                            header */
    723     bcmUdfAbstractPktFormatInnerUnknownL5 = 149, /* Start of first byte of Inner Unknown
    724                                            L5 header */
    725     bcmUdfAbstractPktFormatIfaUdp = 150, /* Start of first byte of UDP IFA header */
    726     bcmUdfAbstractPktFormatIfaTcp = 151, /* Start of first byte of TCP IFA header */
    727     bcmUdfAbstractPktFormatNshOverL2 = 152, /* Start of first byte of NSH header */
    728     bcmUdfAbstractPktFormatCesBackplane = 153, /* Start of L2 header for the packets
    729                                            received of CES backplane port */
    730     bcmUdfAbstractPktFormatLoopbackType1WithDropIndication = 154, /* Start of system header for Type 1
    731                                            Loopback header with drop indication */
    732     bcmUdfAbstractPktFormatGreHdrOfFourBytes = 155, /* Start of first byte of L4 header for
    733                                            GRE packets with 4 bytes header size */
    734     bcmUdfAbstractPktFormatGreHdrOfEightBytes = 156, /* Start of first byte of L4 header for
    735                                            GRE packets with 8 bytes header size */
    736     bcmUdfAbstractPktFormatGreHdrOfTwelveBytes = 157, /* Start of first byte of L4 header for
    737                                            GRE packets with 12 bytes header size */
    738     bcmUdfAbstractPktFormatGreHdrOfSixteenBytes = 158, /* Start of first byte of L4 header for
    739                                            GRE packets with 16 bytes header size */
    740     bcmUdfAbstractPktFormatGreHdrOfTwentyBytes = 159, /* Start of first byte of L4 header for
    741                                            GRE packets with 20 bytes header size */
    742     bcmUdfAbstractPktFormatL2GreHdrOfFourBytes = 160, /* Start of first byte of L4 header for
    743                                            L2-GRE packets with 4 bytes header
    744                                            size */
    745     bcmUdfAbstractPktFormatL2GreHdrOfEightBytes = 161, /* Start of first byte of L4 header for
    746                                            L2-GRE packets with 8 bytes header
    747                                            size */
    748     bcmUdfAbstractPktFormatL2GreHdrOfTwelveBytes = 162, /* Start of first byte of L4 header for
    749                                            L2-GRE packets with 12 bytes header
    750                                            size */
    751     bcmUdfAbstractPktFormatL2GreHdrOfSixteenBytes = 163, /* Start of first byte of L4 header for
    752                                            L2-GRE packets with 16 bytes header
    753                                            size */
    754     bcmUdfAbstractPktFormatL2GreHdrOfTwentyBytes = 164, /* Start of first byte of L4 header for
    755                                            L2-GRE packets with 20 bytes header
    756                                            size */
    757     bcmUdfAbstractPktFormatInnerUdpUnknownL5WithoutExtnHdr = 165, /* To extract Unknown L5 payload fields,
    758                                            the base start offset should be the
    759                                            first byte of Inner UDP Header
    760                                            without extension header. */
    761     bcmUdfAbstractPktFormatInnerUdp1588WithoutExtnHdr = 166, /* Start of first byte of inner UDP
    762                                            Header Without Extension header. */
    763     bcmUdfAbstractPktFormatL2Svtag = 167, /* Start of first byte of L2 svtag. */
    764     bcmUdfAbstractPktFormatRecircleHdr = 168, /* Start of first byte of EP NIH header. */
    765     bcmUdfAbstractPktFormatLastCount = 169 /* Unused. Always last in the list */
    766 } bcm_udf_abstract_pkt_format_t;
    767 
    768 #define BCM_UDF_ABSTRACT_PKT_FORMAT \
    769 { \
    770     "Llc", \
    771     "InnerLlc", \
    772     "UnknownL3", \
    773     "InnerUnknownL3", \
    774     "KnownNonIp", \
    775     "InnerKnownNonIp", \
    776     "KnownL3Mim", \
    777     "KnownL3FcoeStdEncap", \
    778     "KnownL3FcoeVftIfr", \
    779     "KnownL3MplsOneLabel", \
    780     "KnownL3MplsTwoLabel", \
    781     "KnownL3MplsThreeLabel", \
    782     "KnownL3MplsFourLabel", \
    783     "KnownL3MplsMoreThanFourLabel", \
    784     "UnknownL4", \
    785     "InnerUnknownL4", \
    786     "UdpUnknownL5", \
    787     "InnerUdpUnknownL5", \
    788     "UdpGpeGeneve", \
    789     "UdpBfd", \
    790     "InnerUdpBfd", \
    791     "UdpVxlan", \
    792     "Udp1588", \
    793     "TcpUnknownL5", \
    794     "InnerTcpUnknownL5", \
    795     "SctpUnknownL5", \
    796     "InnerSctpUnknownL5", \
    797     "GreWithoutKey", \
    798     "GreWithKey", \
    799     "GreWithoutChecksumRouting", \
    800     "L2GreWithoutChecksumRouting", \
    801     "L2GreWithoutRouting", \
    802     "AchNonIp", \
    803     "UdpINT", \
    804     "TcpUnknownL5WithIpExtnHdr", \
    805     "L3GreUnknownPayload", \
    806     "GreWithKeyRouting", \
    807     "L2GreWithKeyRouting", \
    808     "InnerUdp1588", \
    809     "TcpINT", \
    810     "KnownL3FcoeUnknownRctl", \
    811     "HiGigPpd0", \
    812     "HiGigPpd0EHType0", \
    813     "HiGigPpd0EHType1", \
    814     "HiGigPpd0EHType2", \
    815     "HiGigPpd2", \
    816     "HiGigPpd2EHType0", \
    817     "HiGigPpd2EHType1", \
    818     "HiGigPpd2EHType2", \
    819     "GpeIOAM", \
    820     "KnownMplsMcast", \
    821     "LoopbackHdrType0", \
    822     "LoopbackHdrType1", \
    823     "L3Ipv4Fragmented", \
    824     "L3Ipv4FragmentedWithOptions", \
    825     "L3Ipv4WithoutOptions", \
    826     "L3Ipv4WithOptions", \
    827     "L3Ipv6", \
    828     "L2", \
    829     "L2Untagged", \
    830     "L2OuterVlanTag", \
    831     "L2InnerVlanTag", \
    832     "L2DoubleVlanTag", \
    833     "L2GbpTag", \
    834     "L2OuterVlanWithGbpTag", \
    835     "L2InnerVlanWithGbpTag", \
    836     "L2DoubleVlanWithGbpTag", \
    837     "L2Vntag", \
    838     "L2OuterVlanWithVntag", \
    839     "L2InnerVlanWithVntag", \
    840     "L2DoubleVlanWithVntag", \
    841     "L2Etag", \
    842     "L2OuterVlanEtag", \
    843     "L2InnerVlanEtag", \
    844     "L2DoubleVlanEtag", \
    845     "InnerL3Ipv4", \
    846     "InnerL3Ipv4Fragmented", \
    847     "InnerL3Ipv6", \
    848     "InnerL2Untagged", \
    849     "InnerL2OuterVlanTag", \
    850     "InnerL2InnerVlanTag", \
    851     "InnerL2DoubleVlanTag", \
    852     "InnerL2GbpTag", \
    853     "InnerL2OuterVlanWithGbpTag", \
    854     "InnerL2InnerVlanWithGbpTag", \
    855     "InnerL2DoubleVlanWithGbpTag", \
    856     "UnknownL3CustomEtherType1", \
    857     "UnknownL3CustomEtherType2", \
    858     "UnknownL3CustomIpProtocol1", \
    859     "UnknownL3CustomIpProtocol2", \
    860     "UnknownL3CustomUdpDstPort1", \
    861     "UnknownL3CustomUdpDstPort2", \
    862     "InnerUnknownL3CustomEtherType1", \
    863     "InnerUnknownL3CustomEtherType2", \
    864     "InnerUnknownL3CustomIpProtocol1", \
    865     "InnerUnknownL3CustomIpProtocol2", \
    866     "InnerUnknownL3CustomUdpDstPort1", \
    867     "InnerUnknownL3CustomUdpDstPort2", \
    868     "UdpProbeBasedINT", \
    869     "MacsecDecrypt", \
    870     "GpeIOAMEdgeToEdge", \
    871     "UdpVxlanWithoutExtnHdr", \
    872     "Udp1588WithoutExtnHdr", \
    873     "UdpBfdWithoutExtnHdr", \
    874     "UdpProbeBasedINTWithoutExtnHdr", \
    875     "UdpINTWithoutExtnHdr", \
    876     "InnerTcpUnknownL5WithoutExtnHdr", \
    877     "UdpUnknownL5WithoutExtnHdr", \
    878     "InnerUdpBfdWithoutExtnHdr", \
    879     "L2Cntag", \
    880     "Arp", \
    881     "Ipv6HdrAuthExt1", \
    882     "Ipv6HdrAuthExt2", \
    883     "L2EtherType", \
    884     "L3Ipv6HdrFragExt1", \
    885     "L3Ipv6HdrFragExt2", \
    886     "Gpe", \
    887     "Gre", \
    888     "GreWithChecksum", \
    889     "GreWithSequence", \
    890     "Icmp", \
    891     "Igmp", \
    892     "L3Ipv4", \
    893     "MplsAch", \
    894     "MplsCw", \
    895     "KnownL3MplsFiveLabel", \
    896     "KnownL3MplsSixLabel", \
    897     "KnownL3MplsSevenLabel", \
    898     "Rarp", \
    899     "L3RoutExt1", \
    900     "L3RoutExt2", \
    901     "L4Tcp", \
    902     "L4Udp", \
    903     "UnknownL5", \
    904     "InnerL2Cntag", \
    905     "InnerL2Etag", \
    906     "InnerL2", \
    907     "InnerL2Vntag", \
    908     "InnerArp", \
    909     "InnerIpv6HdrAuthExt1", \
    910     "InnerIpv6HdrAuthExt2", \
    911     "InnerL2EtherType", \
    912     "InnerL3Ipv6HdrFragExt1", \
    913     "InnerL3Ipv6HdrFragExt2", \
    914     "InnerIcmp", \
    915     "InnerIgmp", \
    916     "InnerRarp", \
    917     "InnerL4Tcp", \
    918     "InnerL4Udp", \
    919     "InnerUnknownL5", \
    920     "IfaUdp", \
    921     "IfaTcp", \
    922     "NshOverL2", \
    923     "CesBackplane", \
    924     "LoopbackType1WithDropIndication", \
    925     "GreHdrOfFourBytes", \
    926     "GreHdrOfEightBytes", \
    927     "GreHdrOfTwelveBytes", \
    928     "GreHdrOfSixteenBytes", \
    929     "GreHdrOfTwentyBytes", \
    930     "L2GreHdrOfFourBytes", \
    931     "L2GreHdrOfEightBytes", \
    932     "L2GreHdrOfTwelveBytes", \
    933     "L2GreHdrOfSixteenBytes", \
    934     "L2GreHdrOfTwentyBytes", \
    935     "InnerUdpUnknownL5WithoutExtnHdr", \
    936     "InnerUdp1588WithoutExtnHdr", \
    937     "L2Svtag", \
    938     "RecircleHdr"  \
    939 }
    940 
    941 /* UDF tunnel term flow types. */
    942 typedef enum bcm_udf_tunnel_term_flow_type_e {
    943     bcmUdfTunnelTermFlowTypeMimWithIpPayload = 0, /* MiM with IP Payload. */
    944     bcmUdfTunnelTermFlowTypeMimWithoutIpPayload = 1, /* MiM without IP Payload. */
    945     bcmUdfTunnelTermFlowTypeL2MplsWithIpPayload = 2, /* L2 MPLS with IP Payload. */
    946     bcmUdfTunnelTermFlowTypeL2MplsWithoutIpPayload = 3, /* L2 MPLS without IP Payload. */
    947     bcmUdfTunnelTermFlowTypeL2GreWithIpPayload = 4, /* L2 GRE with IP Payload. */
    948     bcmUdfTunnelTermFlowTypeL2GreWithoutIpPayload = 5, /* L2 GRE without IP Payload. */
    949     bcmUdfTunnelTermFlowTypeVxlanWithIpPayload = 6, /* VxLAN with IP Payload. */
    950     bcmUdfTunnelTermFlowTypeVxlanWithoutIpPayload = 7, /* VxLAN without IP Payload. */
    951     bcmUdfTunnelTermFlowTypeL3Mpls = 8, /* L3 MPLS. */
    952     bcmUdfTunnelTermFlowTypeL3Tunnel = 9, /* L3 Tunnel. */
    953     bcmUdfTunnelTermFlowTypeL3GpeGeneve = 10, /* L3 Gpe Geneve. */
    954     bcmUdfTunnelTermFlowTypeL2WithIpPayload = 11, /* L2 with IP Payload. */
    955     bcmUdfTunnelTermFlowTypeL2WithoutIpPayload = 12, /* L2 without IP Payload. */
    956     bcmUdfTunnelTermFlowTypeUnterminated = 13, /* Unterminated flows like Transit and
    957                                            Nontunnel. */
    958     bcmUdfTunnelTermFlowTypeLastCount = 14 /* Unused. Always last in the list */
    959 } bcm_udf_tunnel_term_flow_type_t;
    960 
    961 #define BCM_UDF_TUNNEL_TERM_FLOW_TYPE \
    962 { \
    963     "MimWithIpPayload", \
    964     "MimWithoutIpPayload", \
    965     "L2MplsWithIpPayload", \
    966     "L2MplsWithoutIpPayload", \
    967     "L2GreWithIpPayload", \
    968     "L2GreWithoutIpPayload", \
    969     "VxlanWithIpPayload", \
    970     "VxlanWithoutIpPayload", \
    971     "L3Mpls", \
    972     "L3Tunnel", \
    973     "L3GpeGeneve", \
    974     "L2WithIpPayload", \
    975     "L2WithoutIpPayload", \
    976     "Unterminated"  \
    977 }
    978 
    979 /* UDF Chunk Information Structure. */
    980 typedef struct bcm_udf_chunk_info_s {
    981     int offset;                         /* Relative offset in bits (Starts from
    982                                            base offset of given abstract packet
    983                                            format) in the packet */
    984     uint32 width;                       /* width of data in bits to extract */
    985     uint32 chunk_bmap;                  /* Chunk bitmap (Each bit in the bitmap
    986                                            represents 1 chunk (2 bytes) */
    987     bcm_udf_abstract_pkt_format_t abstract_pkt_format; /* Abstract Packet Format (one of the
    988                                            format from
    989                                            'bcm_udf_abstract_pkt_format_t') */
    990 } bcm_udf_chunk_info_t;
    991 
    992 /* Initializes the UDF Chunk Info structure */
    993 extern void bcm_udf_chunk_info_t_init(
    994     bcm_udf_chunk_info_t *udf_chunk_info);
    995 
    996 /* Pkt Base offset. */
    997 typedef enum bcm_udf_pkt_base_offset_e {
    998     bcmUdfPktBaseOffsetStartOfOuterL2 = 0, /* Base offset from the start of Outer
    999                                            L2 Header. */
   1000     bcmUdfPktBaseOffsetStartOfOuterLlc = 1, /* Base offset from the start of Outer
   1001                                            LLC Header. */
   1002     bcmUdfPktBaseOffsetStartOfTunnel = 2, /* Base offset from the start of Tunnel
   1003                                            Header. */
   1004     bcmUdfPktBaseOffsetStartOfOuterL3 = 3, /* Base offset from the start of Outer
   1005                                            L3 Header. */
   1006     bcmUdfPktBaseOffsetStartOfOuterL4 = 4, /* Base offset from the start of Outer
   1007                                            L4 Header. */
   1008     bcmUdfPktBaseOffsetStartOfOuterL5 = 5, /* Base offset from the start of Outer
   1009                                            L5 Header. */
   1010     bcmUdfPktBaseOffsetStartOfInnerL2 = 6, /* Base offset from the start of Inner
   1011                                            L2 Header. */
   1012     bcmUdfPktBaseOffsetStartOfInnerLlc = 7, /* Base offset from the start of Inner
   1013                                            LLC Header. */
   1014     bcmUdfPktBaseOffsetStartOfInnerL3 = 8, /* Base offset from the start of Inner
   1015                                            L3 Header. */
   1016     bcmUdfPktBaseOffsetStartOfInnerL4 = 9, /* Base offset from the start of Inner
   1017                                            L4 Header. */
   1018     bcmUdfPktBaseOffsetStartOfInnerL5 = 10, /* Base offset from the start of Inner
   1019                                            L5 Header. */
   1020     bcmUdfPktBaseOffsetStartOfSystemHeader = 11, /* Base offset from the start of system
   1021                                            header (HiGig or Loopback). */
   1022     bcmUdfPktBaseOffsetStartOf14bytesAfterOuterL2 = 12, /* Base offset from the start of 14
   1023                                            bytes after Outer L2 Header. (For
   1024                                            example: In-case of L2 Single tagged
   1025                                            packet, it is start of 802.1p
   1026                                            priority field after TPID.) */
   1027     bcmUdfPktBaseOffsetStartOf12bytesAfterInnerL2 = 13, /* Base offset from the start of 12
   1028                                            bytes after Outer L2 Header. */
   1029     bcmUdfPktBaseOffsetStartOfGpe = 14, /* Base offset from the start of GPE
   1030                                            Header. */
   1031     bcmUdfPktBaseOffsetStartOfIfa = 15, /* Base offset from the start of IFA
   1032                                            Header. */
   1033     bcmUdfPktBaseOffsetStartOfNsh = 16, /* Base offset from the start of NSH
   1034                                            Header. */
   1035     bcmUdfPktBaseOffsetLastCount = 17   /* Unused. Always last in the list */
   1036 } bcm_udf_pkt_base_offset_t;
   1037 
   1038 #define BCM_UDF_PKT_BASE_OFFSET \
   1039 { \
   1040     "StartOfOuterL2", \
   1041     "StartOfOuterLlc", \
   1042     "StartOfTunnel", \
   1043     "StartOfOuterL3", \
   1044     "StartOfOuterL4", \
   1045     "StartOfOuterL5", \
   1046     "StartOfInnerL2", \
   1047     "StartOfInnerLlc", \
   1048     "StartOfInnerL3", \
   1049     "StartOfInnerL4", \
   1050     "StartOfInnerL5", \
   1051     "StartOfSystemHeader", \
   1052     "StartOf14bytesAfterOuterL2", \
   1053     "StartOf12bytesAfterInnerL2", \
   1054     "StartOfGpe", \
   1055     "StartOfIfa", \
   1056     "StartOfNsh"  \
   1057 }
   1058 
   1059 /* UDF Abstract Packet Format Information Structure. */
   1060 typedef struct bcm_udf_abstract_pkt_format_info_s {
   1061     bcm_udf_pkt_base_offset_t base_offset; /* Relative offset of
   1062                                            'bcmUdfPktBaseOffsetXX' type (from
   1063                                            'bcm_udf_pkt_base_offset_t') */
   1064     uint32 num_chunks_max;              /* Maximum number of chunks supported by
   1065                                            the abstract packet format */
   1066     uint32 chunk_bmap_used;             /* Bitmap of Chunks already used by the
   1067                                            abstract packet format */
   1068     uint32 unavail_chunk_bmap;          /* Bitmap of Chunks unavailable/reserved */
   1069 } bcm_udf_abstract_pkt_format_info_t;
   1070 
   1071 #ifndef BCM_HIDE_DISPATCHABLE
   1072 
   1073 /* API to retrieve Abstract packet format information. */
   1074 extern int bcm_udf_abstract_pkt_format_info_get(
   1075     int unit, 
   1076     bcm_udf_abstract_pkt_format_t abstract_pkt_format, 
   1077     bcm_udf_abstract_pkt_format_info_t *pkt_format_info);
   1078 
   1079 /* Create UDF object */
   1080 extern int bcm_udf_chunk_create(
   1081     int unit, 
   1082     bcm_udf_alloc_hints_t *hints, 
   1083     bcm_udf_chunk_info_t *udf_chunk_info, 
   1084     bcm_udf_id_t *udf_id);
   1085 
   1086 /* Get a UDF object information. */
   1087 extern int bcm_udf_chunk_info_get(
   1088     int unit, 
   1089     bcm_udf_id_t udf_id, 
   1090     bcm_udf_chunk_info_t *udf_chunk_info);
   1091 
   1092 /* 
   1093  * API to retrieve the list of UDF Objects associated with a given
   1094  * abstract
   1095  * packet format
   1096  */
   1097 extern int bcm_udf_abstract_pkt_format_object_list_get(
   1098     int unit, 
   1099     bcm_udf_abstract_pkt_format_t abstract_pkt_format, 
   1100     int max, 
   1101     bcm_udf_id_t *udf_id_list, 
   1102     int *actual);
   1103 
   1104 /* API to retrieve the chunk information supported for Range Checker. */
   1105 extern int bcm_udf_range_checker_chunk_info_get(
   1106     int unit, 
   1107     uint8 *num_chunks, 
   1108     uint32 *chunk_bmap);
   1109 
   1110 /* 
   1111  * API to assign the chunk bitmaps to the tunnel termination flows.
   1112  * The non-zero bits assigned to the chunk bitmap are applicable to
   1113  * extract the information from the tunnel header and zero bits are
   1114  * applicable to tunnel payload for a given termination flow.
   1115  */
   1116 extern int bcm_udf_flow_based_chunk_arrange_set(
   1117     int unit, 
   1118     bcm_udf_tunnel_term_flow_type_t flow_type, 
   1119     uint32 chunk_bmap);
   1120 
   1121 /* 
   1122  * API to retrieve the chunk bitmaps information for a given tunnel
   1123  * termination flow.
   1124  */
   1125 extern int bcm_udf_flow_based_chunk_arrange_get(
   1126     int unit, 
   1127     bcm_udf_tunnel_term_flow_type_t flow_type, 
   1128     uint32 *chunk_bmap);
   1129 
   1130 #endif /* BCM_HIDE_DISPATCHABLE */
   1131 
   1132 #define BCM_UDF_CHUNKS_MAX      32         
   1133 
   1134 /* Array of bits to define the UDF chunk bitmap. */
   1135 typedef struct bcm_udf_cbmp_s {
   1136     SHR_BITDCL w[_SHR_BITDCLSIZE(BCM_UDF_CHUNKS_MAX)]; 
   1137 } bcm_udf_cbmp_t;
   1138 
   1139 /* UDF Chunk bitmap INIT operation */
   1140 #define BCM_UDF_CBMP_CHUNK_INIT(cbmp)  \
   1141     sal_memset(&(cbmp), 0x0, sizeof(bcm_udf_cbmp_t)) 
   1142 
   1143 /* UDF Chunk Add operation */
   1144 #define BCM_UDF_CBMP_CHUNK_ADD(cbmp, chunk)  SHR_BITSET(((cbmp).w), (chunk)) 
   1145 
   1146 /* UDF Chunk Remove operation */
   1147 #define BCM_UDF_CBMP_CHUNK_REMOVE(cbmp, chunk)  SHR_BITCLR(((cbmp).w), (chunk)) 
   1148 
   1149 /* UDF Chunk Test operation */
   1150 #define BCM_UDF_CBMP_CHUNK_TEST(cbmp, chunk)  SHR_BITGET(((cbmp).w), (chunk)) 
   1151 
   1152 /* UDF Multi Chunk Information Structure. */
   1153 typedef struct bcm_udf_multi_chunk_info_s {
   1154     int offset;                         /* Relative offset in bits (Starts from
   1155                                            base offset of given abstract packet
   1156                                            format) in the packet */
   1157     uint32 width;                       /* width of data in bits to extract */
   1158     bcm_udf_cbmp_t one_byte_chunk_bmap; /* Chunk bitmap (Each bit in the bitmap
   1159                                            represents 1 chunk of 1 byte each */
   1160     bcm_udf_cbmp_t two_byte_chunk_bmap; /* Chunk bitmap (Each bit in the bitmap
   1161                                            represents 1 chunk of 2 bytes each */
   1162     bcm_udf_cbmp_t four_byte_chunk_bmap; /* Chunk bitmap (Each bit in the bitmap
   1163                                            represents 1 chunk of 4 bytes each */
   1164     bcm_udf_abstract_pkt_format_t abstract_pkt_format; /* Abstract Packet Format (one of the
   1165                                            format from
   1166                                            'bcm_udf_abstract_pkt_format_t') */
   1167 } bcm_udf_multi_chunk_info_t;
   1168 
   1169 /* Initializes the UDF Chunk Info structure */
   1170 extern void bcm_udf_multi_chunk_info_t_init(
   1171     bcm_udf_multi_chunk_info_t *udf_multi_chunk_info);
   1172 
   1173 #ifndef BCM_HIDE_DISPATCHABLE
   1174 
   1175 /* Creates a UDF object */
   1176 extern int bcm_udf_multi_chunk_create(
   1177     int unit, 
   1178     bcm_udf_alloc_hints_t *hints, 
   1179     bcm_udf_multi_chunk_info_t *info, 
   1180     bcm_udf_id_t *udf_id);
   1181 
   1182 /* Get a UDF object information. */
   1183 extern int bcm_udf_multi_chunk_info_get(
   1184     int unit, 
   1185     bcm_udf_id_t udf_id, 
   1186     bcm_udf_multi_chunk_info_t *info);
   1187 
   1188 #endif /* BCM_HIDE_DISPATCHABLE */
   1189 
   1190 /* UDF Multi Abstract Packet Format Information Structure. */
   1191 typedef struct bcm_udf_multi_abstract_pkt_format_info_s {
   1192     bcm_udf_pkt_base_offset_t base_offset; /* Not supported. The base offset is
   1193                                            based on the flow applicable to the
   1194                                            abstract packet format (as name
   1195                                            suggested). */
   1196     uint32 num_chunks_max;              /* Maximum number of chunks supported by
   1197                                            the abstract packet format */
   1198     bcm_udf_cbmp_t chunk_4b_bmap_avail; /* Available 4-byte Chunk bitmap. */
   1199     bcm_udf_cbmp_t chunk_2b_bmap_avail; /* Available 2-byte Chunk bitmap. */
   1200     bcm_udf_cbmp_t chunk_1b_bmap_avail; /* Available 1-byte Chunk bitmap. */
   1201 } bcm_udf_multi_abstract_pkt_format_info_t;
   1202 
   1203 #ifndef BCM_HIDE_DISPATCHABLE
   1204 
   1205 /* Retrieve multi packet format info for a given abstract packet format */
   1206 extern int bcm_udf_multi_abstract_pkt_format_info_get(
   1207     int unit, 
   1208     bcm_udf_abstract_pkt_format_t abstr_pkt_fmt, 
   1209     bcm_udf_multi_abstract_pkt_format_info_t *pkt_fmt_info);
   1210 
   1211 /* Retrieve UDF supported abstract packet formats */
   1212 extern int bcm_udf_abstract_pkt_format_supported_list_get(
   1213     int unit, 
   1214     int max, 
   1215     bcm_udf_abstract_pkt_format_t *abstr_pkt_fmt_list, 
   1216     int *actual);
   1217 
   1218 #endif /* BCM_HIDE_DISPATCHABLE */
   1219 
   1220 /* Enumerations for Packet format actions. */
   1221 typedef enum bcm_udf_pkt_format_action_e {
   1222     bcmUdfPktFormatActionClassId = 0,   /* Apply Class Id. */
   1223     bcmUdfPktFormatActionSkipOuterL4IfaMetadata = 1, /* Skip L4 header Outer IFA metadata
   1224                                            header and metadata while calculating
   1225                                            final offset. This action is
   1226                                            applicable when associated UDF has
   1227                                            layer set to L4 or tunnel payload. */
   1228     bcmUdfPktFormatActionCount = 2      /* Unused. Always last in the list */
   1229 } bcm_udf_pkt_format_action_t;
   1230 
   1231 #define BCM_UDF_PKT_FORMAT_ACTION \
   1232 { \
   1233     "ClassId", \
   1234     "SkipOuterL4IfaMetadata"  \
   1235 }
   1236 
   1237 #ifndef BCM_HIDE_DISPATCHABLE
   1238 
   1239 /* Associated action to the packet format Id */
   1240 extern int bcm_udf_pkt_format_action_set(
   1241     int unit, 
   1242     bcm_udf_pkt_format_id_t pkt_format_id, 
   1243     bcm_udf_pkt_format_action_t action, 
   1244     int arg);
   1245 
   1246 /* Get associated action to the packet format Id */
   1247 extern int bcm_udf_pkt_format_action_get(
   1248     int unit, 
   1249     bcm_udf_pkt_format_id_t pkt_format_id, 
   1250     bcm_udf_pkt_format_action_t action, 
   1251     int *arg);
   1252 
   1253 #endif /* BCM_HIDE_DISPATCHABLE */
   1254 
   1255 #endif /* __BCM_UDF_H__ */