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

mirror.h (47353B)


      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_MIRROR_H__
     14 #define __BCM_MIRROR_H__
     15 
     16 #include <bcm/types.h>
     17 #include <bcm/pkt.h>
     18 
     19 /* Mirror modes for bcm_mirror_mode_set/get. */
     20 #define BCM_MIRROR_DISABLE      0          /* Disable mirroring. */
     21 #define BCM_MIRROR_L2           1          /* Enable mirroring. */
     22 #define BCM_MIRROR_L2_L3        2          /* Deprecated. */
     23 
     24 /* Flags for bcm_mirror_port_set/get. */
     25 #define BCM_MIRROR_PORT_ENABLE          0x00000001 /* Enable mirroring. */
     26 #define BCM_MIRROR_PORT_INGRESS         0x00000002 /* Ingress mirroring. */
     27 #define BCM_MIRROR_PORT_EGRESS          0x00000004 /* Egress mirroring. */
     28 #define BCM_MIRROR_PORT_EGRESS_TRUE     0x00000008 /* True egress mirroring. */
     29 #define BCM_MIRROR_PORT_DEST_TRUNK      0x00000010 /* Parameter dest_port is a
     30                                                       trunk. */
     31 #define BCM_MIRROR_PORT_EGRESS_ACL      0x00000020 /* Enable Egress Mirroring
     32                                                       for ACLs */
     33 #define BCM_MIRROR_PORT_SFLOW           0x00000040 /* sFlow mirroring */
     34 #define BCM_MIRROR_PORT_UNTAGGED_ONLY   0x00000080 /* Mirror Untagged traffic -
     35                                                       Ingress Mirroring only. */
     36 #define BCM_MIRROR_PORT_TAGGED_DEFAULT  0x00000100 /* Mirror tagged traffic with
     37                                                       unspecified VID - Ingress
     38                                                       Mirroring only. */
     39 #define BCM_MIRROR_PORT_PSAMP           0x00000200 /* Packet Sampling - Ingress
     40                                                       only. */
     41 #define BCM_MIRROR_PORT_INT             0x00000400 /* INT (Inband Network
     42                                                       Telemetry) Mirroring -
     43                                                       Ingress only. */
     44 #define BCM_MIRROR_PORT_ELEPHANT        0x00000800 /* Elephant Flow Mirroring -
     45                                                       Ingress only. */
     46 #define BCM_MIRROR_PORT_DLB_MONITOR     0x00001000 /* DLB Flow Monitor Mirroring
     47                                                       - Ingress only */
     48 
     49 /* Flags for bcm_mirror_destination_create/traverse. */
     50 #define BCM_MIRROR_DEST_REPLACE             (1 << 0)   /* Replace mirror
     51                                                           destination. */
     52 #define BCM_MIRROR_DEST_WITH_ID             (1 << 1)   /* Mirror destination id
     53                                                           is valid. */
     54 #define BCM_MIRROR_DEST_TUNNEL_L2           (1 << 2)   /* Mirrored packet should
     55                                                           be L2 tunneled. */
     56 #define BCM_MIRROR_DEST_TUNNEL_IP_GRE       (1 << 3)   /* Mirrored packet should
     57                                                           be L3 GRE tunneled. */
     58 #define BCM_MIRROR_DEST_PAYLOAD_UNTAGGED    (1 << 4)   /* Strip vlan tag from
     59                                                           mirrored packet. */
     60 #define BCM_MIRROR_DEST_TUNNEL_TRILL        (1 << 5)   /* Mirrored packet should
     61                                                           be TRILL tunneled. */
     62 #define BCM_MIRROR_DEST_TUNNEL_NIV          (1 << 6)   /* Mirrored packet should
     63                                                           be NIV tunneled. */
     64 #define BCM_MIRROR_DEST_UPDATE_POLICER      (1 << 7)   /* update policer using
     65                                                           policer_id */
     66 #define BCM_MIRROR_DEST_UPDATE_COUNTER      (1 << 8)   /* update counter using
     67                                                           stat_id */
     68 #define BCM_MIRROR_DEST_DEST_MULTICAST      (1 << 9)   /* destination is ingress
     69                                                           multicast */
     70 #define BCM_MIRROR_DEST_TUNNEL_WITH_ENCAP_ID (1 << 10)  /* Mirror destination
     71                                                           encap_id is valid */
     72 #define BCM_MIRROR_DEST_TUNNEL_WITH_SPAN_ID (1 << 11)  /* Mirrored packet should
     73                                                           be with ERSPAN
     74                                                           encapsulation */
     75 #define BCM_MIRROR_DEST_TUNNEL_RSPAN        (1 << 12)  /* Mirrored packet should
     76                                                           be RSPAN (VLAN)
     77                                                           tunneled */
     78 #define BCM_MIRROR_DEST_INT_PRI_SET         (1 << 13)  /* Mirrored packet should
     79                                                           set with internal
     80                                                           priority */
     81 #define BCM_MIRROR_DEST_TUNNEL_ETAG         (1 << 14)  /* Mirrored packet should
     82                                                           be ETAG tunneled. */
     83 #define BCM_MIRROR_DEST_TUNNEL_SFLOW        (1 << 15)  /* Mirrored packet should
     84                                                           be with sFlow
     85                                                           encapsulation */
     86 #define BCM_MIRROR_DEST_IS_SNOOP            (1 << 16)  /* Specify that the
     87                                                           destination type is a
     88                                                           snoop destination. */
     89 #define BCM_MIRROR_DEST_IS_TRAP             (1 << 17)  /* Specify that the
     90                                                           destination is a trap
     91                                                           destination. */
     92 #define BCM_MIRROR_DEST_IS_STAT_SAMPLE      (1 << 17)  /* Specify that the
     93                                                           destination type is a
     94                                                           STATISTIC SAMPLING
     95                                                           destination. */
     96 #define BCM_MIRROR_DEST_EGRESS_ADD_ORIG_SYSTEM_HEADER (1 << 18)  /* The start of the
     97                                                           original packet system
     98                                                           header will be
     99                                                           included in the
    100                                                           outbound mirrored
    101                                                           packets. */
    102 #define BCM_MIRROR_DEST_FIELD               (1 << 19)  /* Specify that mirror
    103                                                           destination owner is
    104                                                           FP. */
    105 #define BCM_MIRROR_DEST_PORT                (1 << 20)  /* Specify that mirror
    106                                                           destination owner is
    107                                                           PORT. */
    108 #define BCM_MIRROR_DEST_DROP_SNIFF_IF_FWD_DROPPED (1 << 21)  /* Drop the sniff packet
    109                                                           if the original packet
    110                                                           is dropped */
    111 #define BCM_MIRROR_DEST_UPDATE_COUNTER_1    (1 << 21)  /* update counter No.1 */
    112 #define BCM_MIRROR_DEST_UPDATE_COUNTER_2    (1 << 22)  /* update counter No.2 */
    113 #define BCM_MIRROR_DEST_DROP_FWD_IF_SNIFF_DROPPED (1 << 22)  /* Drop the original
    114                                                           packet if the sniff
    115                                                           packet is dropped */
    116 #define BCM_MIRROR_DEST_UPDATE_TUNNEL_SFLOW (1 << 23)  /* Update mirror
    117                                                           destination with sflow
    118                                                           encapsulation */
    119 #define BCM_MIRROR_DEST_ID_SHARE            (1 << 24)  /* Share mirror
    120                                                           destination id among
    121                                                           multi ports */
    122 #define BCM_MIRROR_DEST_EEI_INVALID         (1 << 24)  /* Set EEI invalid */
    123 #define BCM_MIRROR_DEST_MTP_ADD             (1 << 25)  /* Add an MTP into a
    124                                                           shared-id mirror
    125                                                           destination */
    126 #define BCM_MIRROR_DEST_MTP_DELETE          (1 << 26)  /* Delete an MTP from a
    127                                                           shared-id mirror
    128                                                           destination */
    129 #define BCM_MIRROR_DEST_MTP_REPLACE         (1 << 27)  /* REPLACE an MTP of a
    130                                                           shared-id mirror
    131                                                           destination */
    132 #define BCM_MIRROR_DEST_EGRESS_TRAP_WITH_SYSTEM_HEADER (1 << 28)  /* For packets recycled
    133                                                           by egress applications
    134                                                           and not forwarded,
    135                                                           retain the incoming
    136                                                           packet's system
    137                                                           headers as received
    138                                                           from the fabric, and
    139                                                           in case of an Egress
    140                                                           MC packet, stamp the
    141                                                           FTMH.OutLIF field with
    142                                                           the CUD. */
    143 #define BCM_MIRROR_DEST_TUNNEL_PSAMP        (1 << 29)  /* Update mirror
    144                                                           destination with PSAMP
    145                                                           encapsulation */
    146 #define BCM_MIRROR_DEST_OUT_MIRROR_DISABLE  (1 << 30)  /* Assert out mirror
    147                                                           disable */
    148 #define BCM_MIRROR_DEST_TUNNEL_WITH_SEQ     (1 << 31)  /* Include Sequence
    149                                                           number in header. */
    150 #define BCM_MIRROR_DEST_UPDATE_EXT_COUNTERS (1 << 31)  /* Set statistic
    151                                                           interfaces for
    152                                                           mirrored packets. */
    153 #define BCM_MIRROR_DEST_FLAGS2_TUNNEL_VXLAN (1 << 0)   /* Mirror Tunnel is
    154                                                           VXLAN. */
    155 #define BCM_MIRROR_DEST_FLAGS2_PSAMP_FORMAT_2 (1 << 1)   /* Use format2 header for
    156                                                           PSAMP */
    157 #define BCM_MIRROR_DEST_FLAGS2_INT_PROBE    (1 << 2)   /* Add INT(Inband Network
    158                                                           Telemetry) probe
    159                                                           header. */
    160 #define BCM_MIRROR_DEST_FLAGS2_IFA          (1 << 3)   /* Add IFA(In-band Flow
    161                                                           Analyzer) header. */
    162 #define BCM_MIRROR_DEST_FLAGS2_UPDATE_EXT_STAT_VALID (1 << 4)   /* Update external
    163                                                           statistics valid bit
    164                                                           for mirror packets */
    165 #define BCM_MIRROR_DEST_FLAGS2_UPDATE_EXT_STAT_TYPES (1 << 5)   /* Update external
    166                                                           statistics types for
    167                                                           mirror packets */
    168 #define BCM_MIRROR_DEST_FLAGS2_MIRROR_ON_DROP (1 << 6)   /* Indicate mirror on
    169                                                           drop profile. */
    170 
    171 /* Flags for bcm_mirror_pkt_header_updates_t. */
    172 #define BCM_MIRROR_PKT_HEADER_UPDATE_COLOR  (1 << 0)   /* Drop precedence. */
    173 #define BCM_MIRROR_PKT_HEADER_UPDATE_PRIO   (1 << 1)   /* Internal packet
    174                                                           priority. */
    175 #define BCM_MIRROR_PKT_HEADER_UPDATE_ECN_VALUE (1 << 2)   /* ECN capable and
    176                                                           congestion encoding. */
    177 #define BCM_MIRROR_PKT_HEADER_UPDATE_ECN_CNM_CANCEL (1 << 3)   /* Ignore Congestion
    178                                                           Point. */
    179 #define BCM_MIRROR_PKT_HEADER_UPDATE_TRUNK_HASH_RESULT (1 << 4)   /* LAG load balancing
    180                                                           key. */
    181 #define BCM_MIRROR_PKT_HEADER_UPDATE_IN_PORT (1 << 5)   /* 8b should be exposed? */
    182 #define BCM_MIRROR_PKT_HEADER_UPDATE_VSQ    (1 << 6)   /* selects STF
    183                                                           (statistics flow) VSQ. */
    184 #define BCM_MIRROR_PKT_HEADER_UPDATE_FABRIC_HEADER_EDITING (1 << 7)   /* changes to the fabric
    185                                                           headers */
    186 #define BCM_MIRROR_PKT_HEADER_UPDATE_METADATA (1 << 14)  /* The metadata for CRPS
    187                                                           should be set
    188                                                           explicitly updated */
    189 
    190 /* Flags for mirror NIV tunneling */
    191 #define BCM_MIRROR_NIV_LOOP     1          /* Mirrored packet is a loop in NIV
    192                                               path */
    193 
    194 /*  represents the options for the mirroring of packets */
    195 typedef struct bcm_mirror_options_s {
    196     uint32 flags; 
    197     uint8 forward_strength; 
    198     uint8 copy_strength; 
    199     uint32 recycle_cmd;     /* dedicated for ETPP traps */
    200 } bcm_mirror_options_t;
    201 
    202 /* Flags for ftmh_valid in bcm_mirror_pkt_header_fabric_t */
    203 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_PACKET_SIZE (1 << 0)   /* Packet size. */
    204 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_PRIO (1 << 1)   /* Traffic Class. */
    205 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_SRC_SYSPORT (1 << 2)   /* Source System port. */
    206 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_DST_PORT (1 << 3)   /* Destination local
    207                                                           port. */
    208 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_DP (1 << 4)   /* Drop precedence. */
    209 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_ACTION_TYPE (1 << 5)   /* Action type */
    210 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_OUT_MIRROR_DISABLE (1 << 6)   /* Disable Outbound
    211                                                           mirroring. */
    212 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_IS_MC_TRAFFIC (1 << 7)   /* Indicate if the
    213                                                           traffic is multicast */
    214 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_MULTICAST_ID (1 << 8)   /* Multicast ID */
    215 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_OUT_VPORT (1 << 9)   /* Virtual port */
    216 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_CNI (1 << 10)  /* Congestion indication */
    217 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_LB_KEY (1 << 11)  /* Load Balancing Key */
    218 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_DST_SYSPORT (1 << 12)  /* Destination System
    219                                                           Port */
    220 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_STACK_ROUTE (1 << 13)  /* Route bitmap to
    221                                                           prevent loops in
    222                                                           stacking system */
    223 
    224 /* Flags for oam_ts_valid in bcm_mirror_pkt_header_fabric_t. */
    225 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_TYPE (1 << 0)   /* Type */
    226 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_SUB_TYPE (1 << 1)   /* OAM-Sub-Type */
    227 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_UP_MEP (1 << 2)   /* MEP-Type */
    228 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_TP_CMD (1 << 3)   /* TP-Cmd */
    229 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_ENCAPS (1 << 4)   /* TS-Encaps */
    230 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_DATA (1 << 5)   /* OAM-TS-Data */
    231 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_LATENCY_FLOW_ID (1 << 6)   /* Latency flow ID */
    232 #define BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_OFFSET (1 << 7)   /* Offset */
    233 
    234 /* Fabric header updates of mirrored packets */
    235 typedef struct bcm_mirror_pkt_header_fabric_s {
    236     uint32 ftmh_valid;                  /* Used to specify which fields to use
    237                                            for header changes. Possible values
    238                                            will be named
    239                                            BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_FTMH_ */
    240     uint32 internal_valid;              /* Used to specify which fields to use
    241                                            for header changes. Possible values
    242                                            will be named
    243                                            BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_INTERNAL_ */
    244     uint32 oam_ts_valid;                /* Used to specify which fields to use
    245                                            for header changes. Possible values
    246                                            will be named
    247                                            BCM_MIRROR_PKT_HEADER_FABRIC_UPDATE_OAM_TS_ */
    248     bcm_pkt_dnx_ftmh_t ftmh;            /* FTMH header fields */
    249     bcm_pkt_dnx_internal_t internal;    /* Internal header fields */
    250     bcm_pkt_dnx_otsh_t oam_ts;          /* OAM-TS header fields */
    251 } bcm_mirror_pkt_header_fabric_t;
    252 
    253 /* Flags for bcm_mirror_options_s */
    254 #define BCM_MIRROR_OPTIONS_COPY_DROP    (1 << 0)   /* drop the copied packet */
    255 #define BCM_MIRROR_OPTIONS_FORWARD_DROP (1 << 1)   /* drop the original packet */
    256 
    257 /*   represents header updates of mirrored packets */
    258 typedef struct bcm_mirror_pkt_header_updates_s {
    259     uint32 valid;                       /* Used to specify which fields to use
    260                                            for header changes. Possible values
    261                                            will be named
    262                                            BCM_MIRROR_PKT_HEADER_UPDATE_* */
    263     bcm_color_t color;                  /* drop precedence */
    264     uint8 prio;                         /* the internal packet priority (traffic
    265                                            class before ingress mapping to cosq) */
    266     uint8 ecn_value;                    /* ECN capable and congestion encoding */
    267     uint8 cnm_cancel;                   /* Ignore Congestion Point (CNM) */
    268     uint32 trunk_hash_result;           /* LAG load balancing key */
    269     bcm_gport_t in_port;                /* 8b should be exposed? */
    270     uint16 vsq;                         /*  selects STF (statistics flow) VSQ */
    271     uint16 fabric_header_editing;       /* changes to the fabric headers */
    272     bcm_mirror_pkt_header_fabric_t header_fabric; /* Fabric header updates of mirrored
    273                                            packets */
    274     uint32 metadata;                    /* Metadata for counting */
    275 } bcm_mirror_pkt_header_updates_t;
    276 
    277 /* Do not perform truncation or payload zeroing */
    278 #define BCM_MIRROR_PAYLOAD_DO_NOT_TRUNCATE  0          
    279 
    280 /* Perform payload truncation of mirrored packets */
    281 #define BCM_MIRROR_PAYLOAD_TRUNCATE 1          
    282 
    283 /* Perform payload truncation and zeroing of mirrored packets */
    284 #define BCM_MIRROR_PAYLOAD_TRUNCATE_AND_ZERO 2          
    285 
    286 /* 
    287  * Invalid protocol or port value. Used when there is no associated
    288  * protocol or port value for a given offset
    289  */
    290 #define BCM_MIRROR_PAYLOAD_ZERO_INVALID_PROTO_PORT 0xFFFFFFFF 
    291 
    292 /* Invalid offset value. Used to set a offset field in case of an error */
    293 #define BCM_MIRROR_PAYLOAD_ZERO_INVALID_OFFSET 0xFFFFFFFF 
    294 
    295 /* 
    296  * The following enum defines identifiers for accessing protocol/port
    297  * numbers and/or the corresponding offset values for a particular
    298  * protocol, or a layer
    299  */
    300 typedef enum bcm_mirror_payload_zero_field_e {
    301     bcmMirrorPayloadZeroIp4Protocol0 = 0, /* 1st of upto 3 IPv4 protocol values */
    302     bcmMirrorPayloadZeroIp4Protocol1 = 1, /* 2nd of upto 3 IPv4 protocol values */
    303     bcmMirrorPayloadZeroIp4Protocol2 = 2, /* 3rd of upto 3 IPv4 protocol values */
    304     bcmMirrorPayloadZeroIp6NxtHdr0 = 3, /* 1st of upto 3 IPv6 nxthdr values */
    305     bcmMirrorPayloadZeroIp6NxtHdr1 = 4, /* 2nd of upto 3 IPv6 nxthdr values */
    306     bcmMirrorPayloadZeroIp6NxtHdr2 = 5, /* 3rd of upto 3 IPv6 nxthdr values */
    307     bcmMirrorPayloadZeroUdpPort0 = 6,   /* First of upto 2 UDP port values */
    308     bcmMirrorPayloadZeroUdpPort1 = 7,   /* Second of upto 2 UDP port values */
    309     bcmMirrorPayloadZeroIpInIpOffset = 8, /* IpInIP offset. No corresponding
    310                                            protocol value associated */
    311     bcmMirrorPayloadZeroL2Offset = 9,   /* L2 offset. No corresponding protocol
    312                                            value associated */
    313     bcmMirrorPayloadZeroL3Offset = 10,  /* L3 offset. No corresponding protocol
    314                                            value associated */
    315     bcmMirrorPayloadZeroMplsOffset = 11, /* MPLS offset. No corresponding
    316                                            protocol value associated */
    317     bcmMirrorPayloadZeroCount = 12      /* Last member, not a usable value */
    318 } bcm_mirror_payload_zero_field_t;
    319 
    320 /* 
    321  * Structure to pass information from, or to the caller. Used for
    322  * accessing protocol/port numbers and/or the corresponding offset values
    323  * for a particular protocol, or a layer
    324  */
    325 typedef struct bcm_mirror_payload_zero_info_s {
    326     bcm_mirror_payload_zero_field_t field_id; /* Identifies protocol or port item to
    327                                            be programmed, or read. Values below
    328                                            belong to this item */
    329     uint32 protocol_port_value;         /* Specifies protocol number or port
    330                                            number. Is not valid for all
    331                                            field_id's */
    332     uint32 protocol_port_offset;        /* Offset, in bytes, corresponding to
    333                                            field_id. Valid for all field_id's */
    334 } bcm_mirror_payload_zero_info_t;
    335 
    336 /* 
    337  * Sflow/Psamp hdr's meta data field carries one of the values mentioned
    338  * below
    339  */
    340 typedef enum bcm_mirror_psamp_fmt2_meta_data_e {
    341     bcmMirrorPsampFmt2HeaderZeroes = 0, /* All zeroes */
    342     bcmMirrorPsampFmt2HeaderI2eClassId = 1, /* I2E class id */
    343     bcmMirrorPsampFmt2HeaderNextHopClassId = 2, /* Next hop class id */
    344     bcmMirrorPsampFmt2HeaderUserMeta = 3, /* User meta data (opaque) value */
    345     bcmMirrorPsampFmt2HeaderCount = 4   /* Last member. Not a usable value */
    346 } bcm_mirror_psamp_fmt2_meta_data_t;
    347 
    348 /* Port Selection Criteria for mirroring. */
    349 typedef enum bcm_mirror_psc_e {
    350     bcmMirrorPscNone = 0,       /* Invalid rtag. */
    351     bcmMirrorPscSrcMac = 1,     /* Source MAC address. */
    352     bcmMirrorPscDstMac = 2,     /* Destination MAC address. */
    353     bcmMirrorPscSrcDstMac = 3,  /* Source+dest MAC address. */
    354     bcmMirrorPscSrcIp = 4,      /* Source IP address. */
    355     bcmMirrorPscDstIp = 5,      /* Destination IP address. */
    356     bcmMirrorPscSrcDstIp = 6,   /* Source+dest IP address. */
    357     bcmMirrorPscCount = 7       /* Must be last. Not a usable value. */
    358 } bcm_mirror_psc_t;
    359 
    360 #define BCM_MIRROR_EXT_STAT_ID_COUNT    4          /* Number of statistic
    361                                                       interfaces for mirrored
    362                                                       packets. */
    363 
    364 /* Contains information required for ERSPAN encapsulation header. */
    365 typedef struct bcm_mirror_pkt_erspan_encap_s {
    366     uint8 truncated_flag;           /* If set to 0x1, the frame copy
    367                                        encapsulated in the ERSPAN packet will be
    368                                        truncated. This should be set if ERSPAN
    369                                        encapsulated frame exceeds the configured
    370                                        MTU. */
    371     uint16 session_id;              /* Identification associated with each
    372                                        ERSPAN session. */
    373     uint16 gbp_sid;                 /* Group Based Policy Source Id */
    374     uint8 hw_id;                    /* Unique identifier of an ERSPAN engine
    375                                        within a system. */
    376     uint8 timestamp_granularity;    /* If it is not set, NTP timestamp will be
    377                                        used. If it is set to 0x1, PTP timestamp
    378                                        will used. */
    379     uint8 optional_hdr;             /* Indicates if the optional
    380                                        platform-specific sub-header is present. */
    381     uint8 platform_id;              /* Platform identifier to parse the optional
    382                                        platform-specific sub-header. Valid only
    383                                        if optional_hdr is set. */
    384     uint16 user_defined_value;      /* To store the user defined field */
    385     uint16 switch_id;               /* Identifies a source switch at the
    386                                        receiving end. Valid only if optional_hdr
    387                                        is set and platform_id as 0x5 or 0x6. */
    388 } bcm_mirror_pkt_erspan_encap_t;
    389 
    390 /* 
    391  * Mirror destination Structure
    392  * 
    393  * Contains information required for manipulating mirror destinations.
    394  */
    395 typedef struct bcm_mirror_destination_s {
    396     bcm_gport_t mirror_dest_id;         /* Unique mirror destination and
    397                                            encapsulation identifier. */
    398     uint32 flags;                       /* See BCM_MIRROR_DEST_xxx flag
    399                                            definitions. */
    400     bcm_gport_t gport;                  /* Mirror destination. */
    401     uint8 version;                      /* IP header version. */
    402     uint8 tos;                          /* Traffic Class/Tos byte. */
    403     uint8 ttl;                          /* Hop limit. */
    404     bcm_ip_t src_addr;                  /* Tunnel source ip address (IPv4). */
    405     bcm_ip_t dst_addr;                  /* Tunnel destination ip address (IPv4). */
    406     bcm_ip6_t src6_addr;                /* Tunnel source ip address (IPv6). */
    407     bcm_ip6_t dst6_addr;                /* Tunnel destination ip address (IPv6). */
    408     uint32 flow_label;                  /* IPv6 header flow label field. */
    409     bcm_mac_t src_mac;                  /* L2 source mac address. */
    410     bcm_mac_t dst_mac;                  /* L2 destination mac address. */
    411     uint16 tpid;                        /* L2 header outer TPID. */
    412     bcm_vlan_t vlan_id;                 /* Vlan id. */
    413     bcm_trill_name_t trill_src_name;    /* TRILL source bridge nickname */
    414     bcm_trill_name_t trill_dst_name;    /* TRILL destination bridge nickname */
    415     int trill_hopcount;                 /* TRILL hop count */
    416     uint16 niv_src_vif;                 /* Source Virtual Interface of NIV tag */
    417     uint16 niv_dst_vif;                 /* Destination Virtual Interface of NIV
    418                                            tag */
    419     uint32 niv_flags;                   /* NIV flags BCM_MIRROR_NIV_XXX */
    420     uint16 gre_protocol;                /* L3 GRE header protocol */
    421     bcm_policer_t policer_id;           /* policer_id */
    422     int stat_id;                        /* stat_id */
    423     int stat_id2;                       /* stat_id2 for second counter pointer */
    424     bcm_if_t encap_id;                  /* Encapsulation index */
    425     bcm_if_t tunnel_id;                 /* IP tunnel for encapsulation. Valid
    426                                            only if BCM_MIRROR_DEST_TUNNEL_IP_GRE
    427                                            is set */
    428     uint16 span_id;                     /* SPAN-ID. Valid only if
    429                                            BCM_MIRROR_DEST_TUNNEL_WITH_SPAN_ID
    430                                            is set */
    431     uint8 pkt_prio;                     /* L2 header PCP */
    432     uint32 sample_rate_dividend;        /* The probability of mirroring a packet
    433                                            is: sample_rate_dividend >=
    434                                            sample_rate_divisor ? 1 :
    435                                            sample_rate_dividend /
    436                                            sample_rate_divisor */
    437     uint32 sample_rate_divisor; 
    438     uint8 int_pri;                      /* Internal Priority */
    439     uint16 etag_src_vid;                /* Extended (source) port vlan id */
    440     uint16 etag_dst_vid;                /* Extended (destination) port vlan id */
    441     uint16 udp_src_port;                /* UDP source port */
    442     uint16 udp_dst_port;                /* UDP destination port */
    443     uint32 egress_sample_rate_dividend; /* The probability of outbound mirroring
    444                                            a packet from the destination is
    445                                            sample_rate_dividend >=
    446                                            sample_rate_divisor ? 1 :
    447                                            sample_rate_dividend /
    448                                            sample_rate_divisor */
    449     uint32 egress_sample_rate_divisor; 
    450     uint8 recycle_context;              /* recycle context of egress originating
    451                                            packets */
    452     uint16 packet_copy_size;            /*  If non zero, the copied packet will
    453                                            be truncated to the first
    454                                            packet_copy_size . Current supported
    455                                            values for DNX are 0, 64, 128, 192 */
    456     uint16 egress_packet_copy_size;     /* If non zero and the packet is copied
    457                                            from the egress, the packet will be
    458                                            truncated to the first
    459                                            packet_copy_size . Current supported
    460                                            values for DNX are 0, 256. */
    461     bcm_mirror_pkt_header_updates_t packet_control_updates; 
    462     bcm_mirror_psc_t rtag;              /* specify RTAG HASH algorithm used for
    463                                            shared-id mirror destination */
    464     uint8 df;                           /* Set the do not fragment bit of IP
    465                                            header in mirror encapsulation */
    466     uint8 truncate;                     /* Setting truncate would result in
    467                                            mirroring a truncated frame */
    468     uint16 template_id;                 /* Template ID for IPFIX HDR */
    469     uint32 observation_domain;          /* Observation domain for IPFIX HDR */
    470     uint32 is_recycle_strict_priority;  /* Recycle priority (1-lossless, 0-high) */
    471     int ext_stat_id[BCM_MIRROR_EXT_STAT_ID_COUNT]; /* ext_stat_id to support statistic
    472                                            interface for mirror packets. */
    473     uint32 flags2;                      /* See BCM_MIRROR_DEST_FLAGS2_xxx flag
    474                                            definitions. */
    475     uint32 vni;                         /* Virtual Network Interface ID. */
    476     uint32 gre_seq_number;              /* Sequence number value used in GRE
    477                                            header. If no value is provided,
    478                                            gre_seq_number will start with 0.
    479                                            Valid only if
    480                                            BCM_MIRROR_DEST_TUNNEL_IP_GRE is set. */
    481     bcm_mirror_pkt_erspan_encap_t erspan_header; /* ERSPAN encapsulation header fields.
    482                                            Valid only if only
    483                                            BCM_MIRROR_DEST_TUNNEL_IP_GRE is set. */
    484     uint32 initial_seq_number;          /* Starting seq number in SFLOW or PSAMP
    485                                            header */
    486     bcm_mirror_psamp_fmt2_meta_data_t meta_data_type; /* Type of item in 'meta_data' */
    487     uint16 meta_data;                   /* Actual value of class id or meta
    488                                            data, based on 'meta_data_type' */
    489     int ext_stat_valid;                 /* Validates the ext_stat. */
    490     int ext_stat_type_id[BCM_MIRROR_EXT_STAT_ID_COUNT]; /* Type ids for statistic interface. */
    491 } bcm_mirror_destination_t;
    492 
    493 /* Mirror destination callback function prototype. */
    494 typedef int (*bcm_mirror_destination_traverse_cb)(
    495     int unit, 
    496     bcm_mirror_destination_t *mirror_dest, 
    497     void *user_data);
    498 
    499 #ifndef BCM_HIDE_DISPATCHABLE
    500 
    501 /* Initialize the mirroring module to its initial configuration. */
    502 extern int bcm_mirror_init(
    503     int unit);
    504 
    505 /* Set the current mirroring mode for the device. */
    506 extern int bcm_mirror_mode_set(
    507     int unit, 
    508     int mode);
    509 
    510 #endif /* BCM_HIDE_DISPATCHABLE */
    511 
    512 /* Initialize a bcm_mirror_options_t structure. */
    513 extern void bcm_mirror_options_t_init(
    514     bcm_mirror_options_t *mirror_dest);
    515 
    516 /* Initialize a bcm_mirror_pkt_header_updates_t  structure. */
    517 extern void bcm_mirror_pkt_header_updates_t_init(
    518     bcm_mirror_pkt_header_updates_t *mirror_dest);
    519 
    520 /* Initialize a bcm_bcm_mirror_destination_t structure. */
    521 extern void bcm_mirror_destination_t_init(
    522     bcm_mirror_destination_t *mirror_dest);
    523 
    524 #ifndef BCM_HIDE_DISPATCHABLE
    525 
    526 /* Create a mirror (destination, encapsulation) pair. */
    527 extern int bcm_mirror_destination_create(
    528     int unit, 
    529     bcm_mirror_destination_t *mirror_dest);
    530 
    531 /* Get  mirror (destination, encapsulation) pair. */
    532 extern int bcm_mirror_destination_get(
    533     int unit, 
    534     bcm_gport_t mirror_dest_id, 
    535     bcm_mirror_destination_t *mirror_dest);
    536 
    537 /* Destroy a mirror (destination, encapsulation) pair. */
    538 extern int bcm_mirror_destination_destroy(
    539     int unit, 
    540     bcm_gport_t mirror_dest_id);
    541 
    542 /* Traverse installed mirror destinations. */
    543 extern int bcm_mirror_destination_traverse(
    544     int unit, 
    545     bcm_mirror_destination_traverse_cb cb, 
    546     void *user_data);
    547 
    548 /* Get the current mirroring mode for the device. */
    549 extern int bcm_mirror_mode_get(
    550     int unit, 
    551     int *mode);
    552 
    553 /* Set the mirror-to port for the device. */
    554 extern int bcm_mirror_to_set(
    555     int unit, 
    556     bcm_port_t port);
    557 
    558 /* Get the mirror-to port for the device. */
    559 extern int bcm_mirror_to_get(
    560     int unit, 
    561     bcm_port_t *port);
    562 
    563 /* Enable or Disable ingress mirroring for a port on the device. */
    564 extern int bcm_mirror_ingress_set(
    565     int unit, 
    566     bcm_port_t port, 
    567     int val);
    568 
    569 /* 
    570  * Get the ingress mirroring enabled/disabled status for a port on the
    571  * device.
    572  */
    573 extern int bcm_mirror_ingress_get(
    574     int unit, 
    575     bcm_port_t port, 
    576     int *val);
    577 
    578 /* Enable or Disable egress mirroring for a port on the device. */
    579 extern int bcm_mirror_egress_set(
    580     int unit, 
    581     bcm_port_t port, 
    582     int val);
    583 
    584 /* 
    585  * Get the egress mirroring enabled/disabled status for a port on the
    586  * device.
    587  */
    588 extern int bcm_mirror_egress_get(
    589     int unit, 
    590     bcm_port_t port, 
    591     int *val);
    592 
    593 /* Set the mirror-to port bitmap for the device. */
    594 extern int bcm_mirror_to_pbmp_set(
    595     int unit, 
    596     bcm_port_t port, 
    597     bcm_pbmp_t pbmp);
    598 
    599 /* Get the mirror-to port bitmap for the device. */
    600 extern int bcm_mirror_to_pbmp_get(
    601     int unit, 
    602     bcm_port_t port, 
    603     bcm_pbmp_t *pbmp);
    604 
    605 /* Set mirroring configuration for a port. */
    606 extern int bcm_mirror_port_set(
    607     int unit, 
    608     bcm_port_t port, 
    609     bcm_module_t dest_mod, 
    610     bcm_port_t dest_port, 
    611     uint32 flags);
    612 
    613 /* Get mirroring configuration for a port. */
    614 extern int bcm_mirror_port_get(
    615     int unit, 
    616     bcm_port_t port, 
    617     bcm_module_t *dest_mod, 
    618     bcm_port_t *dest_port, 
    619     uint32 *flags);
    620 
    621 /* Set VLAN for egressing mirrored packets on a port (RSPAN). */
    622 extern int bcm_mirror_vlan_set(
    623     int unit, 
    624     bcm_port_t port, 
    625     uint16 tpid, 
    626     uint16 vlan);
    627 
    628 /* Get VLAN for egressing mirrored packets on a port (RSPAN). */
    629 extern int bcm_mirror_vlan_get(
    630     int unit, 
    631     bcm_port_t port, 
    632     uint16 *tpid, 
    633     uint16 *vlan);
    634 
    635 /* bcm_mirror_port_dest_add */
    636 extern int bcm_mirror_port_dest_add(
    637     int unit, 
    638     bcm_port_t port, 
    639     uint32 flags, 
    640     bcm_gport_t mirror_dest_id);
    641 
    642 /* 
    643  * An extended version of bcm_mirror_port_dest_add using a
    644  * bcm_mirror_options_t argument
    645  */
    646 extern int bcm_mirror_port_destination_add(
    647     int unit, 
    648     bcm_port_t port, 
    649     uint32 flags, 
    650     bcm_gport_t mirror_dest, 
    651     bcm_mirror_options_t options);
    652 
    653 /* bcm_mirror_port_dest_delete */
    654 extern int bcm_mirror_port_dest_delete(
    655     int unit, 
    656     bcm_port_t port, 
    657     uint32 flags, 
    658     bcm_gport_t mirror_dest_id);
    659 
    660 /* bcm_mirror_port_dest_delete_all */
    661 extern int bcm_mirror_port_dest_delete_all(
    662     int unit, 
    663     bcm_port_t port, 
    664     uint32 flags);
    665 
    666 /* bcm_mirror_port_dest_get */
    667 extern int bcm_mirror_port_dest_get(
    668     int unit, 
    669     bcm_port_t port, 
    670     uint32 flags, 
    671     int mirror_dest_size, 
    672     bcm_gport_t *mirror_dest, 
    673     int *mirror_dest_count);
    674 
    675 /* 
    676  * An extended version of bcm_mirror_port_dest_get using a
    677  * bcm_mirror_options_t argument
    678  */
    679 extern int bcm_mirror_port_destination_get(
    680     int unit, 
    681     bcm_port_t port, 
    682     uint32 flags, 
    683     int mirror_dest_size, 
    684     bcm_gport_t *mirror_dest, 
    685     int *mirror_dest_count, 
    686     bcm_mirror_options_t *options);
    687 
    688 #endif /* BCM_HIDE_DISPATCHABLE */
    689 
    690 /* Backward compatibility. */
    691 #define bcm_mirror_mode         bcm_mirror_mode_set 
    692 
    693 #ifndef BCM_HIDE_DISPATCHABLE
    694 
    695 /* Set mirroring configuration for a port-vlan. */
    696 extern int bcm_mirror_port_vlan_set(
    697     int unit, 
    698     bcm_port_t port, 
    699     bcm_vlan_t vlan, 
    700     bcm_gport_t destport, 
    701     uint32 flags);
    702 
    703 /* Get mirroring configuration for a port-vlan. */
    704 extern int bcm_mirror_port_vlan_get(
    705     int unit, 
    706     bcm_port_t port, 
    707     bcm_vlan_t vlan, 
    708     bcm_gport_t *dest_port, 
    709     uint32 *flags);
    710 
    711 /* mirror_port_vlan_dest_add */
    712 extern int bcm_mirror_port_vlan_dest_add(
    713     int unit, 
    714     bcm_port_t port, 
    715     bcm_vlan_t vlan, 
    716     uint32 flags, 
    717     bcm_gport_t destid);
    718 
    719 /* 
    720  * An extended version of  mirror_port_vlan_dest_add using a
    721  * bcm_mirror_options_t argument
    722  */
    723 extern int bcm_mirror_port_vlan_destination_add(
    724     int unit, 
    725     bcm_port_t port, 
    726     bcm_vlan_t vlan, 
    727     uint32 flags, 
    728     bcm_gport_t destid, 
    729     bcm_mirror_options_t options);
    730 
    731 /* bcm_mirror_port_vlan_dest_delete */
    732 extern int bcm_mirror_port_vlan_dest_delete(
    733     int unit, 
    734     bcm_port_t port, 
    735     bcm_vlan_t vlan, 
    736     uint32 flags, 
    737     bcm_gport_t destid);
    738 
    739 /* bcm_mirror_port_dest_delete_all */
    740 extern int bcm_mirror_port_vlan_dest_delete_all(
    741     int unit, 
    742     bcm_port_t port, 
    743     bcm_vlan_t vlan, 
    744     uint32 flags);
    745 
    746 /* bcm_mirror_port_vlan_dest_gett */
    747 extern int bcm_mirror_port_vlan_dest_get(
    748     int unit, 
    749     bcm_port_t port, 
    750     bcm_vlan_t vlan, 
    751     uint32 flags, 
    752     uint32 mirror_dest_size, 
    753     bcm_gport_t *destid, 
    754     uint32 *destcount);
    755 
    756 /* 
    757  * An extended version bcm_mirror_port_vlan_dest_get of using a
    758  * bcm_mirror_options_t argument
    759  */
    760 extern int bcm_mirror_port_vlan_destination_get(
    761     int unit, 
    762     bcm_port_t port, 
    763     bcm_vlan_t vlan, 
    764     uint32 flags, 
    765     uint32 mirror_dest_size, 
    766     bcm_gport_t *destid, 
    767     uint32 *destcount, 
    768     bcm_mirror_options_t *options);
    769 
    770 /* Set values of one or more payload zeroing parameters */
    771 extern int bcm_mirror_payload_zero_control_multi_set(
    772     int unit, 
    773     bcm_mirror_payload_zero_info_t *payload_zero_config_array, 
    774     int num_configs);
    775 
    776 /* Get values of one or more payload zeroing parameters */
    777 extern int bcm_mirror_payload_zero_control_multi_get(
    778     int unit, 
    779     bcm_mirror_payload_zero_info_t *payload_zero_config_array, 
    780     int num_configs);
    781 
    782 #endif /* BCM_HIDE_DISPATCHABLE */
    783 
    784 /* Initialize a bcm_mirror_payload_zero_info_t structure */
    785 extern void bcm_mirror_payload_zero_info_t_init(
    786     bcm_mirror_payload_zero_info_t *info);
    787 
    788 /* 
    789  * Mirror port Structure
    790  * 
    791  * Contains information required for mirror port settings.
    792  */
    793 typedef struct bcm_mirror_port_info_s {
    794     bcm_gport_t mirror_system_id;   /* Unique mirror System identifier. */
    795 } bcm_mirror_port_info_t;
    796 
    797 /* Initialize a bcm_mirror_port_info_t structure. */
    798 extern void bcm_mirror_port_info_t_init(
    799     bcm_mirror_port_info_t *info);
    800 
    801 #ifndef BCM_HIDE_DISPATCHABLE
    802 
    803 /* bcm_mirror_port_info_set */
    804 extern int bcm_mirror_port_info_set(
    805     int unit, 
    806     bcm_port_t port, 
    807     uint32 flags, 
    808     bcm_mirror_port_info_t *info);
    809 
    810 /* bcm_mirror_port_info_get */
    811 extern int bcm_mirror_port_info_get(
    812     int unit, 
    813     bcm_port_t port, 
    814     uint32 flags, 
    815     bcm_mirror_port_info_t *info);
    816 
    817 #endif /* BCM_HIDE_DISPATCHABLE */
    818 
    819 /* 
    820  * Invalid mirror/snoop profile value, used in bcm_mirror_port_dest_get
    821  * and bcm_mirror_destination_get
    822  */
    823 #define BCM_MIRROR_INVALID_PROFILE  0xffff     /* Invalid mirror/snoop profile
    824                                                   value */
    825 
    826 /* 
    827  * Value to disable counting of the snooped/mirrored copy, used in
    828  * bcm_mirror_destination_create when flags
    829  * BCM_MIRROR_DEST_UPDATE_COUNTER_1 and BCM_MIRROR_DEST_UPDATE_COUNTER_2
    830  * are given.
    831  */
    832 #define BCM_MIRROR_DEST_NO_COUNT    -2         /* Value to disable counting of
    833                                                   the snooped/mirrored copy. */
    834 
    835 /* 
    836  * Default value to be used for Template id for the IPFIX header in case
    837  * of PSAMP.
    838  */
    839 #define BCM_MIRROR_IPFIX_TEMPLATE_ID_DFLT   0x1234     /* Default value to be
    840                                                           used for Template id. */
    841 
    842 /* 
    843  * Default value to be used for Template id for the IPFIX header in case
    844  * of PSAMP.
    845  */
    846 #define BCM_MIRROR_IPFIX_OBSERVATION_DOMAIN_DFLT 100        /* Default value to be
    847                                                           used for observation
    848                                                           domain. */
    849 
    850 /* Info about mirror port and priorities */
    851 typedef struct bcm_mirror_port_to_rcy_map_info_s {
    852     bcm_port_t rcy_mirror_port; /* Mirror port */
    853     uint32 priority_bitmap;     /* Used to specify which priorities to map.
    854                                    Possible values will be named
    855                                    BCM_MIRROR_PORT_TO_RCY_MAP_INFO_PRIORITY_ */
    856 } bcm_mirror_port_to_rcy_map_info_t;
    857 
    858 #ifndef BCM_HIDE_DISPATCHABLE
    859 
    860 /* 
    861  * Map/unmap forward port to recycle mirror port (to unmap set
    862  * rcy_mirror_port to BCM_MIRROR_INVALID_RCY_PORT)
    863  */
    864 extern int bcm_mirror_port_to_rcy_port_map_set(
    865     int unit, 
    866     uint32 flags, 
    867     bcm_port_t forward_port, 
    868     bcm_mirror_port_to_rcy_map_info_t *rcy_map_info);
    869 
    870 /* Get recycle mirror port info from forward port. */
    871 extern int bcm_mirror_port_to_rcy_port_map_get(
    872     int unit, 
    873     uint32 flags, 
    874     bcm_port_t forward_port, 
    875     bcm_mirror_port_to_rcy_map_info_t *rcy_map_info);
    876 
    877 #endif /* BCM_HIDE_DISPATCHABLE */
    878 
    879 #define BCM_MIRROR_PORT_TO_RCY_MAP_INFO_PRIORITY_NORMAL 0x00000001 /* Assign the port to
    880                                                           normal priority
    881                                                           recycle context. */
    882 #define BCM_MIRROR_PORT_TO_RCY_MAP_INFO_PRIORITY_HIGH 0x00000002 /* Assign the port to
    883                                                           high priority recycle
    884                                                           context. */
    885 
    886 /* Mirror profile counting parameters for command. */
    887 typedef struct bcm_mirror_profile_cmd_count_s {
    888     int is_counted;     /* Is the mirror packet should be counted for this
    889                            command. */
    890     int object_stat_id; /* Statistic id to be counted for this command. */
    891     int type_id;        /* Type id to be counted for this command. */
    892     int is_meter;       /* Object is meter or crps. */
    893 } bcm_mirror_profile_cmd_count_t;
    894 
    895 #define BCM_MIRROR_COUNT_AS_ORIG    -1         
    896 
    897 #define BCM_MIRROR_PORT_DELETE_ALL  0x00000400 /* Delete all destinations */
    898 
    899 #ifndef BCM_HIDE_DISPATCHABLE
    900 
    901 extern int bcm_mirror_destination_count_command_get(
    902     int unit, 
    903     bcm_core_t core_id, 
    904     bcm_gport_t mirror_dest_id, 
    905     int counter_cmd_id, 
    906     uint32 flags, 
    907     bcm_mirror_profile_cmd_count_t *mirror_count_info);
    908 
    909 extern int bcm_mirror_destination_count_command_set(
    910     int unit, 
    911     bcm_core_t core_id, 
    912     bcm_gport_t mirror_dest_id, 
    913     int counter_cmd_id, 
    914     uint32 flags, 
    915     bcm_mirror_profile_cmd_count_t *mirror_count_info);
    916 
    917 #endif /* BCM_HIDE_DISPATCHABLE */
    918 
    919 /* TM header information for mirrored packet in DNX devices */
    920 typedef struct bcm_mirror_pkt_dnx_ftmh_header_s {
    921     bcm_gport_t src_sysport;            /* Source System port */
    922     uint8 tc;                           /* Traffic class */
    923     uint8 dp;                           /* Drop precedence */
    924     uint8 is_mc_traffic;                /* Destination is multicast */
    925     bcm_multicast_t mc_id;              /* Destination Multicast ID (when
    926                                            is_mc_traffic is set) */
    927     bcm_gport_t out_vport;              /* Destination Outlif (when
    928                                            is_mc_traffic is cleared) */
    929     bcm_pkt_dnx_ftmh_ase_extension_t ase_ext; /* FTMH Application Specific Extension */
    930     bcm_pkt_dnx_ftmh_flow_id_extension_t flow_id_ext; /* FTMH Flow-ID Extension */
    931 } bcm_mirror_pkt_dnx_ftmh_header_t;
    932 
    933 /* PP header information for mirrored packet in DNX devices */
    934 typedef struct bcm_mirror_pkt_dnx_pp_header_s {
    935     uint8 tailedit_en;              /* Tailedit enable (reserved, set to 0) */
    936     bcm_gport_t out_vport_ext[3];   /* Extended outlif(s) */
    937 } bcm_mirror_pkt_dnx_pp_header_t;
    938 
    939 /* Mirror packet system header information for DNX devices */
    940 typedef struct bcm_mirror_header_info_s {
    941     bcm_mirror_pkt_dnx_ftmh_header_t tm; /* TM header */
    942     bcm_mirror_pkt_dnx_pp_header_t pp;  /* PP header */
    943     bcm_pkt_dnx_udh_t udh[4];           /* UDH header */
    944 } bcm_mirror_header_info_t;
    945 
    946 /* Initialize a bcm_mirror_header_info_t structure. */
    947 extern void bcm_mirror_header_info_t_init(
    948     bcm_mirror_header_info_t *mirror_header_info);
    949 
    950 #ifndef BCM_HIDE_DISPATCHABLE
    951 
    952 /* Set system header information. */
    953 extern int bcm_mirror_header_info_set(
    954     int unit, 
    955     uint32 flags, 
    956     bcm_gport_t mirror_dest_id, 
    957     bcm_mirror_header_info_t *mirror_header_info);
    958 
    959 /* Get system header information. */
    960 extern int bcm_mirror_header_info_get(
    961     int unit, 
    962     bcm_gport_t mirror_dest_id, 
    963     uint32 *flags, 
    964     bcm_mirror_header_info_t *mirror_header_info);
    965 
    966 #endif /* BCM_HIDE_DISPATCHABLE */
    967 
    968 /* Denotes that profile is used by Field Processor Module */
    969 #define BCM_MIRROR_PAYLOAD_ZERO_FP  (1 << 0)   
    970 
    971 /* Mirror Payload Zeroing Profile Information */
    972 typedef struct bcm_mirror_payload_zero_offsets_s {
    973     int l2_offset;  /* offset from the end of the known L2 headers to start
    974                        zeroing */
    975     int l3_offset;  /* offset from the end of the known L3 headers to start
    976                        zeroing for non-UDP packets */
    977     int udp_offset; /* offset from the end of the known L3 headers to start
    978                        zeroing for UDP packets */
    979 } bcm_mirror_payload_zero_offsets_t;
    980 
    981 #ifndef BCM_HIDE_DISPATCHABLE
    982 
    983 /* Creates a mirror zeroing profile and returns the profile index. */
    984 extern int bcm_mirror_payload_zero_profile_create(
    985     int unit, 
    986     bcm_mirror_payload_zero_offsets_t *mirror_payload_offset_info, 
    987     uint32 flags, 
    988     uint32 *profile_index);
    989 
    990 /* Destroys a mirror zeroing profile for the given profile index. */
    991 extern int bcm_mirror_payload_zero_profile_destroy(
    992     int unit, 
    993     uint32 flags, 
    994     uint32 profile_index);
    995 
    996 #endif /* BCM_HIDE_DISPATCHABLE */
    997 
    998 /* Initialize a bcm_mirror_payload_zero_offsets_t structure. */
    999 extern void bcm_mirror_payload_zero_offsets_t_init(
   1000     bcm_mirror_payload_zero_offsets_t *mirror_payload_zero_offset);
   1001 
   1002 #endif /* __BCM_MIRROR_H__ */