bridgestp.h (160867) | bridgestp.h (160899) |
---|---|
1/* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ 2 3/* 4 * Copyright 2001 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 53 unchanged lines hidden (view full) --- 62 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 64 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 65 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66 * POSSIBILITY OF SUCH DAMAGE. 67 * 68 * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp 69 * | 1/* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ 2 3/* 4 * Copyright 2001 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 53 unchanged lines hidden (view full) --- 62 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 64 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 65 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66 * POSSIBILITY OF SUCH DAMAGE. 67 * 68 * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp 69 * |
70 * $FreeBSD: head/sys/net/bridgestp.h 160867 2006-07-31 20:24:46Z thompsa $ | 70 * $FreeBSD: head/sys/net/bridgestp.h 160899 2006-08-02 02:47:27Z thompsa $ |
71 */ 72 73/* 74 * Data structure and control definitions for STP interfaces. 75 */ 76 77#include <sys/callout.h> 78#include <sys/queue.h> --- 26 unchanged lines hidden (view full) --- 105#define BSTP_FLAG_TC 0x01 /* Topology change */ 106#define BSTP_FLAG_TCA 0x80 /* Topology change ack */ 107 108#define BSTP_MESSAGE_AGE_INCR (1 * 256) /* in 256ths of a second */ 109#define BSTP_TICK_VAL (1 * 256) /* in 256ths of a second */ 110#define BSTP_LINK_TIMER (BSTP_TICK_VAL * 30) 111 112/* | 71 */ 72 73/* 74 * Data structure and control definitions for STP interfaces. 75 */ 76 77#include <sys/callout.h> 78#include <sys/queue.h> --- 26 unchanged lines hidden (view full) --- 105#define BSTP_FLAG_TC 0x01 /* Topology change */ 106#define BSTP_FLAG_TCA 0x80 /* Topology change ack */ 107 108#define BSTP_MESSAGE_AGE_INCR (1 * 256) /* in 256ths of a second */ 109#define BSTP_TICK_VAL (1 * 256) /* in 256ths of a second */ 110#define BSTP_LINK_TIMER (BSTP_TICK_VAL * 30) 111 112/* |
113 * * Driver callbacks for STP state changes 114 * */ 115typedef void (*bstp_state_cb_t)(struct ifnet *, int); 116 117/* |
|
113 * Because BPDU's do not make nicely aligned structures, two different 114 * declarations are used: bstp_?bpdu (wire representation, packed) and 115 * bstp_*_unit (internal, nicely aligned version). 116 */ 117 118/* configuration bridge protocol data unit */ 119struct bstp_cbpdu { 120 uint8_t cbu_dsap; /* LLC: destination sap */ --- 76 unchanged lines hidden (view full) --- 197 uint16_t bp_port_id; 198 uint16_t bp_designated_port; 199 uint8_t bp_state; 200 uint8_t bp_topology_change_acknowledge; 201 uint8_t bp_config_pending; 202 uint8_t bp_change_detection_enabled; 203 uint8_t bp_priority; 204 uint32_t bp_forward_transitions; | 118 * Because BPDU's do not make nicely aligned structures, two different 119 * declarations are used: bstp_?bpdu (wire representation, packed) and 120 * bstp_*_unit (internal, nicely aligned version). 121 */ 122 123/* configuration bridge protocol data unit */ 124struct bstp_cbpdu { 125 uint8_t cbu_dsap; /* LLC: destination sap */ --- 76 unchanged lines hidden (view full) --- 202 uint16_t bp_port_id; 203 uint16_t bp_designated_port; 204 uint8_t bp_state; 205 uint8_t bp_topology_change_acknowledge; 206 uint8_t bp_config_pending; 207 uint8_t bp_change_detection_enabled; 208 uint8_t bp_priority; 209 uint32_t bp_forward_transitions; |
210 struct task bp_statetask; |
|
205}; 206 207/* 208 * Software state for each bridge STP. 209 */ 210struct bstp_state { 211 LIST_ENTRY(bstp_state) bs_list; 212 struct mtx bs_mtx; --- 14 unchanged lines hidden (view full) --- 227 uint8_t bs_topology_change; 228 struct bstp_timer bs_hello_timer; 229 struct bstp_timer bs_topology_change_timer; 230 struct bstp_timer bs_tcn_timer; 231 struct callout bs_bstpcallout; /* STP callout */ 232 struct bstp_timer bs_link_timer; 233 struct timeval bs_last_tc_time; 234 LIST_HEAD(, bstp_port) bs_bplist; | 211}; 212 213/* 214 * Software state for each bridge STP. 215 */ 216struct bstp_state { 217 LIST_ENTRY(bstp_state) bs_list; 218 struct mtx bs_mtx; --- 14 unchanged lines hidden (view full) --- 233 uint8_t bs_topology_change; 234 struct bstp_timer bs_hello_timer; 235 struct bstp_timer bs_topology_change_timer; 236 struct bstp_timer bs_tcn_timer; 237 struct callout bs_bstpcallout; /* STP callout */ 238 struct bstp_timer bs_link_timer; 239 struct timeval bs_last_tc_time; 240 LIST_HEAD(, bstp_port) bs_bplist; |
241 bstp_state_cb_t bs_state_cb; |
|
235}; 236 237#define BSTP_LOCK_INIT(_bs) mtx_init(&(_bs)->bs_mtx, "bstp", \ 238 NULL, MTX_DEF) 239#define BSTP_LOCK_DESTROY(_bs) mtx_destroy(&(_bs)->bs_mtx) 240#define BSTP_LOCK(_bs) mtx_lock(&(_bs)->bs_mtx) 241#define BSTP_UNLOCK(_bs) mtx_unlock(&(_bs)->bs_mtx) 242#define BSTP_LOCK_ASSERT(_bs) mtx_assert(&(_bs)->bs_mtx, MA_OWNED) 243 244extern const uint8_t bstp_etheraddr[]; 245 246extern void (*bstp_linkstate_p)(struct ifnet *ifp, int state); 247 | 242}; 243 244#define BSTP_LOCK_INIT(_bs) mtx_init(&(_bs)->bs_mtx, "bstp", \ 245 NULL, MTX_DEF) 246#define BSTP_LOCK_DESTROY(_bs) mtx_destroy(&(_bs)->bs_mtx) 247#define BSTP_LOCK(_bs) mtx_lock(&(_bs)->bs_mtx) 248#define BSTP_UNLOCK(_bs) mtx_unlock(&(_bs)->bs_mtx) 249#define BSTP_LOCK_ASSERT(_bs) mtx_assert(&(_bs)->bs_mtx, MA_OWNED) 250 251extern const uint8_t bstp_etheraddr[]; 252 253extern void (*bstp_linkstate_p)(struct ifnet *ifp, int state); 254 |
248void bstp_attach(struct bstp_state *); | 255void bstp_attach(struct bstp_state *, bstp_state_cb_t); |
249void bstp_detach(struct bstp_state *); 250void bstp_init(struct bstp_state *); 251void bstp_reinit(struct bstp_state *); 252void bstp_stop(struct bstp_state *); 253int bstp_add(struct bstp_state *, struct bstp_port *, struct ifnet *); 254void bstp_delete(struct bstp_port *); | 256void bstp_detach(struct bstp_state *); 257void bstp_init(struct bstp_state *); 258void bstp_reinit(struct bstp_state *); 259void bstp_stop(struct bstp_state *); 260int bstp_add(struct bstp_state *, struct bstp_port *, struct ifnet *); 261void bstp_delete(struct bstp_port *); |
262void bstp_drain(struct bstp_port *); |
|
255void bstp_linkstate(struct ifnet *, int); 256struct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *); 257 258#endif /* _KERNEL */ | 263void bstp_linkstate(struct ifnet *, int); 264struct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *); 265 266#endif /* _KERNEL */ |