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

xlmac.h (11964B)


      1 /*
      2  *         
      3  * 
      4  * 
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      8  */
      9 
     10 #ifndef _PORTMOD_XLMAC_H_
     11 #define _PORTMOD_XLMAC_H_
     12 
     13 #include <soc/portmod/portmod.h>
     14 
     15 #define XLMAC_ENCAP_SET_FLAGS_NO_SOP_FOR_CRC_HG   (1)
     16 #define XLMAC_ENCAP_SET_FLAGS_EXTENDED_HIGIG2_EN  (2)
     17 #define XLMAC_ENCAP_SET_FLAGS_SOFT_RESET_DIS      (4)
     18 #define XLMAC_SPEED_SET_FLAGS_SOFT_RESET_DIS      (1)
     19 
     20 #define XLMAC_ENABLE_SET_FLAGS_SOFT_RESET_DIS     0x1
     21 #define XLMAC_ENABLE_SET_FLAGS_TX_EN              0x2
     22 #define XLMAC_ENABLE_SET_FLAGS_RX_EN              0x4
     23 
     24 #define XLMAC_ENABLE_RX  (1)
     25 #define XLMAC_ENABLE_TX  (2)
     26 
     27 #define XLMAC_INIT_F_RX_STRIP_CRC               0x1
     28 #define XLMAC_INIT_F_TX_APPEND_CRC              0x2
     29 #define XLMAC_INIT_F_TX_REPLACE_CRC             0x4
     30 #define XLMAC_INIT_F_TX_PASS_THROUGH_CRC_MODE   0x8
     31 #define XLMAC_INIT_F_IS_HIGIG                   0x10
     32 #define XLMAC_INIT_F_IPG_CHECK_DISABLE          0x20
     33 
     34 /* MAC Preemption TX status */
     35 /*
     36  * if VERIFY_ENABLE = 1, but its status is failed or not initiaded
     37  * if VERIFY_ENABLE = 0, preemption is not enabled
     38  */
     39 #define XLMAC_PREEMPT_TX_INACTIVE             0x0
     40 /*
     41  * Preemption is enabled, Verify is enabled and its
     42  * operation is in progress.
     43  */
     44 #define XLMAC_PREEMPT_TX_VERIFY_IN_PROGRESS   0x1
     45 /*
     46  * Preemption is enabled and active.
     47  * if VERIFY_ENABLE = 1, verify is enabled and succeed
     48  * if VERIFY_ENABLE = 0, preemption is enabled
     49  */
     50 #define XLMAC_PREEMPT_TX_ACTIVE               0x2
     51 
     52 /* MAC preemption verification state */
     53 #define XLMAC_PREEMPT_VERIFY_DISABLED    0x0 /* disabled */
     54 #define XLMAC_PREEMPT_VERIFY_INITIAL     0x1 /* enabled but not started */
     55 #define XLMAC_PREEMPT_VERIFY_VERIFYING   0x2 /* in progress */
     56 #define XLMAC_PREEMPT_VERIFY_SUCCEED     0x3 /* successful */
     57 #define XLMAC_PREEMPT_VERIFY_FAILED      0x4 /* failed */
     58 
     59 /*
     60  * MAC Preemption Tx status flags
     61  * These macros are used as flags to retrieve the preemption status
     62  * on the transmit side.
     63  * Used by function xlmac_preemption_tx_status_get() to get either
     64  * TX, Verify operation status or Number of Verify Messages sent
     65  * during preemption.
     66  */
     67 #define XLMAC_PREEMPTION_TX_STATUS          0x1
     68 #define XLMAC_PREEMPTION_VERIFY_STATUS      0x2
     69 #define XLMAC_PREEMPTION_VERIFY_CNT_STATUS  0x3
     70 
     71 /* MAC preemption force lost rx EOP flags */
     72 #define XLMAC_PREEMPTION_FORCE_SW_RX_EOP       0x1
     73 #define XLMAC_PREEMPTION_FORCE_AUTO_HW_RX_EOP  0x2
     74 
     75 /* MAC timestamp byte adjust flags */
     76 #define XLMAC_TIMESTAMP_BYTE_ADJUST_CLEAR 0x1
     77 
     78 int xlmac_init          (int unit, soc_port_t p, uint32_t f);
     79 int xlmac_speed_set     (int unit, soc_port_t p, int flags, int speed);
     80 int xlmac_encap_set     (int unit, soc_port_t p, int flags, portmod_encap_t encap);
     81 int xlmac_encap_get     (int unit, soc_port_t p, int *flgs, portmod_encap_t *encap);
     82 int xlmac_enable_set    (int unit, soc_port_t p, int flags, int enable);
     83 int xlmac_enable_get    (int unit, soc_port_t p, int flags, int *enable);
     84 int xlmac_duplex_set    (int unit, soc_port_t p, int duplex);
     85 int xlmac_duplex_get    (int unit, soc_port_t p, int *duplex);
     86 int xlmac_speed_get     (int unit, soc_port_t port, int *speed);
     87 int xlmac_loopback_set  (int unit, soc_port_t p, int enable);
     88 int xlmac_loopback_get  (int unit, soc_port_t p, int *enable);
     89 int xlmac_discard_set   (int unit, soc_port_t port, int discard);
     90 int xlmac_tx_enable_set (int unit, soc_port_t port, int enable);
     91 int xlmac_tx_enable_get (int unit, soc_port_t port, int *enable);
     92 int xlmac_rx_enable_set (int unit, soc_port_t port, int enable);
     93 int xlmac_rx_enable_get (int unit, soc_port_t port, int *enable);
     94 int xlmac_tx_mac_sa_set (int unit, soc_port_t p, sal_mac_addr_t mac);
     95 int xlmac_tx_mac_sa_get (int unit, soc_port_t p, sal_mac_addr_t mac);
     96 int xlmac_rx_mac_sa_set (int unit, soc_port_t p, sal_mac_addr_t mac);
     97 int xlmac_rx_mac_sa_get(int unit, soc_port_t port, sal_mac_addr_t mac);
     98 
     99 int xlmac_soft_reset_set     (int unit, soc_port_t p, int enable);
    100 int xlmac_soft_reset_get     (int unit, soc_port_t p, int *enable);
    101 int xlmac_rx_vlan_tag_set    (int unit, soc_port_t p, int outer_vlan_tag, int inner_vlan_tag);
    102 int xlmac_rx_vlan_tag_get    (int unit, soc_port_t p, int *outer_vlan_tag, int *inner_vlan_tag);
    103 int xlmac_rx_max_size_set    (int unit, soc_port_t p, int value);
    104 int xlmac_rx_max_size_get    (int unit, soc_port_t p, int *value);
    105 int xlmac_pad_size_set(int unit, soc_port_t port, int value);
    106 int xlmac_pad_size_get(int unit, soc_port_t port, int *value);
    107 int xlmac_tx_average_ipg_set (int unit, soc_port_t p, int val);
    108 int xlmac_tx_average_ipg_get (int unit, soc_port_t p, int *val);
    109 int xlmac_runt_threshold_set (int unit, soc_port_t p, int value);
    110 int xlmac_runt_threshold_get (int unit, soc_port_t p, int *value);
    111 int xlmac_strict_preamble_set (int unit, soc_port_t p, int value);
    112 int xlmac_strict_preamble_get (int unit, soc_port_t p, int *value);
    113 int xlmac_sw_link_status_set (int unit, soc_port_t p, int link);
    114 
    115 int xlmac_tx_preamble_length_set    (int unit, soc_port_t p, int length);
    116 int xlmac_sw_link_status_select_set (int unit, soc_port_t p, int enable);
    117 int xlmac_sw_link_status_select_get (int unit, soc_port_t p, int *enable);
    118 
    119 int xlmac_timestamp_delay_set(int unit, soc_port_t port, portmod_port_ts_adjust_t ts_adjust, int speed);
    120 int xlmac_timestamp_delay_get(int unit, soc_port_t port, portmod_port_ts_adjust_t *ts_adjust);
    121 int xlmac_timestamp_byte_adjust_set(int unit, soc_port_t port, int flags, int speed);
    122 
    123 /******************************************************************************* 
    124  Remote/local Fault
    125  */
    126 int xlmac_local_fault_status_get  (int unit, soc_port_t p, int *status);
    127 int xlmac_remote_fault_status_get (int unit, soc_port_t p, int *status);
    128 int xlmac_local_fault_control_set (int unit, soc_port_t p, const portmod_local_fault_control_t *control);
    129 int xlmac_local_fault_control_get (int unit, soc_port_t p, portmod_local_fault_control_t *control);
    130 int xlmac_remote_fault_control_get(int unit, soc_port_t p, portmod_remote_fault_control_t *control);
    131 int xlmac_remote_fault_control_set(int unit, soc_port_t p, const portmod_remote_fault_control_t *control);
    132 int xlmac_clear_rx_lss_status_set (int unit, soc_port_t port, int lcl_fault, int rmt_fault);
    133 int xlmac_clear_rx_lss_status_get (int unit, soc_port_t port, int *lcl_fault, int *rmt_fault);
    134 
    135 /******************************************************************************* 
    136  Flow Control
    137  */
    138 int xlmac_pfc_control_set   (int unit, soc_port_t p, const portmod_pfc_control_t *control);
    139 int xlmac_pfc_control_get   (int unit, soc_port_t p, portmod_pfc_control_t *control);
    140 int xlmac_llfc_control_set  (int unit, soc_port_t p, const portmod_llfc_control_t *control);
    141 int xlmac_llfc_control_get  (int unit, soc_port_t p, portmod_llfc_control_t *control);
    142 int xlmac_pause_control_set (int unit, soc_port_t p, const portmod_pause_control_t *control);
    143 int xlmac_pause_control_get (int unit, soc_port_t p, portmod_pause_control_t *control);
    144 
    145 /*****************************************************************************
    146  send CTRL/PAUSE/PFC  frame to system side
    147  */
    148 int xlmac_pass_control_frame_set(int unit, int port, int value);
    149 int xlmac_pass_pfc_frame_set(int unit, int port, int value);
    150 int xlmac_pass_pause_frame_set(int unit, int port, int value);
    151 int xlmac_pass_control_frame_get(int unit, int port, int *value);
    152 int xlmac_pass_pfc_frame_get(int unit, int port, int *value);
    153 int xlmac_pass_pause_frame_get(int unit, int port, int *value);
    154 
    155 /***************************************************************************** 
    156  SDK Support Functions 
    157  */
    158 int xlmac_eee_set (int u, int p, const portmod_eee_t* eee);
    159 int xlmac_eee_get (int u, int p, const portmod_eee_t* eee);
    160 
    161 int xlmac_pfc_config_set (int u, int p, const portmod_pfc_config_t* pfc_cfg);
    162 int xlmac_pfc_config_get (int u, int p, const portmod_pfc_config_t* pfc_cfg);
    163 
    164 int xlmac_diag_fifo_status_get (int u, int p, const portmod_fifo_status_t* inf);
    165 int xlmac_timesync_tx_info_get (int unit, int port, portmod_fifo_status_t* tx_info);
    166 
    167 int xlmac_frame_spacing_stretch_set (int u, int p, int spacing);
    168 int xlmac_frame_spacing_stretch_get (int u, int p, int *spacing);
    169 
    170 int xlmac_lag_failover_loopback_set(int unit, int port, int val);
    171 int xlmac_lag_failover_loopback_get(int unit, int port, int *val);
    172 
    173 int xlmac_lag_failover_en_get(int unit, int port, int *val);
    174 int xlmac_lag_failover_en_set(int unit, int port, int val);
    175 
    176 int xlmac_reset_fc_timers_on_link_dn_get (int unit, soc_port_t port, int *val);
    177 int xlmac_reset_fc_timers_on_link_dn_set (int unit, soc_port_t port, int val);
    178 
    179 int xlmac_lag_remove_failover_lpbk_get(int unit, int port, int *val);
    180 int xlmac_lag_remove_failover_lpbk_set(int unit, int port, int val);
    181 
    182 int xlmac_lag_failover_disable(int unit, int port);
    183 
    184 int xlmac_mac_ctrl_set    (int u, int p, uint64 ctrl);
    185 int xlmac_drain_cell_get  (int unit, int port, portmod_drain_cells_t *drain_cells);
    186 int xlmac_drain_cell_stop (int unit, int port, const portmod_drain_cells_t *drain_cells);
    187 int xlmac_drain_cell_start(int u, int p);
    188 
    189 int xlmac_txfifo_cell_cnt_get     (int u, int p, uint32* fval);
    190 int xlmac_egress_queue_drain_get  (int u, int p, uint64 *ctrl, int *rx);
    191 
    192 int xlmac_drain_cells_rx_enable   (int u, int p, int rx_en);
    193 int xlmac_egress_queue_drain_rx_en(int u, int p, int rx_en);
    194 int xlmac_reset_check(int u, int p, int enable, int *reset);
    195 
    196 int xlmac_e2ecc_hdr_get (int unit, int port, uint32_t *words);
    197 int xlmac_e2ecc_hdr_set (int unit, int port, uint32_t *words);
    198 
    199 int xlmac_e2e_enable_set(int unit, int port, int enable);
    200 int xlmac_e2e_enable_get(int unit, int port, int *nable);
    201 
    202 /*****************************************************************************
    203 Interrupt enable and status
    204  */
    205 int xlmac_interrupt_enable_get(int unit, int port, int intr_type, uint32 *value);
    206 int xlmac_interrupt_enable_set(int unit, int port, int intr_type, uint32 value);
    207 int xlmac_interrupt_status_get(int unit, int port, int intr_type, uint32 *value);
    208 int xlmac_interrupts_status_get(int unit, int port, int arr_max_size, uint32* intr_arr, uint32* size);
    209 
    210 int xlmac_preemption_mode_set(int32 unit, soc_port_t port, uint32 enable);
    211 int xlmac_preemption_mode_get(int32 unit, soc_port_t port, uint32 *enable);
    212 
    213 int xlmac_preemption_tx_enable_set(int32 unit, soc_port_t port, uint32 enable);
    214 int xlmac_preemption_tx_enable_get(int32 unit, soc_port_t port, uint32 *enable);
    215 
    216 int xlmac_preemption_verify_enable_set(int32 unit, soc_port_t port,
    217                                        uint32 enable);
    218 int xlmac_preemption_verify_enable_get(int32 unit, soc_port_t port,
    219                                        uint32 *enable);
    220 
    221 int xlmac_preemption_verify_time_set(int32 unit, soc_port_t port,
    222                                      uint32 time_val);
    223 int xlmac_preemption_verify_time_get(int32 unit, soc_port_t port,
    224                                      uint32 *time_val);
    225 
    226 int xlmac_preemption_verify_attempts_set(int32 unit, soc_port_t port,
    227                                          uint32 num_attempts);
    228 int xlmac_preemption_verify_attempts_get(int32 unit, soc_port_t port,
    229                                          uint32 *num_attempts);
    230 
    231 int xlmac_preemption_tx_status_get(int unit, soc_port_t port,
    232                                    int flags, uint32 *value);
    233 
    234 int xlmac_preemption_force_rx_lost_eop_set(int unit, soc_port_t port,
    235                                            int flags, uint32 value);
    236 int xlmac_preemption_force_rx_lost_eop_get(int unit, soc_port_t port,
    237                                            int flags, uint32 *value);
    238 
    239 int xlmac_preemption_rx_timeout_info_set(int unit, soc_port_t port,
    240                                          uint32 enable, uint32 timeout_val);
    241 int xlmac_preemption_rx_timeout_info_get(int unit, soc_port_t port,
    242                                          uint32 *enable, uint32 *timeout_val);
    243 
    244 #endif /*_PORTMOD_XLMAC_H_*/