cdmac.h (9831B)
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 * File: cdmac.h 10 * Purpose: 11 */ 12 13 #ifndef _PORTMOD_CDMAC_H_ 14 #define _PORTMOD_CDMAC_H_ 15 16 #include <soc/portmod/portmod.h> 17 18 #define CDMAC_NULL_FLAGS (0) 19 20 #define CDMAC_ENABLE_RX (1) 21 #define CDMAC_ENABLE_TX (2) 22 23 #define CDMAC_ENABLE_SET_FLAGS_SOFT_RESET 0x1 24 #define CDMAC_ENABLE_SET_FLAGS_TX_EN 0x2 25 #define CDMAC_ENABLE_SET_FLAGS_RX_EN 0x4 26 27 #define CDMAC_RUNT_THRESHOLD_MIN 64 28 #define CDMAC_RUNT_THRESHOLD_MAX 96 29 #define CDMAC_RUNT_THRESHOLD_DEFAULT 64 30 31 #define CDMAC_JUMBO_MAXSZ 0x3fe8 32 33 #define CDMAC_PAD_THRESHOLD_SIZE_MIN 64 34 #define CDMAC_PAD_THRESHOLD_SIZE_MAX 96 35 #define CDMAC_PAD_THRESHOLD_SIZE_DEFAULT 64 36 37 #define CDMAC_AVERAGE_IPG_DEFAULT 12 38 39 #define CDMAC_INIT_F_RX_STRIP_CRC 0x1 40 #define CDMAC_INIT_F_TX_APPEND_CRC 0x2 41 #define CDMAC_INIT_F_TX_REPLACE_CRC 0x4 42 #define CDMAC_INIT_F_TX_PASS_THROUGH_CRC_MODE 0x8 43 44 #define CDMAC_RSV_MASK_WRONG_SA (0x1 << (0)) 45 #define CDMAC_RSV_MASK_STACK_VLAN_DETECT (0x1 << (1)) 46 #define CDMAC_RSV_MASK_PFC_DA_ERR (0x1 << (2)) /* unsupported PFC DA*/ 47 #define CDMAC_RSV_MASK_PAUSE_DA_ERR (0x1 << (2)) /* same bit as PFC */ 48 #define CDMAC_RSV_MASK_RCV_TERM_OR_CODE_ERR (0x1 << (3)) 49 #define CDMAC_RSV_MASK_CRC_ERR (0x1 << (4)) 50 #define CDMAC_RSV_MASK_FRAME_LEN_ERR (0x1 << (5)) /* IEEE length check fail */ 51 #define CDMAC_RSV_MASK_TRUNCATED_FRAME (0x1 << (6)) /* truncated/out of range */ 52 #define CDMAC_RSV_MASK_FRAME_RCV_OK (0x1 << (7)) 53 #define CDMAC_RSV_MASK_MCAST_FRAME (0x1 << (8)) 54 #define CDMAC_RSV_MASK_BCAST_FRAME (0x1 << (9)) 55 #define CDMAC_RSV_MASK_PROMISCUOUS_FRAME (0x1 << (10)) 56 #define CDMAC_RSV_MASK_CONTROL_FRAME (0x1 << (11)) 57 #define CDMAC_RSV_MASK_PAUSE_FRAME (0x1 << (12)) 58 #define CDMAC_RSV_MASK_OPCODE_ERR (0x1 << (13)) 59 #define CDMAC_RSV_MASK_VLAN_TAG_DETECT (0x1 << (14)) 60 #define CDMAC_RSV_MASK_UCAST_FRAME (0x1 << (15)) 61 #define CDMAC_RSV_MASK_RESERVED_0 (0x1 << (16)) 62 #define CDMAC_RSV_MASK_RESERVED_1 (0x1 << (17)) 63 #define CDMAC_RSV_MASK_PFC_FRAME (0x1 << (18)) 64 65 #define CDMAC_RSV_MASK_MIN CDMAC_RSV_MASK_WRONG_SA 66 #define CDMAC_RSV_MASK_MAX CDMAC_RSV_MASK_PFC_FRAME 67 #define CDMAC_RSV_MASK_ALL ((CDMAC_RSV_MASK_PFC_FRAME) | \ 68 ((CDMAC_RSV_MASK_PFC_FRAME) - 1)) 69 70 int cdmac_init(int unit, soc_port_t port, uint32 init_flags); 71 int cdmac_speed_set(int unit, soc_port_t port, int flags, int speed); 72 int cdmac_speed_get (int unit, soc_port_t port, int *speed); 73 int cdmac_encap_set(int unit, soc_port_t port, int flags, 74 portmod_encap_t encap); 75 int cdmac_encap_get(int unit, soc_port_t port, int *flags, 76 portmod_encap_t *encap); 77 int cdmac_enable_set(int unit, soc_port_t port, int flags, int enable); 78 int cdmac_enable_get(int unit, soc_port_t port, int flags, int *enable); 79 int cdmac_duplex_set(int unit, soc_port_t port, int duplex); 80 int cdmac_duplex_get(int unit, soc_port_t port, int *duplex); 81 82 int cdmac_loopback_set(int unit, soc_port_t port, portmod_loopback_mode_t lb, 83 int enable); 84 int cdmac_loopback_get(int unit, soc_port_t port, portmod_loopback_mode_t lb, 85 int *enable); 86 int cdmac_discard_set (int unit, soc_port_t port, int discard); 87 int cdmac_tx_enable_set (int unit, soc_port_t port, int enable); 88 int cdmac_tx_enable_get (int unit, soc_port_t port, int *enable); 89 int cdmac_rx_enable_set (int unit, soc_port_t port, int enable); 90 int cdmac_rx_enable_get (int unit, soc_port_t port, int *enable); 91 int cdmac_tx_mac_sa_set(int unit, soc_port_t port, sal_mac_addr_t mac); 92 int cdmac_tx_mac_sa_get(int unit, soc_port_t port, sal_mac_addr_t mac); 93 int cdmac_rx_mac_sa_set(int unit, soc_port_t port, sal_mac_addr_t mac); 94 int cdmac_rx_mac_sa_get(int unit, soc_port_t port, sal_mac_addr_t mac); 95 int cdmac_soft_reset_set(int unit, soc_port_t port, int enable); 96 int cdmac_soft_reset_get(int unit, soc_port_t port, int *enable); 97 int cdmac_rx_vlan_tag_set(int unit, soc_port_t port, int outer_vlan_tag, 98 int inner_vlan_tag); 99 int cdmac_rx_vlan_tag_get(int unit, soc_port_t port, int *outer_vlan_tag, 100 int *inner_vlan_tag); 101 int cdmac_rx_max_size_set(int unit, soc_port_t port, int value); 102 int cdmac_rx_max_size_get(int unit, soc_port_t port, int *value); 103 int cdmac_pad_size_set(int unit, soc_port_t port, int value); 104 int cdmac_pad_size_get(int unit, soc_port_t port, int *value); 105 int cdmac_tx_average_ipg_set(int unit, soc_port_t port, int val); 106 int cdmac_tx_average_ipg_get(int unit, soc_port_t port, int *val); 107 int cdmac_runt_threshold_set(int unit, soc_port_t port, int value); 108 int cdmac_runt_threshold_get(int unit, soc_port_t port, int *value); 109 int cdmac_remote_fault_control_get(int unit, soc_port_t port, 110 portmod_remote_fault_control_t *control); 111 int cdmac_remote_fault_control_set(int unit, soc_port_t port, 112 const portmod_remote_fault_control_t *control); 113 int cdmac_local_fault_control_get(int unit, soc_port_t port, 114 portmod_local_fault_control_t *control); 115 int cdmac_local_fault_control_set(int unit, soc_port_t port, 116 const portmod_local_fault_control_t *control); 117 118 int cdmac_local_fault_status_get (int unit, soc_port_t port, int *status); 119 int cdmac_remote_fault_status_get (int unit, soc_port_t port, int *status); 120 121 int cdmac_pfc_control_set(int unit, soc_port_t port, 122 const portmod_pfc_control_t *control); 123 int cdmac_pfc_control_get(int unit, soc_port_t port, 124 portmod_pfc_control_t *control); 125 int cdmac_pause_control_set(int unit, soc_port_t port, 126 const portmod_pause_control_t *control); 127 int cdmac_pause_control_get(int unit, soc_port_t port, 128 portmod_pause_control_t *control); 129 130 int cdmac_pfc_config_set(int unit, int port, 131 const portmod_pfc_config_t* pfc_cfg); 132 int cdmac_pfc_config_get(int unit, int port, 133 portmod_pfc_config_t* pfc_cfg); 134 135 int cdmac_pass_control_frame_set(int unit, int port, int value); 136 int cdmac_pass_control_frame_get(int unit, int port, int *value); 137 138 int cdmac_pass_pfc_frame_set(int unit, int port, int value); 139 int cdmac_pass_pfc_frame_get(int unit, int port, int *value); 140 141 int cdmac_pass_pause_frame_set(int unit, int port, int value); 142 int cdmac_pass_pause_frame_get(int unit, int port, int *value); 143 144 int cdmac_lag_failover_loopback_set(int unit, int port, int val); 145 int cdmac_lag_failover_loopback_get(int unit, int port, int *val); 146 int cdmac_lag_failover_disable(int unit, int port); 147 148 int cdmac_lag_failover_en_get(int unit, int port, int *val); 149 int cdmac_lag_failover_en_set(int unit, int port, int val); 150 151 int cdmac_reset_fc_timers_on_link_dn_get (int unit, soc_port_t port, int *val); 152 int cdmac_reset_fc_timers_on_link_dn_set (int unit, soc_port_t port, int val); 153 154 int cdmac_lag_remove_failover_lpbk_get(int unit, int port, int *val); 155 int cdmac_lag_remove_failover_lpbk_set(int unit, int port, int val); 156 157 int cdmac_mac_ctrl_set(int unit, int port, uint64 ctrl); 158 int cdmac_drain_cell_get(int unit, int port, 159 portmod_drain_cells_t *drain_cells); 160 int cdmac_drain_cell_stop(int unit, int port, 161 const portmod_drain_cells_t *drain_cells); 162 int cdmac_drain_cell_start(int unit, int port); 163 164 int cdmac_txfifo_cell_cnt_get(int unit, int port, uint32* val); 165 int cdmac_egress_queue_drain_get(int unit, int port, uint64 *mac_ctrl, 166 int *rx_en); 167 168 int cdmac_drain_cells_rx_enable(int unit, int port, int rx_en); 169 int cdmac_egress_queue_drain_rx_en(int unit, int port, int rx_en); 170 int cdmac_reset_check(int unit, int port, int enable, int *reset); 171 172 int cdmac_sw_link_status_select_set(int unit, soc_port_t port, int enable); 173 int cdmac_sw_link_status_select_get(int unit, soc_port_t port, int *enable); 174 int cdmac_sw_link_status_set (int unit, soc_port_t port, int link); 175 int cdmac_sw_link_status_get (int unit, soc_port_t port, int *link); 176 177 int cdmac_rsv_mask_control_set(int unit, int port, uint32 flags, uint32 value); 178 int cdmac_rsv_mask_control_get(int unit, int port, uint32 flags, uint32 *value); 179 int cdmac_rsv_mask_set(int unit, int port, uint32 rsv_mask); 180 int cdmac_rsv_mask_get(int unit, int port, uint32 *rsv_mask); 181 182 int cdmac_mib_counter_control_set(int unit, soc_port_t port, 183 int enable, int clear); 184 int cdmac_cntmaxsize_set(int unit, int port, int val); 185 int cdmac_cntmaxsize_get(int unit, int port, int *val); 186 187 int cdmac_link_down_sequence_enable_set(int unit, int port, uint32 value); 188 int cdmac_link_down_sequence_enable_get(int unit, int port, uint32 *value); 189 190 int cdmac_interrupt_enable_set(int unit, int port, int intr_type, uint32 value); 191 int cdmac_interrupt_enable_get(int unit, int port, int intr_type, uint32 *value); 192 int cdmac_interrupt_status_get(int unit, int port, int intr_type, uint32 *value); 193 int cdmac_interrupts_status_get(int unit, int port, int arr_max_size, 194 uint32* intr_arr, uint32* size); 195 int cdmac_link_interrupt_ordered_set_enable(int unit, int port, uint32 enable); 196 int cdmac_link_interrupt_ordered_set_enable_get(int unit, int port, uint32* enable); 197 int cdmac_link_interruption_live_status_get(int unit, int port, uint32* status); 198 int cdmac_tx_stall_enable_set(int unit, int port, uint32 enable); 199 200 #endif /*_PORTMOD_CDMAC_H_*/