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

port.h (30628B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * This file contains PORT definitions internal to the BCM library.
      8  */
      9 
     10 #ifndef _BCM_INT_PORT_H
     11 #define _BCM_INT_PORT_H
     12 
     13 #include <soc/ll.h>
     14 #include <bcm_int/common/lock.h>
     15 #include <bcm/port.h>
     16 #ifdef BCM_TRIUMPH3_SUPPORT
     17 #include <bcm/pkt.h>
     18 #endif
     19 
     20 #ifdef BCM_WARM_BOOT_SUPPORT
     21 #include <soc/scache.h>
     22 #define BCM_PORT_WB_VERSION_1_0                SOC_SCACHE_VERSION(1,0)
     23 #define BCM_PORT_WB_VERSION_1_1                SOC_SCACHE_VERSION(1,1)
     24 #define BCM_PORT_WB_VERSION_1_2                SOC_SCACHE_VERSION(1,2)
     25 #define BCM_PORT_WB_VERSION_1_3                SOC_SCACHE_VERSION(1,3)
     26 #define BCM_PORT_WB_VERSION_1_4                SOC_SCACHE_VERSION(1,4)
     27 #define BCM_PORT_WB_VERSION_1_5                SOC_SCACHE_VERSION(1,5)
     28 #define BCM_PORT_WB_VERSION_1_6                SOC_SCACHE_VERSION(1,6)
     29 #define BCM_PORT_WB_VERSION_1_7                SOC_SCACHE_VERSION(1,7)
     30 #define BCM_PORT_WB_VERSION_1_8                SOC_SCACHE_VERSION(1,8)
     31 #define BCM_PORT_WB_VERSION_1_9                SOC_SCACHE_VERSION(1,9)
     32 #define BCM_PORT_WB_VERSION_1_10               SOC_SCACHE_VERSION(1,10)
     33 #define BCM_PORT_WB_VERSION_1_11               SOC_SCACHE_VERSION(1,11)
     34 #define BCM_PORT_WB_VERSION_1_12               SOC_SCACHE_VERSION(1,12)
     35 #define BCM_PORT_WB_VERSION_1_13               SOC_SCACHE_VERSION(1,13)
     36 #define BCM_PORT_WB_DEFAULT_VERSION            BCM_PORT_WB_VERSION_1_13
     37 
     38 #define BCM_PORT_WB_SCACHE_PART_DEFAULT       (0)
     39 #if defined(BCM_PREEMPTION_SUPPORT)
     40 #define BCM_PORT_WB_SCACHE_PART_PREMMPTION    (1)
     41 #define BCM_PORT_WB_SCACHE_PART_MIN  (BCM_PORT_WB_SCACHE_PART_DEFAULT)
     42 #define BCM_PORT_WB_SCACHE_PART_MAX  (BCM_PORT_WB_SCACHE_PART_PREMMPTION)
     43 #else
     44 #define BCM_PORT_WB_SCACHE_PART_MIN  (BCM_PORT_WB_SCACHE_PART_DEFAULT)
     45 #define BCM_PORT_WB_SCACHE_PART_MAX  (BCM_PORT_WB_SCACHE_PART_DEFAULT)
     46 #endif
     47 #endif /* BCM_WARM_BOOT_SUPPORT */
     48 
     49 /* Hardware values for different redirection configuration */
     50 #define _BCM_REDIRECT_DEST_TYPE_NONE  0x0
     51 #define _BCM_REDIRECT_DEST_TYPE_MTP   0x4
     52 #define _BCM_REDIRECT_DEST_TYPE_PORT  0x5
     53 #define _BCM_REDIRECT_DEST_TYPE_TRUNK 0x6
     54 #define _BCM_REDIRECT_DEST_TYPE_MCAST 0x7
     55 
     56 #define _BCM_REDIRECT_NONE            0x0
     57 #define _BCM_REDIRECT_IF_NOT_DROPPED  0x1
     58 #define _BCM_REDIRECT_IF_DROPPED      0x2
     59 #define _BCM_REDIRECT_ALWAYS          0x3
     60 
     61 #define _BCM_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION  0x1
     62 #define _BCM_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE       0x2
     63 
     64 #define _BCM_PORT_REDIRECT_BUFFER_PRIORITY_LOW    0x0
     65 #define _BCM_PORT_REDIRECT_BUFFER_PRIORITY_MEDIUM 0x1
     66 #define _BCM_PORT_REDIRECT_BUFFER_PRIORITY_HIGH   0x2
     67 
     68 #define BCMI_MOD_PORT_MODID_GET(mod_port, modid) \
     69                   ((modid) = ((mod_port) >> 8) & 0xFF)
     70 
     71 #define BCMI_MOD_PORT_PORTID_GET(mod_port, portid) \
     72                   ((portid) = (mod_port) & 0xFF)
     73 
     74 #define BCMI_MOD_PORT_SET(mod_port, modid, portid) \
     75                   ((mod_port) = ((((modid) & 0xFF) << 8) | \
     76                                    ((portid) & 0xFF)))
     77 
     78 /*
     79  * Port Function Vector Driver
     80  */
     81 typedef struct bcm_esw_port_drv_s {
     82     /* Initalize Port Function Vector driver */
     83     int (*fn_drv_init)(int unit);
     84 
     85     /*
     86      * Port Resource APIs (FlexPort)
     87      */
     88     /* Modify the Port Resources (e.g. speed, lanes, etc.) for a port */
     89     int (*resource_set)(int unit, bcm_gport_t port,
     90                         bcm_port_resource_t *resource);
     91     /* Get Port Resource configuration for a port */
     92     int (*resource_get)(int unit, bcm_gport_t port,
     93                         bcm_port_resource_t *resource);
     94     /* Modify the Port Resources (e.g. speed, lanes, etc.) for a set of ports */
     95     int (*resource_multi_set)(int unit, int nport,
     96                               bcm_port_resource_t *resource);
     97     /* Modify the Port speed only, keep same number of lanes */
     98     int (*resource_speed_set)(int unit, bcm_port_t port, int speed);
     99 
    100     /* Iterate and get the Port Resource configuration for all ports */
    101     int (*resource_traverse)(int unit, bcm_port_resource_traverse_cb trav_fn,
    102                              void *user_data);
    103     /* Set the port redirection configuration */
    104     int (*port_redirect_set)(int unit, bcm_port_t port,
    105                           bcm_port_redirect_config_t *redirect_config);
    106     /* Get the port redirection configuration */
    107     int (*port_redirect_get)(int unit, bcm_port_t port,
    108                           bcm_port_redirect_config_t *redirect_config);
    109 
    110     /* Enable or disable a port */
    111     int (*port_enable_set)(int unit, bcm_port_t port, int enable);
    112     /* Check if the speed and encap mode match */
    113     int (*encap_speed_check)(int unit, bcm_port_t port, int encap, int speed);
    114     /* Set force loopback */
    115     int (*force_lb_set)(int unit);
    116     /* Check if port should be forced loopback */
    117     int (*force_lb_check)(int unit, int port, int loopback);
    118     /* Update port resources operational status after flex operation. */
    119     int (*resource_status_update)(int unit, int nport, bcm_port_resource_t *resource);
    120 
    121     /* Set the Speed information for several ports */
    122     int (*port_resource_speed_multi_set)(int unit, int nport,
    123             bcm_port_resource_t *resource);
    124 
    125     /* Check if the speed and lanes are supported on the device */
    126     int (*device_speed_check)(int unit, int speed, int lanes);
    127 } bcm_esw_port_drv_t;
    128 
    129 extern bcm_esw_port_drv_t      *bcm_esw_port_drv[BCM_MAX_NUM_UNITS];
    130 
    131 #define BCM_ESW_PORT_DRV(_u)   (bcm_esw_port_drv[(_u)])
    132 
    133 
    134 
    135 #define  BCM_PORT_L3_V4_ENABLE     (1 << 0)    /* Enable L3 IPv4 switching. */
    136 #define  BCM_PORT_L3_V6_ENABLE     (1 << 1)    /* Enable L3 IPv6 switching. */
    137 
    138 #define  BCM_PORT_JUMBO_MAXSZ    0x3FE8
    139 
    140 #define BCM_EGR_PORT_TYPE_ETHERNET      0x0
    141 #define BCM_EGR_PORT_TYPE_HIGIG         0x1
    142 #define BCM_EGR_PORT_TYPE_LB            0x2
    143 #define BCM_EGR_PORT_TYPE_EHG           0x3
    144 
    145 #define BCM_EGR_PORT_HIGIG_PLUS         0x0
    146 #define BCM_EGR_PORT_HIGIG2             0x1
    147 
    148 /* For MEMORY PORT_TABLE.HG_TYPE EGR_PORT.HG_TYPE, EGR_ING_PORT.HG_TYPE */
    149 #define BCM_PORT_HG_TYPE_HIGIGPLUS          0x00
    150 #define BCM_PORT_HG_TYPE_HIGIG2_NORMAL      0x08
    151 #define BCM_PORT_HG_TYPE_HGOE_TRANSPORT     0x09
    152 #define BCM_PORT_HG_TYPE_HGOE_RAW           0x0A
    153 
    154 #define _BCM_PORT_EHG_L2_HEADER_BUFFER_SZ       8    /* 24 bytes  = 6 words + 2 words padding*/
    155 #define _BCM_PORT_EHG_IP_GRE_HEADER_BUFFER_SZ   12    /* 48 bytes  = 12 words */
    156 
    157 #define _BCM_CPU_TABS_NONE        0
    158 #define _BCM_CPU_TABS_ETHER     0x1
    159 #define _BCM_CPU_TABS_HIGIG     0x2
    160 #define _BCM_CPU_TABS_BOTH      0x3
    161 
    162 #define _BCM_PORT_RATE_PPS_MODE  1  /* Rate Limiting in packet mode */
    163 #define _BCM_PORT_RATE_BYTE_MODE 0  /* Rate Limiting in byte mode   */
    164 #define _BCM_PORT_RATE_MIN_KILOBITS  8
    165 #define _BCM_PORT_RATE_MAX_KILOBITS  106*1000*1000
    166 #define _BCM_PORT_BURST_MIN_KILOBITS  2
    167 #define _BCM_PORT_BURST_MAX_KILOBITS  1000*1000
    168 /*
    169  * Define:
    170  *     LPORT_PROFILE_LPORT_TAB/LPORT_PROFILE_RTAG7_TAB
    171  * Purpose:
    172  *     Table indexes for LPORT Profile Table.
    173  */
    174 #define LPORT_PROFILE_LPORT_TAB 0
    175 #define LPORT_PROFILE_RTAG7_TAB 1
    176 
    177 /*
    178  * Define:
    179  *      _BCM_PORT_VD_PBVL_ESIZE
    180  * Purpose:
    181  *      Number of bits per entry in vd_pbvl bitmap
    182  */
    183 
    184 #define _BCM_PORT_VD_PBVL_ESIZE      8
    185 
    186 /*
    187  * Define:
    188  *      _BCM_PORT_VD_PBVL_SET, _BCM_PORT_VD_PBVL_CLEAR
    189  * Purpose:
    190  *      Set/clear bit in vp_pbvl bitmap for unit, port, index
    191  */
    192 #define _BCM_PORT_VD_PBVL_SET(_pinfo, _idx) \
    193         (_pinfo)->p_vd_pbvl[(_idx) / _BCM_PORT_VD_PBVL_ESIZE] |= \
    194                 (1 << ((_idx) % _BCM_PORT_VD_PBVL_ESIZE))
    195 
    196 #define _BCM_PORT_VD_PBVL_CLEAR(_pinfo, _idx) \
    197         (_pinfo)->p_vd_pbvl[(_idx)/ _BCM_PORT_VD_PBVL_ESIZE] &= \
    198                 ~(1 << ((_idx) % _BCM_PORT_VD_PBVL_ESIZE))
    199 
    200 /*
    201  * Define:
    202  *      PORT_VD_PBVL_IS_SET
    203  * Purpose:
    204  *      Test if bit in vp_pbvl bitmap is set for unit, port, index
    205  */
    206 #define _BCM_PORT_VD_PBVL_IS_SET(_pinfo, _idx) \
    207         (((_pinfo)->p_vd_pbvl[(_idx) / _BCM_PORT_VD_PBVL_ESIZE] \
    208                 >> ((_idx) % _BCM_PORT_VD_PBVL_ESIZE)) & 1)
    209 
    210 #define _PORT_INFO_STOP_TX              1
    211 #define _PORT_INFO_PROBE_RESET_SERDES   2
    212 
    213 /*
    214  * Define:
    215  *      PORT_LOCK/PORT_UNLOCK
    216  * Purpose:
    217  *      Serialization Macros.
    218  *      Here the cmic memory lock also serves to protect the
    219  *      bcm_port_info structure and EPC_PFM registers.
    220  */
    221 
    222 #define PORT_LOCK(unit) \
    223         BCM_LOCK(unit); \
    224         if (soc_mem_is_valid(unit, PORT_TABm)) \
    225         { soc_mem_lock(unit, PORT_TABm); }
    226 
    227 
    228 #define PORT_UNLOCK(unit) \
    229         BCM_UNLOCK(unit); \
    230         if (soc_mem_is_valid(unit, PORT_TABm)) \
    231         { soc_mem_unlock(unit, PORT_TABm); }
    232 
    233 typedef struct _bcm_port_metering_info_s {
    234     uint32 refresh;
    235     uint32 threshold;
    236     uint32 bucket;
    237     uint8  in_profile;
    238 } _bcm_port_metering_info_t; 
    239 
    240 /*
    241  * The port structure and hardware PTABLE are protected by the PORT_LOCK.
    242  */
    243 typedef struct _bcm_port_info_s {
    244     mac_driver_t       *p_mac;          /* Per port MAC driver */
    245     int                 p_ut_prio;      /* Untagged priority   */
    246     uint8               *p_vd_pbvl;     /* Proto-based VLAN_DATA state */
    247     int                 dtag_mode;      /* Double-tag mode */
    248     int                 vlan_prot_ptr;  /* VLAN_PROTOCOL_DATA index */
    249     int                 vp_count;       /* Number of VPs on a physical port */
    250     bcm_port_congestion_config_t *e2ecc_config; 
    251                                         /* End-to-end congestion control configuration */ 
    252     uint32              cosmask;        /* Cached h/w value on a port stop */
    253     _bcm_port_metering_info_t m_info;   /* Cached h/w value on a port stop */
    254     uint8               flags;          /* Bits to indicate port stop etc */
    255     uint8               rx_los;         /* Cached PHY serdes rx_los status */
    256     int                 enable;         /* Cached port enable status */   	
    257     bcm_port_if_t       intf;           /* Cached port interface */
    258     int                 link_delay_offset; /* link delay offset */
    259     int                 port_dscp_map_set; /* dscp map set */
    260 } _bcm_port_info_t;
    261 
    262 /*
    263  * Internal port configuration enum.
    264  * Used internally by sdk to set port configuration from 
    265  */
    266 typedef enum _bcm_port_config_e {
    267    _bcmPortL3UrpfMode,          /* L3 unicast packet RPF check mode.  */
    268    _bcmPortL3UrpfDefaultRoute,  /* UPRF check accept default gateway. */
    269    _bcmPortVlanTranslate,       /* Enable Vlan translation on the port. */
    270    _bcmPortVlanPrecedence,      /* Set Vlan lookup precedence between
    271                                  * IP table and MAC table             */
    272    _bcmPortVTMissDrop,          /* Drop if VLAN translate miss.       */
    273    _bcmPortLookupMACEnable,     /* Enable MAC-based VLAN              */
    274    _bcmPortLookupIPEnable,      /* Enable subnet-based VLAN           */
    275    _bcmPortUseInnerPri,         /* Trust the inner vlan tag PRI bits  */
    276    _bcmPortUseOuterPri,         /* Trust the outer vlan tag PRI bits  */
    277    _bcmPortVerifyOuterTpid,     /* Verify outer TPID against VLAN TPID*/
    278    _bcmPortVTKeyTypeFirst,      /* First Vlan Translation Key Type    */
    279    _bcmPortVTKeyPortFirst,      /* First Per-port VT Key Type         */
    280    _bcmPortVTKeyTypeSecond,     /* Second Vlan Translation Key Type   */
    281    _bcmPortVTKeyPortSecond,     /* Second Per-port VT Key Type        */
    282    _bcmPortIpmcV4Enable,        /* Enable IPv4 IPMC processing        */
    283    _bcmPortIpmcV6Enable,        /* Enable IPv4 IPMC processing        */
    284    _bcmPortIpmcVlanKey,         /* Include VLAN in L3 host key for IPMC */
    285    _bcmPortCfiAsCng,            /* Configure CFI to CNG mapping       */
    286    _bcmPortNni,                 /* Set port as NNI                    */
    287    _bcmPortHigigTrunkId,        /* Higig trunk, -1 to disable         */
    288    _bcmPortModuleLoopback,      /* Allow loopback to same modid       */
    289    _bcmPortOuterTpidEnables,    /* Bitmap of outer TPID valid bits    */
    290 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
    291     defined(BCM_GREYHOUND2_SUPPORT)
    292    _bcmPortSvcMeterIndex,       /* Service Meter(global meter) index  */
    293    _bcmPortSvcMeterOffsetMode,  /* Service Meter offset mode          */
    294 #endif /* BCM_KATANA_SUPPORT || BCM_TRIUMPH3_SUPPORT ||
    295           BCM_GREYHOUND2_SUPPORT */
    296 #if defined(BCM_KATANA2_SUPPORT)
    297    _bcmPortOamUseXlatedInnerVlan, /* Use Xlated C vlan for OAM lookup  */
    298 #endif
    299    _bcmPortCount                /* Always last max value of the enum. */
    300 } _bcm_port_config_t;
    301 
    302 typedef enum bcmi_port_mac_type_e {
    303     bcmiPortMacTypePortmode = 0,
    304     bcmiPortMacTypeUnimac = 1,
    305     bcmiPortMacTypeXLmac = 2,
    306     bcmiPortMacTypeCLmac = 3,
    307     bcmiPortMacTypeCounts = 4
    308 } bcmi_port_mac_type_t;
    309 
    310 /*
    311  * Port configuration structure.
    312  * An abstraction of data in the PTABLE (strata) and other places.
    313  */
    314 
    315 typedef struct bcm_port_cfg_s {
    316     int		pc_frame_type;
    317     int		pc_ether_type;
    318 
    319     int		pc_stp_state;	  /* spanning tree state of port */
    320     int		pc_cpu;		  /* CPU learning */
    321     int		pc_disc;	  /* discard state */
    322     int		pc_bpdu_disable;  /* Where is this in Draco? */
    323     int		pc_trunk;	  /* trunking on for this port */
    324     int		pc_tgid;	  /* trunk group id */
    325     int		pc_mirror_ing;	  /* mirror on ingress */
    326     int		pc_ptype;	  /* port type */
    327     int		pc_jumbo;
    328     int		pc_cml;		  /* CML bits */
    329     int     pc_cml_move;  /* CML move bits on supporting devices */  
    330 
    331     bcm_pbmp_t	pc_pbm;		  /* port bitmaps for port based vlan */
    332     bcm_pbmp_t	pc_ut_pbm;
    333     bcm_vlan_t	pc_vlan;	  /* port based vlan tag */
    334     bcm_vlan_t	pc_ivlan;	  /* port based inner-tag vlan tag */
    335     int         pc_vlan_action;   /* port based vlan action profile pointer */
    336 
    337 #if defined(BCM_STRATA2_SUPPORT)
    338     int		pc_stg;		  /* stg value */
    339     int		pc_rsvd1;	  /* Reserved field (must be ones) */
    340 #endif
    341 
    342     int		pc_l3_flags;	  /* L3 flags. */
    343 
    344 #if defined(BCM_STRATA2_SUPPORT) || defined(BCM_XGS_SWITCH_SUPPORT)
    345     int		pc_remap_pri_en;  /* remap priority enable */
    346 #endif
    347 
    348     int	        pc_new_opri;      /* new outer packet priority */
    349     int	        pc_new_ocfi;      /* new outer cfi */
    350     int	        pc_new_ipri;      /* new inner packet priority */
    351     int	        pc_new_icfi;      /* new inner cfi */
    352 
    353     int		pc_dse_mode;	  /* DSCP mapping (off, or on/mode) */
    354     int		pc_dse_mode_ipv6;	  /* DSCP mapping for IPv6 (off, or on/mode) */
    355     int		pc_dscp;	  /* Resultant diffserv code point */
    356 
    357 #if defined(BCM_XGS_SWITCH_SUPPORT)
    358     int         pc_en_ifilter;    /* Enable Ingress Filtering */
    359     int         pc_pfm;           /* In the port table for Draco */
    360     int         pc_dscp_prio;     /* For Draco15 & Tucana */
    361     int         pc_bridge_port;   /* FB/ER, allows egress=ingress */
    362     int         pc_nni_port;      /* FB, indicates non-customer port */
    363 #endif
    364 
    365 #if defined(BCM_XGS3_SWITCH_SUPPORT)
    366     int     pc_urpf_mode;         /* Unicast rpf lookup mode.      */
    367     int     pc_urpf_def_gw_check; /* Unicast rpf check default gw. */ 
    368     int     pc_pvlan_enable;      /* Private (force) vlan enable */
    369 #endif
    370 
    371 } bcm_port_cfg_t;
    372 
    373 typedef struct _bcm_gport_dest_s {
    374     bcm_port_t      port;
    375     bcm_module_t    modid;
    376     bcm_trunk_t     tgid;
    377     int             mpls_id;
    378     int             mim_id;
    379     int             wlan_id;
    380     int             trill_id;
    381     int             l2gre_id;
    382     int             vxlan_id;
    383     int             flow_id;
    384     int             vlan_vp_id;
    385     int             niv_id;
    386     int             extender_id;
    387     int             subport_id;
    388     int             scheduker_id;
    389     uint32          gport_type;
    390 } _bcm_gport_dest_t;
    391 
    392 typedef struct _bcm_port_egr_dest_s {
    393     bcm_port_t      in_port;
    394     bcm_module_t    in_modid;
    395     bcm_port_t      out_min_port;
    396     bcm_module_t    out_min_modid;
    397     bcm_port_t      out_max_port;
    398     bcm_module_t    out_max_modid;
    399 } _bcm_port_egr_dest_t;
    400 
    401 #ifdef BCM_TRIUMPH3_SUPPORT
    402 typedef struct _port_ibod_ctrl_s
    403 {
    404     char taskname[16];
    405     sal_sem_t sema;
    406     int interval;
    407     int running;
    408     int stop;
    409     int unit;
    410     uint64 rrpkt[SOC_MAX_NUM_PORTS];
    411     uint64 rrbyt[SOC_MAX_NUM_PORTS];
    412     uint64 rrpkt_old[SOC_MAX_NUM_PORTS];
    413     uint64 rrbyt_old[SOC_MAX_NUM_PORTS];
    414     uint64 txerrpkt[SOC_MAX_NUM_PORTS];
    415     uint64 tuflpkt[SOC_MAX_NUM_PORTS];
    416     bcm_pkt_t pkt;
    417     sal_usecs_t start_time;
    418     uint32 event_count;
    419     uint32 port_avg_time;
    420     uint32 txerr_count;
    421     uint32 txerr_avg_time;
    422     uint32 mmu_war_count;
    423     uint32 mmu_avg_time;
    424     int drain_timeout_flag;
    425     int port_recovery_failed_flag;
    426     uint32 egress_drain_timeout_count;
    427     uint32 drain_timeout_count;
    428     uint32 port_recovery_failed_count;
    429 } _port_ibod_ctrl_t;
    430 #endif
    431 
    432 enum NIV_VNTAG_ACTIONS {
    433     VNTAG_NOOP = 0,
    434     VNTAG_ADD = 1,
    435     VNTAG_REPLACE = 2,
    436     VNTAG_DELETE = 3,
    437     VNTAG_ACTION_COUNT
    438 };
    439 
    440 /*
    441  * Datastructure used to store the Port Force Forward 
    442  * information. This is when the port flaps.
    443  */
    444 typedef struct _bcm_port_force_forward_linkstate_{
    445     uint8 num_pbmp_entry;
    446     uint8 lock;
    447     bcm_pbmp_t *sw_disable_pbmp_linkstate;
    448 } _bcm_port_force_forward_linkstate_t;
    449 
    450 #ifdef BCM_TRIUMPH3_SUPPORT
    451 #define _PORT_IBOD_FLAG_MMU_TRIGGER           1
    452 
    453 extern void _bcm_esw_ibod_debug_flag_set(int unit, int flag);
    454 extern int _bcm_esw_ibod_sync_recovery_start(int unit, sal_usecs_t interval);
    455 extern int _bcm_esw_ibod_sync_recovery_stop(int unit);
    456 extern int _bcm_esw_ibod_sync_recovery_running(int unit, _port_ibod_ctrl_t *ibod_ctrl);
    457 #endif
    458 
    459 #ifdef BCM_HIGIG2_SUPPORT
    460 extern int _bcm_esw_port_higig2_mode_set(int unit, bcm_port_t port, int higig2_mode);
    461 #endif
    462 
    463 extern int _bcm_port_encap_xport_set(int unit, bcm_port_t port, int mode,
    464                                      int update_port_mode);
    465 extern int _bcm_esw_port_mon_start(int unit);
    466 extern int _bcm_esw_port_mon_stop(int unit);
    467 extern int _bcm_esw_port_deinit(int unit);
    468 extern int _bcm_port_probe(int unit, bcm_port_t p, int *okay);
    469 extern int bcm_port_settings_init(int unit, bcm_port_t p);
    470 extern int _bcm_port_mirror_enable_set(int unit, bcm_port_t port,
    471                                        int enable);
    472 extern int _bcm_port_mirror_enable_get(int unit, bcm_port_t port,
    473                                        int *enable);
    474 extern int _bcm_port_mirror_egress_true_enable_set(int unit, bcm_port_t port,
    475                                                    int enable);
    476 extern int _bcm_port_mirror_egress_true_enable_get(int unit, bcm_port_t port,
    477                                                    int *enable);
    478 extern int _bcm_port_link_get(int unit, bcm_port_t port, int hw, int *link);
    479 extern int _bcm_port_pd10_handler(int unit, bcm_port_t port, int link_up);
    480 extern int _bcm_port_untagged_vlan_get(int unit, bcm_port_t port,
    481 				bcm_vlan_t *vid_ptr);
    482 extern int _bcm_esw_port_config_set(int unit, bcm_port_t port, 
    483                                     _bcm_port_config_t type, int value);
    484 extern int _bcm_esw_port_config_get(int unit, bcm_port_t port, 
    485                                     _bcm_port_config_t type, int *value);
    486 extern void _bcm_gport_dest_t_init(_bcm_gport_dest_t *gport_dest);
    487 extern int _bcm_gport_modport_hw2api_map(int, bcm_module_t, bcm_port_t,
    488                                          bcm_module_t *, bcm_port_t *);
    489 extern int _bcm_esw_gport_construct(int unit, _bcm_gport_dest_t *gport_dest, 
    490                                     bcm_gport_t *gport);
    491 extern int _bcm_esw_gport_resolve(int unit, bcm_gport_t gport,
    492                                   bcm_module_t *modid, bcm_port_t *port, 
    493                                   bcm_trunk_t *trunk_id, int *id);
    494 extern int _bcm_esw_port_is_local_subport(int unit, bcm_gport_t gport,
    495                                           bcm_module_t modid, bcm_port_t port,
    496                                           int *is_local_subport,
    497                                           bcm_port_t *phy_port);
    498 extern bcm_gport_t _bcm_esw_port_gport_get_from_modport(int unit, bcm_module_t modid,
    499                                                         bcm_port_t port);
    500 extern int _bcm_esw_modid_is_local(int unit, bcm_module_t modid, int *result);
    501 extern int _bcm_esw_port_link_delay_update(int unit, bcm_port_t port, int speed);
    502 extern int _bcm_port_info_get(int unit, bcm_port_t port, _bcm_port_info_t **pinfo);
    503 extern int _bcm_esw_port_gport_validate(int unit, bcm_port_t port_in, 
    504                                         bcm_port_t *port_out);
    505 extern int _bcm_esw_port_gport_phyn_validate(int unit, bcm_port_t port,
    506                                              bcm_port_t *local_port, int *phyn,
    507                                              int *phy_lane, int *sys_side);
    508 extern int _bcm_port_encap_stport_set(int unit, bcm_port_t port, int mode);
    509 extern int _bcm_port_ehg_header_write(int, bcm_port_t, uint32 *, uint32 *, uint32 *,
    510                                           int);
    511 extern int _bcm_port_mode_setup(int unit, bcm_port_t port, int enable);
    512 extern void _bcm_port_info_access(int unit, bcm_port_t port, 
    513                                   _bcm_port_info_t **info);
    514 extern unsigned _bcm_esw_valid_flex_port_controlling_port(int unit, bcm_port_t port);
    515 extern int
    516 _bcm_esw_port_tab_multi_set(int unit, bcm_port_t port, int cpu_tabs,
    517                             int field_count, soc_field_t *fields,
    518                             uint32 *values);
    519 extern int _bcm_esw_port_tab_set(int unit, bcm_port_t port, int cpu_tabs,
    520                       soc_field_t field, int value);
    521 extern int _bcm_esw_port_tab_set_without_portlock(int unit, bcm_port_t port,
    522                                                   int cpu_tabs,
    523                                                   soc_field_t field, int value);
    524 extern int _bcm_esw_port_tab_get(int unit, bcm_port_t port, 
    525                       soc_field_t field, int *value);
    526 extern int _bcm_esw_egr_port_tab_set(int unit, bcm_port_t port,
    527                           soc_field_t field, uint32 value);
    528 extern int _bcm_esw_egr_port_tab_get(int unit, bcm_port_t port,
    529                           soc_field_t field, int *value);
    530 
    531 
    532 #define _BCM_ESW_PT_PORT        0
    533 #define _BCM_ESW_PT_COE         1
    534 #define _BCM_ESW_PT_HGPROXY     2
    535 
    536 extern int bcm_esw_port_lport_prof_src_check(int unit, int port_type, int *);
    537 
    538 extern int
    539 bcm_esw_port_lport_fields_set(int unit, bcm_port_t port,
    540                               int table_id, int field_count,
    541                               soc_field_t *fields, uint32 *values);
    542 
    543 extern int
    544 bcm_esw_port_lport_fields_get(int unit, bcm_port_t port,
    545                               int table_id, int field_count,
    546                               soc_field_t *fields, uint32 *values);
    547 extern int
    548 bcm_esw_port_lport_field_set(int unit, bcm_port_t port,
    549                              int table_id, soc_field_t field, uint32 value);
    550 
    551 extern int
    552 bcm_esw_port_lport_field_get(int unit, bcm_port_t port,
    553                              int table_id, soc_field_t field, uint32 *value);
    554 extern int
    555 _bcm_esw_egr_port_tab_multi_set(int unit, bcm_port_t port, int field_count,
    556         soc_field_t *fields, uint32 *values);
    557 
    558 extern int
    559 bcm_esw_port_egr_lport_fields_set(int unit, bcm_port_t port,
    560                               soc_mem_t mem, int field_count,
    561                               soc_field_t *fields, uint32 *values);
    562 
    563 extern int
    564 bcm_esw_port_egr_lport_fields_clear(int unit, bcm_port_t port,
    565                                     soc_mem_t mem);
    566 extern int
    567 bcm_esw_port_egr_lport_fields_get(int unit, bcm_port_t port,
    568                               soc_mem_t mem, int field_count,
    569                               soc_field_t *fields, uint32 *values);
    570 
    571 extern int
    572 bcm_esw_port_egr_lport_field_set(int unit, bcm_port_t port,
    573                              soc_mem_t mem, soc_field_t field, uint32 value);
    574 
    575 extern int
    576 bcm_esw_port_egr_lport_field_get(int unit, bcm_port_t port,
    577                              soc_mem_t mem, soc_field_t field, uint32 *value);
    578 
    579 extern int 
    580 _bcm_esw_link_force_for_disabled_loopback_port(int unit);
    581 
    582 extern int _bcm_esw_port_mac_failover_notify(int,bcm_port_t);
    583 extern int _bcm_esw_port_stat_get(int unit, int sync_mode,
    584                                   bcm_gport_t port, bcm_port_stat_t stat,
    585                                   uint64 *val);
    586 extern int _bcm_esw_port_sw_info_display(int unit, bcm_port_t port);
    587 extern int _bcm_esw_port_hw_info_display(int unit, bcm_port_t port); 
    588 extern void
    589 _bcm_port_force_forward_linkscan_handler(int unit, bcm_port_t port,
    590                                bcm_port_info_t *info);
    591 
    592 #if defined(INCLUDE_L3)
    593 #if defined(BCM_TOMAHAWK2_SUPPORT) || defined(BCM_TRIDENT3_SUPPORT)
    594 extern int _bcm_esw_port_ecmp_dlb_link_status_set(int unit, bcm_port_t port,
    595                                                   int status);
    596 extern int _bcm_esw_port_ecmp_dlb_link_status_get(int unit, bcm_port_t port,
    597                                                   int *status);
    598 #endif /* (BCM_TOMAHAWK2_SUPPORT) || (BCM_TRIDENT3_SUPPORT) */
    599 #endif /* INCLUDE_L3 */
    600 
    601 extern int
    602 _bcm_esw_port_ingress_dest_enable(int unit, bcm_port_t port, int enable);
    603 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT)
    604 extern int
    605 _bcm_sc_tr_port_pfc_tx_set(int unit, bcm_port_t port, uint32 pri_bmp);
    606 #endif
    607 
    608 extern void _bcm_esw_port_mirror_lock(int unit);
    609 extern void _bcm_esw_port_mirror_unlock(int unit);
    610 extern int _bcm_esw_glp_construct(int unit, bcm_trunk_t trunk_id,
    611                                   bcm_module_t modid, bcm_port_t port,
    612                                   bcm_gport_t *glport);
    613 extern int _bcm_esw_glp_resolve(int unit, bcm_trunk_t *is_trunk,
    614                                 bcm_module_t *modid, bcm_port_t *port,
    615                                 bcm_gport_t glport);
    616 extern int _bcm_esw_gport_to_glp(int unit, bcm_gport_t gport,
    617                                  bcm_gport_t *glp);
    618 extern int
    619 bcmi_esw_port_eee_cfg_set(int unit, bcm_port_t port, int value);
    620 
    621 extern int
    622 bcmi_esw_port_egr_prof_ptr_set(int unit, bcm_port_t port, int value);
    623 
    624 extern int bcmi_esw_port_mac_type_get(int unit, bcm_port_t lport,
    625                                       bcmi_port_mac_type_t *type);
    626 extern int bcmi_esw_port_encap_set(int unit, bcm_port_t port, int mode);
    627 
    628 extern int bcmi_port_force_lb_set(int unit);
    629 
    630 #ifdef BCM_KATANA2_SUPPORT
    631 void bcm_esw_kt2_port_lock(int unit);
    632 void bcm_esw_kt2_port_unlock(int unit);
    633 #endif
    634 #ifdef BCM_WARM_BOOT_SUPPORT
    635 extern int _bcm_esw_port_sync(int unit);
    636 extern int _bcm_port_cleanup(int unit);
    637 #else
    638 #define _bcm_port_cleanup(u)        (BCM_E_NONE)
    639 #endif /* BCM_WARM_BOOT_SUPPORT */
    640 
    641 #ifndef BCM_SW_STATE_DUMP_DISABLE
    642 extern void _bcm_esw_flexport_sw_dump(int unit);
    643 extern void _bcm_esw_flexport_sw_pipe_speed_group_dump(
    644         int unit,
    645         int pipe,
    646         int speed_id);
    647 extern void _bcm_port_sw_dump(int unit);
    648 #endif /* BCM_SW_STATE_DUMP_DISABLE */
    649 #ifdef BCM_TRIUMPH3_SUPPORT
    650 #define IBOD_SYNC_INTERVAL_MIN         100000
    651 
    652 extern int _bcm_tr3_port_ur_chk(int unit, int num_ports, bcm_port_t port);
    653 #endif
    654 
    655 #if defined(BCM_TOMAHAWK_SUPPORT)
    656 extern int
    657 bcm_esw_port_asf_mode_get(
    658     int           unit,
    659     bcm_port_t    port,
    660     int* const    mode);
    661 
    662 extern int
    663 bcm_esw_port_asf_mode_set(
    664     int           unit,
    665     bcm_port_t    port,
    666     int           mode);
    667 
    668 extern int
    669 bcm_esw_port_asf_show(
    670     int          unit,
    671     bcm_port_t   port);
    672 
    673 extern int
    674 bcm_esw_asf_diag(int unit);
    675 
    676 extern int
    677 bcm_esw_port_asf_diag(
    678     int          unit,
    679     bcm_port_t   port);
    680 #endif /* BCM_TOMAHAWK_SUPPORT */
    681 
    682 #if defined(BCM_GREYHOUND2_SUPPORT)
    683 extern int
    684 bcmi_gh2_port_e2efc_remote_module_enable_set(
    685     int unit,
    686     bcm_module_t remote_module,
    687     bcm_port_e2efc_mode_t mode,
    688     int enable,
    689     bcm_port_e2efc_remote_module_config_t *e2efc_rmod_cfg);
    690 extern int
    691 bcmi_gh2_port_e2efc_remote_module_enable_get(
    692     int unit,
    693     bcm_module_t remote_module,
    694     bcm_port_e2efc_mode_t mode,
    695     int *enable,
    696     bcm_port_e2efc_remote_module_config_t *e2efc_rmod_cfg);
    697 extern int
    698 bcmi_gh2_port_e2efc_remote_port_init(int unit);
    699 extern int
    700 bcmi_gh2_port_e2efc_remote_port_add(
    701     int unit,
    702     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg,
    703     int *rport_handle_id);
    704 extern int
    705 bcmi_gh2_port_e2efc_remote_port_set(
    706     int unit,
    707     int rport_handle_id,
    708     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg);
    709 extern int
    710 bcmi_gh2_port_e2efc_remote_port_get(
    711     int unit,
    712     int rport_handle_id,
    713     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg);
    714 extern int
    715 bcmi_gh2_port_e2efc_remote_port_delete(
    716     int unit,
    717     int rport_handle_id);
    718 extern int
    719 bcmi_gh2_port_e2efc_remote_module_traverse(
    720     int unit,
    721     bcm_port_e2efc_remote_module_traverse_cb cb,
    722     void *user_data);
    723 extern int
    724 bcmi_gh2_port_e2efc_remote_port_traverse(
    725     int unit,
    726     bcm_port_e2efc_remote_port_traverse_cb cb,
    727     void *user_data);
    728 #endif /* BCM_GREYHOUND2_SUPPORT */
    729 
    730 #if defined(BCM_KATANA2_SUPPORT)
    731 extern int
    732 bcmi_kt2_port_e2efc_remote_module_enable_set(
    733     int unit,
    734     bcm_module_t remote_module,
    735     bcm_port_e2efc_mode_t mode,
    736     int enable,
    737     bcm_port_e2efc_remote_module_config_t *e2efc_rmod_cfg);
    738 extern int
    739 bcmi_kt2_port_e2efc_remote_module_enable_get(
    740     int unit,
    741     bcm_module_t remote_module,
    742     bcm_port_e2efc_mode_t mode,
    743     int *enable,
    744     bcm_port_e2efc_remote_module_config_t *e2efc_rmod_cfg);
    745 extern int
    746 bcmi_kt2_port_e2efc_remote_port_init(int unit);
    747 extern int
    748 bcmi_kt2_port_e2efc_remote_port_add(
    749     int unit,
    750     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg,
    751     int *rport_handle_id);
    752 extern int
    753 bcmi_kt2_port_e2efc_remote_port_set(
    754     int unit,
    755     int rport_handle_id,
    756     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg);
    757 extern int
    758 bcmi_kt2_port_e2efc_remote_port_get(
    759     int unit,
    760     int rport_handle_id,
    761     bcm_port_e2efc_remote_port_config_t *e2efc_rport_cfg);
    762 extern int
    763 bcmi_kt2_port_e2efc_remote_port_delete(
    764     int unit,
    765     int rport_handle_id);
    766 extern int
    767 bcmi_kt2_port_e2efc_remote_module_traverse(
    768     int unit,
    769     bcm_port_e2efc_remote_module_traverse_cb cb,
    770     void *user_data);
    771 extern int
    772 bcmi_kt2_port_e2efc_remote_port_traverse(
    773     int unit,
    774     bcm_port_e2efc_remote_port_traverse_cb cb,
    775     void *user_data);
    776 #endif /* BCM_KATANA2_SUPPORT */
    777 #ifdef SW_AUTONEG_SUPPORT
    778 extern int
    779 _bcm_esw_port_notify_link_down_evt(int unit, bcm_port_t port);
    780 #endif
    781 #if defined(BCM_TRIDENT2PLUS_SUPPORT)
    782 extern int
    783 _bcm_esw_is_multi_nexthop_mod_port(int unit, bcm_module_t modid,
    784                                    bcm_port_t port);
    785 extern int
    786 _bcm_esw_modport_local_get(int unit, bcm_gport_t modport,
    787                            bcm_port_t *local_port);
    788 #endif
    789 
    790 extern int
    791 _bcm_esw_port_vp_gport_check(bcm_gport_t port, int vp);
    792 
    793 #endif	/* !_BCM_INT_PORT_H */