link.h (2922B)
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 * Common internal definitions for BCM Linkscan module 8 */ 9 10 #ifndef _BCM_INT_LINK_H_ 11 #define _BCM_INT_LINK_H_ 12 13 #include <sal/types.h> 14 #include <bcm/types.h> 15 #include <bcm/debug.h> 16 #include <bcm/link.h> 17 #include <soc/types.h> 18 19 #define NUM_PORTS SOC_MAX_NUM_PORTS 20 21 /* 22 * Driver specific routines 23 * 24 * (See description for routines below) 25 */ 26 typedef struct _bcm_ls_driver_s { 27 void (*ld_hw_interrupt)(int, bcm_pbmp_t*); 28 int (*ld_port_link_get)(int, bcm_port_t, int, int*); 29 int (*ld_internal_select)(int, bcm_port_t); 30 int (*ld_update_asf)(int, bcm_port_t, int, int, int); 31 int (*ld_trunk_sw_failover_trigger)(int, bcm_pbmp_t, bcm_pbmp_t); 32 } _bcm_ls_driver_t; 33 34 /* 35 * Driver specific routines description 36 * 37 * Function: 38 * ld_hw_interrupt 39 * Purpose: 40 * Routine handler for hardware linkscan interrupt. 41 * Parameters: 42 * unit - Device unit number 43 * pbmp - (OUT) Returns bitmap of ports that require hardware re-scan 44 * 45 * 46 * Function: 47 * ld_port_link_get 48 * Purpose: 49 * Return current PHY up/down status. 50 * Parameters: 51 * unit - Device unit number 52 * port - Device port number 53 * hw - If TRUE, assume hardware linkscan is active and use it 54 * to reduce PHY reads. 55 * If FALSE, do not use information from hardware linkscan. 56 * up - (OUT) TRUE for link up, FALSE for link down. 57 * 58 * 59 * Function: 60 * ld_internal_select 61 * Purpose: 62 * Select the source of the CMIC link status interrupt 63 * to be the Internal Serdes on given port. 64 * Parameters: 65 * unit - Device unit number 66 * port - Device port number 67 * 68 * 69 * Function: 70 * ld_update_asf 71 * Purpose: 72 * Update Alternate Store and Forward parameters for a port. 73 * Parameters: 74 * unit - Device unit number 75 * port - Device port number 76 * linkup - port link state (0=down, 1=up) 77 * speed - port speed 78 * duplex - port duplex (0=half, 1=full) 79 * 80 * 81 * Function: 82 * ld_trunk_sw_failover_trigger 83 * Purpose: 84 * Remove specified ports with link down from trunks. 85 * Parameters: 86 * unit - Device unit number 87 * pbmp_active - Bitmap of ports 88 * pbmp_status - Bitmap of port status 89 */ 90 91 extern int _bcm_linkscan_init(int unit, const _bcm_ls_driver_t *driver); 92 93 extern int _bcm_link_get(int unit, bcm_port_t port, int *link); 94 extern int _bcm_link_force(int unit, bcm_port_t port, int force, int link); 95 96 extern int _bcm_linkscan_pause(int unit); 97 extern int _bcm_linkscan_continue(int unit); 98 extern int _bcm_linkscan_available(int unit); 99 extern int _bcm_linkscan_port_init(int unit, int port); 100 101 #ifdef BCM_WARM_BOOT_SUPPORT 102 int bcm_linkscan_sync(int unit, int sync); 103 #endif 104 #endif /* _BCM_INT_LINK_H_ */