stg.h (3376B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_STG_H__ 11 #define __BCM_STG_H__ 12 13 #include <shared/port.h> 14 #include <bcm/types.h> 15 16 /* bcm_stg_stp_e */ 17 typedef enum bcm_stg_stp_e { 18 BCM_STG_STP_DISABLE = _SHR_PORT_STP_DISABLE, /* Disabled. */ 19 BCM_STG_STP_BLOCK = _SHR_PORT_STP_BLOCK, /* BPDUs/no learns. */ 20 BCM_STG_STP_LISTEN = _SHR_PORT_STP_LISTEN, /* BPDUs/no learns. */ 21 BCM_STG_STP_LEARN = _SHR_PORT_STP_LEARN, /* BPDUs/learns. */ 22 BCM_STG_STP_FORWARD = _SHR_PORT_STP_FORWARD, /* Normal operation. */ 23 BCM_STG_STP_COUNT = _SHR_PORT_STP_COUNT 24 } bcm_stg_stp_t; 25 26 #ifndef BCM_HIDE_DISPATCHABLE 27 28 /* 29 * Initialize the Spanning Tree Group (STG) module to its initial 30 * configuration. 31 */ 32 extern int bcm_stg_init( 33 int unit); 34 35 /* 36 * Destroy all STGs and initialize the Spanning Tree Group (STG) module 37 * to its initial configuration. 38 */ 39 extern int bcm_stg_clear( 40 int unit); 41 42 /* Designate the default STG ID for the chip. */ 43 extern int bcm_stg_default_set( 44 int unit, 45 bcm_stg_t stg); 46 47 /* Return the current default STG ID for the chip. */ 48 extern int bcm_stg_default_get( 49 int unit, 50 bcm_stg_t *stg_ptr); 51 52 /* Add a VLAN to a specified STG. */ 53 extern int bcm_stg_vlan_add( 54 int unit, 55 bcm_stg_t stg, 56 bcm_vlan_t vid); 57 58 /* Remove a VLAN from a Spanning Tree Group. */ 59 extern int bcm_stg_vlan_remove( 60 int unit, 61 bcm_stg_t stg, 62 bcm_vlan_t vid); 63 64 /* Remove all VLANs from a Spanning Tree Group. */ 65 extern int bcm_stg_vlan_remove_all( 66 int unit, 67 bcm_stg_t stg); 68 69 /* Generates a list of VLANs in a specified STG. */ 70 extern int bcm_stg_vlan_list( 71 int unit, 72 bcm_stg_t stg, 73 bcm_vlan_t **list, 74 int *count); 75 76 /* Destroy a list returned by \ref bcm_stg_vlan_list . */ 77 extern int bcm_stg_vlan_list_destroy( 78 int unit, 79 bcm_vlan_t *list, 80 int count); 81 82 /* Create a new STG, using a new STG ID. */ 83 extern int bcm_stg_create( 84 int unit, 85 bcm_stg_t *stg_ptr); 86 87 /* Create a new STG, using a specific STG ID. */ 88 extern int bcm_stg_create_id( 89 int unit, 90 bcm_stg_t stg); 91 92 /* Destroys the specified STG. */ 93 extern int bcm_stg_destroy( 94 int unit, 95 bcm_stg_t stg); 96 97 /* Generates a list of IDs for currently defined STGs. */ 98 extern int bcm_stg_list( 99 int unit, 100 bcm_stg_t **list, 101 int *count); 102 103 /* 104 * Destroys a previously returned list of STG IDs; the STGs themselves 105 * are not affected. 106 */ 107 extern int bcm_stg_list_destroy( 108 int unit, 109 bcm_stg_t *list, 110 int count); 111 112 /* 113 * Set the Spanning Tree Protocol state of a port/VP in the specified 114 * STG. 115 * VP GROUP STP state need to be setted per direction, Please use \ref 116 * bcm_vlan_gport_add for this. 117 */ 118 extern int bcm_stg_stp_set( 119 int unit, 120 bcm_stg_t stg, 121 bcm_port_t port, 122 int stp_state); 123 124 /* 125 * Return the Spanning Tree Protocol state of a port in the specified 126 * STG. 127 */ 128 extern int bcm_stg_stp_get( 129 int unit, 130 bcm_stg_t stg, 131 bcm_port_t port, 132 int *stp_state); 133 134 /* 135 * Return the maximum number of STGs that the underlying hardware can 136 * support 137 */ 138 extern int bcm_stg_count_get( 139 int unit, 140 int *max_stg); 141 142 #endif /* BCM_HIDE_DISPATCHABLE */ 143 144 #endif /* __BCM_STG_H__ */