portctrl.h (18169B)
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-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: portctrl.h 8 * Purpose: SDK Port Control Glue Layer 9 */ 10 11 #ifndef _BCM_INT_PORTCTRL_H_ 12 #define _BCM_INT_PORTCTRL_H_ 13 14 #include <sal/types.h> 15 #include <soc/types.h> 16 #include <soc/esw/portctrl.h> 17 #include <bcm/types.h> 18 #include <soc/higig.h> 19 20 21 22 23 /* Functions */ 24 extern int bcmi_esw_portctrl_probe(int unit, bcm_gport_t port, int init_flag, 25 void *add_info, int *okay); 26 extern int bcmi_esw_portctrl_probe_pbmp(int unit, 27 pbmp_t pbmp, pbmp_t *okay_pbmp); 28 29 extern int bcmi_esw_portctrl_ability_get(int unit, bcm_gport_t port, 30 bcm_port_ability_t *port_ability, 31 bcm_port_abil_t *ability_mask); 32 extern int bcmi_esw_portctrl_speed_ability_local_get(int unit, 33 bcm_gport_t port, 34 int max_num_ability, 35 bcm_port_speed_ability_t *abilities, 36 int *actual_num_ability); 37 38 extern int bcmi_esw_portctrl_ability_remote_get(int unit, bcm_gport_t port, 39 bcm_port_ability_t *ability, 40 bcm_port_abil_t *ability_mask); 41 42 extern int bcmi_esw_portctrl_autoneg_ability_remote_get(int unit, bcm_gport_t port, 43 int max_num_ability, 44 bcm_port_speed_ability_t *abilities, 45 int *actual_num_ability); 46 extern int bcmi_esw_portctrl_enable_get(int unit, 47 bcm_gport_t port, int *enable); 48 extern int bcmi_esw_portctrl_enable_set(int unit, 49 bcm_gport_t port, int enable); 50 extern int bcmi_esw_portctrl_mac_enable_set(int unit, 51 bcm_gport_t port, int enable); 52 extern int bcmi_esw_portctrl_phy_enable_set(int unit, 53 bcm_gport_t port, int enable); 54 55 extern int bcmi_esw_portctrl_egress_queue_drain(int unit, bcm_gport_t port); 56 extern int bcmi_esw_portctrl_update(int unit, bcm_gport_t port, int link); 57 extern int bcmi_esw_tx_roe_portctrl_update(int unit, bcm_gport_t port, int link); 58 extern int bcmi_esw_rx_roe_portctrl_update(int unit, bcm_gport_t port, int link); 59 60 extern int bcmi_esw_portctrl_fault_get(int unit, 61 bcm_gport_t port, uint32 *flags); 62 63 extern int bcmi_esw_portctrl_link_fault_get(int unit, bcm_gport_t port, 64 int *local_fault, 65 int *remote_fault); 66 67 extern int bcmi_esw_portctrl_loopback_get(int unit, 68 bcm_gport_t port, int *loopback); 69 extern int bcmi_esw_portctrl_loopback_set(int unit, 70 bcm_gport_t port, int loopback); 71 72 extern int bcmi_esw_portctrl_speed_get(int unit, bcm_gport_t port, int *speed); 73 extern int bcmi_esw_portctrl_speed_max(int unit, bcm_gport_t port, int *speed); 74 extern int bcmi_esw_portctrl_speed_set(int unit, bcm_gport_t port, int speed); 75 76 extern int bcmi_esw_portctrl_resource_speed_config_validate(int unit, 77 bcm_port_resource_t *resource, bcm_pbmp_t *pbmp); 78 79 extern int bcmi_esw_portctrl_speed_multi_set(int unit, int nport, 80 bcm_port_resource_t *resource); 81 82 extern int bcmi_esw_portctrl_stk_my_modid_set(int unit, bcm_gport_t port, 83 int my_modid); 84 85 extern int bcmi_esw_portctrl_pause_get(int unit, bcm_gport_t port, 86 int *pause_tx, int *pause_rx); 87 extern int bcmi_esw_portctrl_pause_set(int unit, bcm_gport_t port, 88 int pause_tx, int pause_rx); 89 90 extern int bcmi_esw_portctrl_pause_addr_get(int unit, bcm_gport_t port, 91 bcm_mac_t mac); 92 extern int bcmi_esw_portctrl_pause_addr_set(int unit, bcm_gport_t port, 93 bcm_mac_t mac); 94 95 extern int bcmi_esw_portctrl_eee_enable_get(int unit, 96 bcm_gport_t port, int *enable); 97 extern int bcmi_esw_portctrl_eee_enable_set(int unit, 98 bcm_gport_t port, int enable); 99 100 extern int bcmi_esw_portctrl_medium_config_set(int unit, bcm_gport_t port, 101 bcm_port_medium_t medium, 102 bcm_phy_config_t *config); 103 extern int bcmi_esw_portctrl_medium_config_get(int unit, bcm_gport_t port, 104 bcm_port_medium_t medium, 105 bcm_phy_config_t *config); 106 extern int bcmi_esw_portctrl_medium_get(int unit, bcm_gport_t port, 107 bcm_port_medium_t *medium); 108 109 extern int bcmi_esw_portctrl_master_get(int unit, bcm_gport_t port, int *ms); 110 extern int bcmi_esw_portctrl_master_set(int unit, bcm_gport_t port, int ms); 111 112 extern int bcmi_esw_portctrl_interface_get(int unit, bcm_gport_t port, 113 bcm_port_if_t *intf); 114 extern int bcmi_esw_portctrl_interface_set(int unit, bcm_gport_t port, 115 bcm_port_if_t intf); 116 117 extern int bcmi_esw_portctrl_mdix_get(int unit, bcm_gport_t port, 118 bcm_port_mdix_t *mode); 119 extern int bcmi_esw_portctrl_mdix_set(int unit, bcm_gport_t port, 120 bcm_port_mdix_t mode); 121 122 extern int bcmi_esw_portctrl_mdix_status_get(int unit, bcm_gport_t port, 123 bcm_port_mdix_status_t *status); 124 extern int bcmi_esw_portctrl_phy_get(int unit, bcm_gport_t port, uint32 flags, 125 uint32 phy_reg_addr, uint32 *phy_data); 126 extern int bcmi_esw_portctrl_phy_multi_get(int unit, bcm_gport_t port, 127 uint32 flags, uint32 dev_addr, 128 uint32 offset, int max_size, 129 uint8 *data, int *actual_size); 130 extern int bcmi_esw_portctrl_phy_modify(int unit, bcm_gport_t port, 131 uint32 flags, uint32 phy_reg_addr, 132 uint32 phy_data, uint32 phy_mask); 133 extern int bcmi_esw_portctrl_phy_set(int unit, bcm_gport_t port, uint32 flags, 134 uint32 phy_reg_addr, uint32 phy_data); 135 136 extern int bcmi_esw_portctrl_phy_drv_name_get(int unit, bcm_gport_t port, 137 char *name, int len); 138 extern int bcmi_esw_portctrl_phy_reset(int unit, bcm_gport_t port); 139 140 extern int bcmi_esw_portctrl_ability_advert_get(int unit, bcm_gport_t port, 141 bcm_port_ability_t *port_ability, 142 bcm_port_abil_t *ability_mask); 143 extern int bcmi_esw_portctrl_ability_advert_set(int unit, bcm_gport_t port, 144 bcm_port_ability_t *port_ability, 145 bcm_port_abil_t ability_mask); 146 147 extern int bcmi_esw_portctrl_autoneg_get(int unit, bcm_gport_t port, 148 int *autoneg); 149 extern int bcmi_esw_portctrl_autoneg_set(int unit, bcm_gport_t port, 150 int autoneg); 151 152 extern int bcmi_esw_portctrl_autoneg_ability_advert_get(int unit, bcm_gport_t port, 153 int max_num_ability, 154 bcm_port_speed_ability_t *abilities, 155 int *actual_num_ability); 156 extern int bcmi_esw_portctrl_autoneg_ability_advert_set(int unit, bcm_gport_t port, 157 int num_ability, 158 bcm_port_speed_ability_t *abilities); 159 160 extern int bcmi_esw_portctrl_duplex_get(int unit, bcm_gport_t port, 161 int *duplex); 162 extern int bcmi_esw_portctrl_duplex_set(int unit, bcm_gport_t port, 163 int duplex); 164 extern int bcmi_esw_portctrl_clear_rx_lss_status_set(int unit, bcm_gport_t port, 165 int local_fault, 166 int remote_fault); 167 extern int bcmi_esw_portctrl_clear_rx_lss_status_get(int unit, bcm_gport_t port, 168 int *local_fault, 169 int *remote_fault); 170 171 extern int bcmi_esw_portctrl_frame_max_get(int unit, 172 bcm_gport_t port, int *size); 173 extern int bcmi_esw_portctrl_frame_max_set(int unit, 174 bcm_gport_t port, int size); 175 176 extern int bcmi_esw_portctrl_encap_get(int unit, bcm_gport_t port, int *mode); 177 extern int bcmi_esw_portctrl_encap_set(int unit, bcm_gport_t port, 178 int mode, int force); 179 extern int bcmi_esw_portctrl_encap_set_execute(int unit, bcm_gport_t port, 180 int mode, int force); 181 182 extern int bcmi_esw_portctrl_encap_xport_set(int unit, bcm_gport_t port, 183 int mode); 184 extern int bcmi_esw_portctrl_encap_higig_lite_set(int unit, bcm_gport_t port); 185 extern int bcmi_esw_portctrl_higig_mode_set(int unit, bcm_gport_t port, 186 int higig_mode); 187 extern int bcmi_esw_portctrl_higig2_mode_set(int unit, bcm_gport_t port, 188 int higig2_mode); 189 190 extern int bcmi_esw_portctrl_link_get(int unit, bcm_gport_t port, 191 int hw, int *up); 192 193 extern int bcmi_esw_portctrl_mode_setup(int unit, bcm_gport_t port, int enable); 194 extern int bcmi_esw_portctrl_detach(int unit, pbmp_t pbmp, pbmp_t *detached); 195 extern int bcmi_esw_portctrl_ifg_set(int unit, bcm_gport_t port, int speed, 196 bcm_port_duplex_t duplex, int ifg); 197 extern int bcmi_esw_portctrl_ifg_get(int unit, bcm_gport_t port, int speed, 198 bcm_port_duplex_t duplex, int *ifg); 199 extern int bcmi_esw_portctrl_mac_rx_control(int unit, bcm_port_t port, uint8 optype, int *enable); 200 201 extern int bcmi_esw_portctrl_fast_reboot_mac_up(int unit, int nport, bcm_port_t *port); 202 extern int bcmi_esw_portctrl_mac_up(int unit, int nport, bcm_port_t *port); 203 extern int bcmi_esw_portctrl_mac_rx_down(int unit, int nport, bcm_port_t *port); 204 extern int bcmi_esw_portctrl_mac_tx_down(int unit, int nport, bcm_port_t *port); 205 206 extern int bcmi_esw_portctrl_llfc_get(int unit, bcm_gport_t port, bcm_port_control_t type, int *value); 207 extern int bcmi_esw_portctrl_llfc_set(int unit, bcm_port_t port, bcm_port_control_t type, int value); 208 extern int bcmi_esw_portctrl_lag_failover_disable(int unit, bcm_gport_t port); 209 extern int bcmi_esw_portctrl_lag_failover_loopback_get(int unit, bcm_gport_t port, int* value); 210 extern int bcmi_esw_portctrl_lag_failover_status_toggle(int unit, bcm_gport_t port); 211 extern int bcmi_esw_portctrl_lag_remove_failover_lpbk_set(int unit, bcm_gport_t port, int value); 212 extern int bcmi_esw_portctrl_trunk_hwfailover_set(int unit, bcm_gport_t port, int hw_count); 213 214 extern int bcmi_esw_td2_portctrl_lanes_set(int unit, bcm_port_t port_base, int lanes); 215 216 extern int bcmi_esw_portctrl_hwfailover_enable_set(int unit, bcm_gport_t port, 217 int enable); 218 extern int bcmi_esw_portctrl_hwfailover_enable_get(int unit, bcm_gport_t port, 219 int *enable); 220 extern int bcmi_esw_portctrl_hwfailover_status_get(int unit, bcm_gport_t port, 221 int *status); 222 223 extern int bcmi_esw_portctrl_phy_control_set(int unit, bcm_gport_t port, 224 bcm_port_phy_control_t type, uint32 value); 225 extern int bcmi_esw_portctrl_phy_control_get(int unit, bcm_gport_t port, 226 bcm_port_phy_control_t type, uint32 *value); 227 228 extern int bcmi_esw_portctrl_control_validate(int unit, bcm_port_control_t type, 229 int *valid); 230 extern int bcmi_esw_portctrl_control_set(int unit, bcm_gport_t port, 231 bcm_port_control_t type, int value); 232 extern int bcmi_esw_portctrl_control_get(int unit, bcm_gport_t port, 233 bcm_port_control_t type, int *value); 234 235 extern int bcmi_esw_portctrl_mode_get(int unit, bcm_gport_t port, int *mode); 236 237 extern int bcmi_esw_portctrl_priority_group_config_set(int unit, bcm_gport_t port, 238 int priority_group, 239 bcm_port_priority_group_config_t *prigrp_config); 240 241 extern int bcmi_esw_portctrl_e2e_tx_enable_get(int unit, bcm_gport_t port, 242 int *enable); 243 extern int bcmi_esw_portctrl_e2e_tx_enable_set(int unit, bcm_gport_t port, 244 int enable); 245 extern int bcmi_esw_portctrl_e2ecc_hdr_get(int unit, bcm_gport_t port, 246 soc_higig_e2ecc_hdr_t *e2ecc_hdr); 247 extern int bcmi_esw_portctrl_e2ecc_hdr_set(int unit, bcm_gport_t port, 248 soc_higig_e2ecc_hdr_t *e2ecc_hdr); 249 extern int bcmi_esw_portctrl_vlan_tpid_set(int unit, bcm_gport_t port, int tpid); 250 251 extern int bcmi_esw_portctrl_vlan_inner_tpid_set(int unit, bcm_gport_t port, int tpid); 252 253 254 extern int bcmi_esw_portctrl_cntmaxsize_get(int unit, bcm_gport_t port, 255 int *val); 256 extern int bcmi_esw_portctrl_cntmaxsize_set(int unit, bcm_gport_t port, 257 int val); 258 extern int _bcm_esw_port_vrf_set(int unit, bcm_port_t port, int val); 259 extern int _bcm_esw_port_vrf_get(int unit, bcm_port_t port, int *val); 260 extern int bcmi_esw_portctrl_cable_diag(int unit, bcm_port_t port, 261 bcm_port_cable_diag_t *status); 262 extern int 263 bcmi_esw_portctrl_preemption_status_tx_get(int unit, bcm_port_t port, 264 uint32* value); 265 266 extern int 267 bcmi_esw_portctrl_preemption_status_verify_get(int unit, bcm_port_t port, 268 uint32* value); 269 extern int 270 bcmi_esw_portctrl_preemption_mac_config_set(int unit, bcm_port_t port, 271 bcm_port_preempt_control_t type, 272 uint32 arg); 273 extern int 274 bcmi_esw_portctrl_preemption_mac_config_get(int unit, bcm_port_t port, 275 bcm_port_preempt_control_t type, 276 uint32* arg); 277 extern int 278 bcmi_esw_portctrl_timestamp_adjust_set(int unit, bcm_gport_t port, 279 bcm_port_timestamp_adjust_t *ts_adjust); 280 extern int 281 bcmi_esw_portctrl_timestamp_adjust_get(int unit, bcm_gport_t port, 282 bcm_port_timestamp_adjust_t *ts_adjust); 283 extern int 284 bcmi_esw_portctrl_phy_tx_set(int unit, 285 bcm_port_t port, 286 bcm_port_phy_tx_t *tx); 287 extern int 288 bcmi_esw_portctrl_phy_tx_get(int unit, 289 bcm_port_t port, 290 bcm_port_phy_tx_t *tx); 291 extern int 292 bcmi_esw_portctrl_speed_config_get(int unit, 293 bcm_gport_t gport, 294 void *speed_config); 295 extern int 296 bcmi_esw_portctrl_rlm_config_set(int unit, 297 bcm_port_t port, 298 bcm_port_rlm_config_t *rlm_config, 299 int enable); 300 extern int 301 bcmi_esw_portctrl_rlm_config_get(int unit, 302 bcm_port_t port, 303 bcm_port_rlm_config_t *rlm_config, 304 int *enable); 305 extern int 306 bcmi_esw_portctrl_rlm_status_get(int unit, 307 bcm_port_t port, 308 bcm_port_rlm_status_t *rlm_status); 309 extern int 310 bcmi_esw_portctrl_autoneg_status_get(int unit, 311 bcm_gport_t port, 312 int *enabled, 313 int *locked); 314 315 #if defined(INCLUDE_PHY_542XX) 316 extern int bcmi_esw_portctrl_serdes_link_update(int unit, 317 bcm_port_t port, 318 int link); 319 #endif /* defined(INCLUDE_PHY_542XX) */ 320 321 extern int 322 bcmi_esw_portctrl_post_ber_proj_get(int unit, bcm_gport_t port, 323 bcm_port_ber_proj_params_t *ber_proj, 324 int max_errcnt, 325 bcm_port_ber_proj_analyzer_errcnt_t *errcnt_array, 326 int *actual_errcnt); 327 extern int 328 bcmi_esw_portctrl_portmod_thread_stop(int unit); 329 330 extern int 331 bcmi_esw_portctrl_phy_fec_error_inject_set(int unit, bcm_port_t port, 332 uint16 error_control_map, 333 bcm_port_phy_fec_error_mask_t bit_error_mask); 334 extern int 335 bcmi_esw_portctrl_phy_fec_error_inject_get(int unit, bcm_port_t port, 336 uint16 *error_control_map, 337 bcm_port_phy_fec_error_mask_t *bit_error_mask); 338 #endif /* _BCM_INT_PORTCTRL_H_ */