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

macutil.h (5694B)


      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 
      8 #ifndef _SOC_MAC_UTIL_H
      9 #define _SOC_MAC_UTIL_H
     10 
     11 #define spn_LINK_DELAY(s) ((100000 == (s)) ? spn_LINK_DELAY_100GBE_NS : \
     12                            (50000 == (s)) ?  spn_LINK_DELAY_50GBE_NS:   \
     13                            (40000 == (s)) ?  spn_LINK_DELAY_40GBE_NS:   \
     14                            (25000 == (s)) ?  spn_LINK_DELAY_25GBE_NS:   \
     15                            (10000 == (s)) ?  spn_LINK_DELAY_10GBE_NS:   \
     16                            (2500  == (s)) ?  spn_LINK_DELAY_2_5GBE_NS:  \
     17                            (1000  == (s)) ?  spn_LINK_DELAY_1GBE_NS:    \
     18                            (100   == (s)) ?  spn_LINK_DELAY_100MBE_NS:  \
     19                            (10    == (s)) ?  spn_LINK_DELAY_10MBE_NS:   \
     20                            spn_LINK_DELAY_NS)
     21 
     22 /* Timestamp osts adjust */
     23 #define spn_TIMESTAMP_ADJUST(s) ((100000 == (s)) ? spn_TIMESTAMP_ADJUST_100GBE_NS : \
     24                                  (50000 == (s)) ?  spn_TIMESTAMP_ADJUST_50GBE_NS: \
     25                                  (40000 == (s)) ?  spn_TIMESTAMP_ADJUST_40GBE_NS: \
     26                                  (25000 == (s)) ?  spn_TIMESTAMP_ADJUST_25GBE_NS: \
     27                                  (10000 == (s)) ?  spn_TIMESTAMP_ADJUST_10GBE_NS: \
     28                                  (2500  == (s)) ?  spn_TIMESTAMP_ADJUST_2_5GBE_NS: \
     29                                  (1000  == (s)) ?  spn_TIMESTAMP_ADJUST_1GBE_NS: \
     30                                  (100   == (s)) ?  spn_TIMESTAMP_ADJUST_100MBE_NS: \
     31                                  (10    == (s)) ?  spn_TIMESTAMP_ADJUST_10MBE_NS: \
     32                                  spn_TIMESTAMP_ADJUST_NS)
     33 
     34 /* Timestamp tsts adjust */
     35 #define spn_TIMESTAMP_TSTS_ADJUST(s) ((100000 == (s)) ? spn_TIMESTAMP_TSTS_ADJUST_100GBE_NS : \
     36                                       (50000 == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_50GBE_NS: \
     37                                       (40000 == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_40GBE_NS: \
     38                                       (25000 == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_25GBE_NS: \
     39                                       (10000 == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_10GBE_NS: \
     40                                       (2500  == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_2_5GBE_NS: \
     41                                       (1000  == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_1GBE_NS: \
     42                                       (100   == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_100MBE_NS: \
     43                                       (10    == (s)) ?  spn_TIMESTAMP_TSTS_ADJUST_10MBE_NS: \
     44                                       spn_TIMESTAMP_TSTS_ADJUST_NS)
     45 
     46 extern int
     47 soc_egress_cell_count(int unit, soc_port_t port, uint32 *count);
     48 
     49 extern int
     50 soc_mmu_flush_enable(int unit, soc_port_t port, int enable);
     51 
     52 extern int
     53 soc_mmu_port_flush_hw(int unit, soc_port_t port, uint32 drain_timeout);
     54 
     55 extern int
     56 soc_egress_drain_cells(int unit, soc_port_t port, uint32 drain_timeout);
     57 
     58 extern int
     59 soc_txfifo_drain_cells(int unit, soc_port_t port, uint32 drain_timeout);
     60 
     61 extern int
     62 soc_port_credit_reset(int unit, soc_port_t port);
     63 
     64 extern int
     65 soc_port_ingress_buffer_reset(int unit, soc_port_t port, int reset);
     66 
     67 extern int
     68 soc_port_egress_buffer_sft_reset(int unit, soc_port_t port, int reset);
     69 
     70 extern int
     71 soc_port_fifo_reset(int unit, soc_port_t port);
     72 
     73 extern int
     74 soc_port_blk_init(int unit, soc_port_t port);
     75 
     76 extern int
     77 soc_egress_enable(int unit, soc_port_t port, int enable);
     78 
     79 extern int 
     80 soc_packet_purge_control_init(int unit, soc_port_t port);
     81 
     82 extern int
     83 soc_port_speed_update(int unit, soc_port_t port, int speed);
     84 
     85 extern int
     86 soc_port_thdo_rx_enable_set(int unit, soc_port_t port, int enable);
     87 
     88 extern int
     89 soc_llfc_xon_set(int unit, soc_port_t port, int enable);
     90 
     91 extern int
     92 _soc_egress_metering_freeze(int unit, soc_port_t port, void **setting);
     93 
     94 extern int
     95 _soc_egress_metering_thaw(int unit, soc_port_t port, void *setting);
     96 
     97 typedef struct mem_entry_s {
     98     soc_mem_t mem;
     99     int index;
    100     uint32 entry[SOC_MAX_MEM_WORDS];
    101 } mem_entry_t;
    102 
    103 extern int 
    104 soc_port_eee_timers_setup(int unit, soc_port_t port, int speed);
    105 
    106 extern int 
    107 soc_port_eee_timers_init(int unit, soc_port_t port, int speed);
    108 
    109 extern soc_error_t
    110 soc_granular_speed_get(int unit, soc_port_t port, int *speed);
    111 
    112 extern int
    113 soc_port_hg_speed_get(int unit, soc_port_t port, int *speed);
    114 
    115 extern int
    116 soc_mac_x_sync_fifo_reset(int unit, soc_port_t port);
    117 
    118 extern int
    119 soc_pgw_rx_fifo_reset(int unit, int port, int reset);
    120 
    121 extern int
    122 soc_port_mmu_buffer_enable(int unit, int port, int enable);
    123 
    124 #ifdef BCM_TRIUMPH3_SUPPORT
    125 /* NOTE: _mac_x_drain_cells should be used  for ibodsync */
    126 extern int
    127 _mac_x_drain_cells(int unit, soc_port_t port, int notify_phy);
    128 
    129 extern void _soc_egress_drain_timeout_flag_set(int unit, int flag);
    130 extern void _soc_egress_drain_timeout_flag_get(int unit, int *flag);
    131 extern void soc_ibod_recovery_in_progress_set(int unit, int enable);
    132 extern int soc_ibod_recovery_in_progress_get(int unit);
    133 #if defined(IBOD_DEBUG) || defined(TXERR_DEBUG)
    134 extern int  _soc_egress_drain_debug(int unit, soc_port_t port, soc_reg_t reg);
    135 #endif /* IBOD_DEBUG || TXERR_DEBUG */
    136 extern int _soc_egress_drain_credit_calc(uint32 credit_current, uint32 credit_default,
    137                             uint32 mmu_req, uint32 ep_level, uint32 *credit_set);
    138 extern int _soc_egress_drain_ep_max_level_get(int unit, soc_port_t port, uint32 *ep_max_level);
    139 #endif
    140 
    141 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_TRIDENT_SUPPORT)
    142 extern int _mac_x_reinit(int unit, soc_port_t port);
    143 #endif
    144 
    145 #endif  /* !_SOC_MAC_UTIL_H */