bridgestp.h revision 167379
11556Srgrimes/*	$NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $	*/
21556Srgrimes
31556Srgrimes/*
41556Srgrimes * Copyright 2001 Wasabi Systems, Inc.
51556Srgrimes * All rights reserved.
61556Srgrimes *
71556Srgrimes * Written by Jason R. Thorpe for Wasabi Systems, Inc.
81556Srgrimes *
91556Srgrimes * Redistribution and use in source and binary forms, with or without
101556Srgrimes * modification, are permitted provided that the following conditions
111556Srgrimes * are met:
121556Srgrimes * 1. Redistributions of source code must retain the above copyright
131556Srgrimes *    notice, this list of conditions and the following disclaimer.
141556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
151556Srgrimes *    notice, this list of conditions and the following disclaimer in the
161556Srgrimes *    documentation and/or other materials provided with the distribution.
171556Srgrimes * 3. All advertising materials mentioning features or use of this software
181556Srgrimes *    must display the following acknowledgement:
191556Srgrimes *	This product includes software developed for the NetBSD Project by
201556Srgrimes *	Wasabi Systems, Inc.
211556Srgrimes * 4. The name of Wasabi Systems, Inc. may not be used to endorse
221556Srgrimes *    or promote products derived from this software without specific prior
231556Srgrimes *    written permission.
241556Srgrimes *
251556Srgrimes * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
261556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
271556Srgrimes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281556Srgrimes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
291556Srgrimes * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301556Srgrimes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311556Srgrimes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321556Srgrimes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
331556Srgrimes * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3436150Scharnier * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3536150Scharnier * POSSIBILITY OF SUCH DAMAGE.
3636150Scharnier */
371556Srgrimes
3899110Sobrien/*
3999110Sobrien * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
401556Srgrimes * All rights reserved.
4117987Speter *
4217987Speter * Redistribution and use in source and binary forms, with or without
4317987Speter * modification, are permitted provided that the following conditions
4417987Speter * are met:
4517987Speter * 1. Redistributions of source code must retain the above copyright
46218306Sjilles *    notice, this list of conditions and the following disclaimer.
4717987Speter * 2. Redistributions in binary form must reproduce the above copyright
4817987Speter *    notice, this list of conditions and the following disclaimer in the
491556Srgrimes *    documentation and/or other materials provided with the distribution.
501556Srgrimes * 3. All advertising materials mentioning features or use of this software
511556Srgrimes *    must display the following acknowledgement:
521556Srgrimes *	This product includes software developed by Jason L. Wright
531556Srgrimes * 4. The name of the author may not be used to endorse or promote products
541556Srgrimes *    derived from this software without specific prior written permission.
551556Srgrimes *
561556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
571556Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
581556Srgrimes * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
591556Srgrimes * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
601556Srgrimes * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
611556Srgrimes * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
621556Srgrimes * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
631556Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
641556Srgrimes * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
651556Srgrimes * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
661556Srgrimes * POSSIBILITY OF SUCH DAMAGE.
671556Srgrimes *
681556Srgrimes * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp
691556Srgrimes *
701556Srgrimes * $FreeBSD: head/sys/net/bridgestp.h 167379 2007-03-09 19:34:55Z thompsa $
711556Srgrimes */
721556Srgrimes
731556Srgrimes/*
7417987Speter * Data structure and control definitions for STP interfaces.
751556Srgrimes */
7625223Ssteve
771556Srgrimes#include <sys/callout.h>
781556Srgrimes#include <sys/queue.h>
791556Srgrimes
801556Srgrimes/* STP port states */
811556Srgrimes#define	BSTP_IFSTATE_DISABLED	0
821556Srgrimes#define	BSTP_IFSTATE_LISTENING	1
831556Srgrimes#define	BSTP_IFSTATE_LEARNING	2
841556Srgrimes#define	BSTP_IFSTATE_FORWARDING	3
851556Srgrimes#define	BSTP_IFSTATE_BLOCKING	4
86157601Sstefanf#define	BSTP_IFSTATE_DISCARDING	5
87242620Sjilles
88242530Sjilles#define	BSTP_TCSTATE_ACTIVE	1
891556Srgrimes#define	BSTP_TCSTATE_DETECTED	2
901556Srgrimes#define	BSTP_TCSTATE_INACTIVE	3
911556Srgrimes#define	BSTP_TCSTATE_LEARNING	4
92213760Sobrien#define	BSTP_TCSTATE_PROPAG	5
93245426Sjilles#define	BSTP_TCSTATE_ACK	6
9420425Ssteve#define	BSTP_TCSTATE_TC		7
951556Srgrimes#define	BSTP_TCSTATE_TCN	8
961556Srgrimes
97213811Sobrien#define	BSTP_ROLE_DISABLED	0
98213811Sobrien#define	BSTP_ROLE_ROOT		1
99213811Sobrien#define	BSTP_ROLE_DESIGNATED	2
100213811Sobrien#define	BSTP_ROLE_ALTERNATE	3
101229220Sjilles#define	BSTP_ROLE_BACKUP	4
1021556Srgrimes
1031556Srgrimes#ifdef _KERNEL
1041556Srgrimes
1051556Srgrimes/* STP port flags */
1061556Srgrimes#define	BSTP_PORT_CANMIGRATE	0x0001
1071556Srgrimes#define	BSTP_PORT_NEWINFO	0x0002
108218306Sjilles#define	BSTP_PORT_DISPUTED	0x0004
109218306Sjilles#define	BSTP_PORT_ADMCOST	0x0008
1101556Srgrimes#define	BSTP_PORT_AUTOEDGE	0x0010
1111556Srgrimes#define	BSTP_PORT_AUTOPTP	0x0020
1121556Srgrimes#define	BSTP_PORT_ADMEDGE	0x0040
113201053Sjilles
11417987Speter/* BPDU priority */
1151556Srgrimes#define	BSTP_PDU_SUPERIOR	1
1161556Srgrimes#define	BSTP_PDU_REPEATED	2
1171556Srgrimes#define	BSTP_PDU_INFERIOR	3
1181556Srgrimes#define	BSTP_PDU_INFERIORALT	4
1191556Srgrimes#define	BSTP_PDU_OTHER		5
1201556Srgrimes
1211556Srgrimes/* BPDU flags */
1221556Srgrimes#define	BSTP_PDU_PRMASK		0x0c		/* Port Role */
1231556Srgrimes#define	BSTP_PDU_PRSHIFT	2		/* Port Role offset */
124201053Sjilles#define	BSTP_PDU_F_UNKN		0x00		/* Unknown port    (00) */
1251556Srgrimes#define	BSTP_PDU_F_ALT		0x01		/* Alt/Backup port (01) */
1261556Srgrimes#define	BSTP_PDU_F_ROOT		0x02		/* Root port       (10) */
1271556Srgrimes#define	BSTP_PDU_F_DESG		0x03		/* Designated port (11) */
128218320Sjilles
129218320Sjilles#define	BSTP_PDU_STPMASK	0x81		/* strip unused STP flags */
1301556Srgrimes#define	BSTP_PDU_RSTPMASK	0x7f		/* strip unused RSTP flags */
1311556Srgrimes#define	BSTP_PDU_F_TC		0x01		/* Topology change */
1321556Srgrimes#define	BSTP_PDU_F_P		0x02		/* Proposal flag */
1331556Srgrimes#define	BSTP_PDU_F_L		0x10		/* Learning flag */
13420425Ssteve#define	BSTP_PDU_F_F		0x20		/* Forwarding flag */
13520425Ssteve#define	BSTP_PDU_F_A		0x40		/* Agreement flag */
136218242Sjilles#define	BSTP_PDU_F_TCA		0x80		/* Topology change ack */
137218242Sjilles
138218242Sjilles/*
139218242Sjilles * Spanning tree defaults.
14020425Ssteve */
141218242Sjilles#define	BSTP_DEFAULT_MAX_AGE		(20 * 256)
14220425Ssteve#define	BSTP_DEFAULT_HELLO_TIME		(2 * 256)
1431556Srgrimes#define	BSTP_DEFAULT_FORWARD_DELAY	(15 * 256)
1441556Srgrimes#define	BSTP_DEFAULT_HOLD_TIME		(1 * 256)
1451556Srgrimes#define	BSTP_DEFAULT_MIGRATE_DELAY	(3 * 256)
146213811Sobrien#define	BSTP_DEFAULT_HOLD_COUNT		6
14790111Simp#define	BSTP_DEFAULT_BRIDGE_PRIORITY	0x8000
14890111Simp#define	BSTP_DEFAULT_PORT_PRIORITY	0x80
149218320Sjilles#define	BSTP_DEFAULT_PATH_COST		55
150218320Sjilles#define	BSTP_MIN_HELLO_TIME		(1 * 256)
151218320Sjilles#define	BSTP_MIN_MAX_AGE		(6 * 256)
1521556Srgrimes#define	BSTP_MIN_FORWARD_DELAY		(4 * 256)
1531556Srgrimes#define	BSTP_MIN_HOLD_COUNT		1
1541556Srgrimes#define	BSTP_MAX_HELLO_TIME		(2 * 256)
1551556Srgrimes#define	BSTP_MAX_MAX_AGE		(40 * 256)
156218320Sjilles#define	BSTP_MAX_FORWARD_DELAY		(30 * 256)
157218320Sjilles#define	BSTP_MAX_HOLD_COUNT		10
158218320Sjilles#define	BSTP_MAX_PRIORITY		61440
159218320Sjilles#define	BSTP_MAX_PORT_PRIORITY		240
160218320Sjilles#define	BSTP_MAX_PATH_COST		200000000
161218320Sjilles
162218320Sjilles/* BPDU message types */
163218320Sjilles#define	BSTP_MSGTYPE_CFG	0x00		/* Configuration */
164218320Sjilles#define	BSTP_MSGTYPE_RSTP	0x02		/* Rapid STP */
165218320Sjilles#define	BSTP_MSGTYPE_TCN	0x80		/* Topology chg notification */
166218306Sjilles
167248980Sjilles/* Protocol versions */
168218306Sjilles#define	BSTP_PROTO_ID		0x00
1691556Srgrimes#define	BSTP_PROTO_STP		0x00
1701556Srgrimes#define	BSTP_PROTO_RSTP		0x02
1711556Srgrimes#define	BSTP_PROTO_MAX		BSTP_PROTO_RSTP
1721556Srgrimes
1731556Srgrimes#define	BSTP_INFO_RECIEVED	1
1741556Srgrimes#define	BSTP_INFO_MINE		2
1751556Srgrimes#define	BSTP_INFO_AGED		3
1761556Srgrimes#define	BSTP_INFO_DISABLED	4
1771556Srgrimes
1781556Srgrimes
1791556Srgrimes#define	BSTP_MESSAGE_AGE_INCR	(1 * 256)	/* in 256ths of a second */
1801556Srgrimes#define	BSTP_TICK_VAL		(1 * 256)	/* in 256ths of a second */
1811556Srgrimes#define	BSTP_LINK_TIMER		(BSTP_TICK_VAL * 15)
1821556Srgrimes
183200956Sjilles/*
1841556Srgrimes * Driver callbacks for STP state changes
1851556Srgrimes */
186200956Sjillestypedef void (*bstp_state_cb_t)(struct ifnet *, int);
18790111Simptypedef void (*bstp_rtage_cb_t)(struct ifnet *, int);
188200956Sjillesstruct bstp_cb_ops {
189200956Sjilles	bstp_state_cb_t	bcb_state;
190258776Sjilles	bstp_rtage_cb_t	bcb_rtage;
1911556Srgrimes};
1921556Srgrimes
1931556Srgrimes/*
1941556Srgrimes * Because BPDU's do not make nicely aligned structures, two different
195193223Srse * declarations are used: bstp_?bpdu (wire representation, packed) and
196193223Srse * bstp_*_unit (internal, nicely aligned version).
197258776Sjilles */
198258776Sjilles
199216706Sjilles/* configuration bridge protocol data unit */
200216706Sjillesstruct bstp_cbpdu {
2011556Srgrimes	uint8_t		cbu_dsap;		/* LLC: destination sap */
20217987Speter	uint8_t		cbu_ssap;		/* LLC: source sap */
2031556Srgrimes	uint8_t		cbu_ctl;		/* LLC: control */
2041556Srgrimes	uint16_t	cbu_protoid;		/* protocol id */
2051556Srgrimes	uint8_t		cbu_protover;		/* protocol version */
206258776Sjilles	uint8_t		cbu_bpdutype;		/* message type */
2071556Srgrimes	uint8_t		cbu_flags;		/* flags (below) */
2081556Srgrimes
2091556Srgrimes	/* root id */
2101556Srgrimes	uint16_t	cbu_rootpri;		/* root priority */
2111556Srgrimes	uint8_t		cbu_rootaddr[6];	/* root address */
2121556Srgrimes
2131556Srgrimes	uint32_t	cbu_rootpathcost;	/* root path cost */
2141556Srgrimes
2151556Srgrimes	/* bridge id */
2161556Srgrimes	uint16_t	cbu_bridgepri;		/* bridge priority */
2171556Srgrimes	uint8_t		cbu_bridgeaddr[6];	/* bridge address */
2181556Srgrimes
2191556Srgrimes	uint16_t	cbu_portid;		/* port id */
2201556Srgrimes	uint16_t	cbu_messageage;		/* current message age */
2211556Srgrimes	uint16_t	cbu_maxage;		/* maximum age */
2221556Srgrimes	uint16_t	cbu_hellotime;		/* hello time */
2231556Srgrimes	uint16_t	cbu_forwarddelay;	/* forwarding delay */
22417987Speter	uint8_t		cbu_versionlen;		/* version 1 length */
22590111Simp} __packed;
22617987Speter#define	BSTP_BPDU_STP_LEN	(3 + 35)	/* LLC + STP pdu */
2271556Srgrimes#define	BSTP_BPDU_RSTP_LEN	(3 + 36)	/* LLC + RSTP pdu */
2281556Srgrimes
2291556Srgrimes/* topology change notification bridge protocol data unit */
2301556Srgrimesstruct bstp_tbpdu {
2311556Srgrimes	uint8_t		tbu_dsap;		/* LLC: destination sap */
2321556Srgrimes	uint8_t		tbu_ssap;		/* LLC: source sap */
233231535Sjilles	uint8_t		tbu_ctl;		/* LLC: control */
2341556Srgrimes	uint16_t	tbu_protoid;		/* protocol id */
235231535Sjilles	uint8_t		tbu_protover;		/* protocol version */
2361556Srgrimes	uint8_t		tbu_bpdutype;		/* message type */
2371556Srgrimes} __packed;
2381556Srgrimes
239218324Sjilles/*
2401556Srgrimes * Timekeeping structure used in spanning tree code.
2411556Srgrimes */
2421556Srgrimesstruct bstp_timer {
2431556Srgrimes	int		active;
2441556Srgrimes	int		latched;
2451556Srgrimes	int		value;
2461556Srgrimes};
24798157Stjr
24898157Stjrstruct bstp_pri_vector {
2491556Srgrimes	uint64_t		pv_root_id;
2501556Srgrimes	uint32_t		pv_cost;
2511556Srgrimes	uint64_t		pv_dbridge_id;
2521556Srgrimes	uint16_t		pv_dport_id;
2531556Srgrimes	uint16_t		pv_port_id;
2541556Srgrimes};
255217206Sjilles
2561556Srgrimesstruct bstp_config_unit {
257204800Sjilles	struct bstp_pri_vector	cu_pv;
258231535Sjilles	uint16_t	cu_message_age;
259231535Sjilles	uint16_t	cu_max_age;
260231535Sjilles	uint16_t	cu_forward_delay;
261231535Sjilles	uint16_t	cu_hello_time;
262231535Sjilles	uint8_t		cu_message_type;
263231535Sjilles	uint8_t		cu_topology_change_ack;
264231535Sjilles	uint8_t		cu_topology_change;
265231535Sjilles	uint8_t		cu_proposal;
266231535Sjilles	uint8_t		cu_agree;
2671556Srgrimes	uint8_t		cu_learning;
2681556Srgrimes	uint8_t		cu_forwarding;
2691556Srgrimes	uint8_t		cu_role;
2701556Srgrimes};
2711556Srgrimes
272231535Sjillesstruct bstp_tcn_unit {
2731556Srgrimes	uint8_t		tu_message_type;
2741556Srgrimes};
2751556Srgrimes
276213811Sobrienstruct bstp_port {
27790111Simp	LIST_ENTRY(bstp_port)	bp_next;
27890111Simp	struct ifnet		*bp_ifp;	/* parent if */
279201053Sjilles	struct bstp_state	*bp_bs;
280200956Sjilles	uint8_t			bp_active;
2811556Srgrimes	uint8_t			bp_protover;
2821556Srgrimes	uint32_t		bp_flags;
2831556Srgrimes	uint32_t		bp_path_cost;
284201053Sjilles	uint16_t		bp_port_msg_age;
2851556Srgrimes	uint16_t		bp_port_max_age;
2861556Srgrimes	uint16_t		bp_port_fdelay;
2871556Srgrimes	uint16_t		bp_port_htime;
2881556Srgrimes	uint16_t		bp_desg_msg_age;
289201053Sjilles	uint16_t		bp_desg_max_age;
2901556Srgrimes	uint16_t		bp_desg_fdelay;
2911556Srgrimes	uint16_t		bp_desg_htime;
2921556Srgrimes	struct bstp_timer	bp_edge_delay_timer;
2931556Srgrimes	struct bstp_timer	bp_forward_delay_timer;
2941556Srgrimes	struct bstp_timer	bp_hello_timer;
2951556Srgrimes	struct bstp_timer	bp_message_age_timer;
2961556Srgrimes	struct bstp_timer	bp_migrate_delay_timer;
297196634Sjilles	struct bstp_timer	bp_recent_backup_timer;
2981556Srgrimes	struct bstp_timer	bp_recent_root_timer;
2991556Srgrimes	struct bstp_timer	bp_tc_timer;
3001556Srgrimes	struct bstp_config_unit bp_msg_cu;
3011556Srgrimes	struct bstp_pri_vector	bp_desg_pv;
3021556Srgrimes	struct bstp_pri_vector	bp_port_pv;
3031556Srgrimes	uint16_t		bp_port_id;
3041556Srgrimes	uint8_t			bp_state;
3051556Srgrimes	uint8_t			bp_tcstate;
3061556Srgrimes	uint8_t			bp_role;
3071556Srgrimes	uint8_t			bp_infois;
3081556Srgrimes	uint8_t			bp_tc_ack;
3091556Srgrimes	uint8_t			bp_tc_prop;
3101556Srgrimes	uint8_t			bp_fdbflush;
3111556Srgrimes	uint8_t			bp_priority;
3121556Srgrimes	uint8_t			bp_ptp_link;
3131556Srgrimes	uint8_t			bp_agree;
3141556Srgrimes	uint8_t			bp_agreed;
3151556Srgrimes	uint8_t			bp_sync;
3161556Srgrimes	uint8_t			bp_synced;
3171556Srgrimes	uint8_t			bp_proposing;
3181556Srgrimes	uint8_t			bp_proposed;
319204800Sjilles	uint8_t			bp_operedge;
320200956Sjilles	uint8_t			bp_reroot;
32117987Speter	uint8_t			bp_rcvdtc;
322204800Sjilles	uint8_t			bp_rcvdtca;
323201053Sjilles	uint8_t			bp_rcvdtcn;
3241556Srgrimes	uint32_t		bp_forward_transitions;
3251556Srgrimes	uint8_t			bp_txcount;
3261556Srgrimes	struct task		bp_statetask;
3271556Srgrimes	struct task		bp_rtagetask;
328157601Sstefanf};
329245426Sjilles
3301556Srgrimes/*
3311556Srgrimes * Software state for each bridge STP.
3321556Srgrimes */
3331556Srgrimesstruct bstp_state {
3341556Srgrimes	LIST_ENTRY(bstp_state)	bs_list;
335296813Sjilles	uint8_t			bs_running;
3361556Srgrimes	struct mtx		bs_mtx;
3371556Srgrimes	struct bstp_pri_vector	bs_bridge_pv;
3381556Srgrimes	struct bstp_pri_vector	bs_root_pv;
339245426Sjilles	struct bstp_port	*bs_root_port;
340245426Sjilles	uint8_t			bs_protover;
3411556Srgrimes	uint16_t		bs_migration_delay;
342245426Sjilles	uint16_t		bs_edge_delay;
343204800Sjilles	uint16_t		bs_bridge_max_age;
344204800Sjilles	uint16_t		bs_bridge_fdelay;
345204800Sjilles	uint16_t		bs_bridge_htime;
346204800Sjilles	uint16_t		bs_root_msg_age;
347204800Sjilles	uint16_t		bs_root_max_age;
3481556Srgrimes	uint16_t		bs_root_fdelay;
349217206Sjilles	uint16_t		bs_root_htime;
350217206Sjilles	uint16_t		bs_hold_time;
3511556Srgrimes	uint16_t		bs_bridge_priority;
3521556Srgrimes	uint8_t			bs_txholdcount;
353204800Sjilles	uint8_t			bs_allsynced;
354204800Sjilles	struct callout		bs_bstpcallout;	/* STP callout */
3551556Srgrimes	struct bstp_timer	bs_link_timer;
3561556Srgrimes	struct timeval		bs_last_tc_time;
357157601Sstefanf	LIST_HEAD(, bstp_port)	bs_bplist;
3581556Srgrimes	bstp_state_cb_t		bs_state_cb;
3591556Srgrimes	bstp_rtage_cb_t		bs_rtage_cb;
3601556Srgrimes};
3611556Srgrimes
3621556Srgrimes#define	BSTP_LOCK_INIT(_bs)	mtx_init(&(_bs)->bs_mtx, "bstp", NULL, MTX_DEF)
3631556Srgrimes#define	BSTP_LOCK_DESTROY(_bs)	mtx_destroy(&(_bs)->bs_mtx)
3641556Srgrimes#define	BSTP_LOCK(_bs)		mtx_lock(&(_bs)->bs_mtx)
365201053Sjilles#define	BSTP_UNLOCK(_bs)	mtx_unlock(&(_bs)->bs_mtx)
366266932Sjilles#define	BSTP_LOCK_ASSERT(_bs)	mtx_assert(&(_bs)->bs_mtx, MA_OWNED)
367201053Sjilles
3681556Srgrimesextern const uint8_t bstp_etheraddr[];
369268920Sjilles
3701556Srgrimesextern	void (*bstp_linkstate_p)(struct ifnet *ifp, int state);
3711556Srgrimes
372266932Sjillesvoid	bstp_attach(struct bstp_state *, struct bstp_cb_ops *);
3731556Srgrimesvoid	bstp_detach(struct bstp_state *);
3741556Srgrimesvoid	bstp_init(struct bstp_state *);
375245426Sjillesvoid	bstp_stop(struct bstp_state *);
376245426Sjillesint	bstp_create(struct bstp_state *, struct bstp_port *, struct ifnet *);
377100351Stjrint	bstp_enable(struct bstp_port *);
3781556Srgrimesvoid	bstp_disable(struct bstp_port *);
3791556Srgrimesvoid	bstp_destroy(struct bstp_port *);
380266932Sjillesvoid	bstp_linkstate(struct ifnet *, int);
3811556Srgrimesint	bstp_set_htime(struct bstp_state *, int);
3821556Srgrimesint	bstp_set_fdelay(struct bstp_state *, int);
38317987Speterint	bstp_set_maxage(struct bstp_state *, int);
384266932Sjillesint	bstp_set_holdcount(struct bstp_state *, int);
3851556Srgrimesint	bstp_set_protocol(struct bstp_state *, int);
3861556Srgrimesint	bstp_set_priority(struct bstp_state *, int);
3871556Srgrimesint	bstp_set_port_priority(struct bstp_port *, int);
3881556Srgrimesint	bstp_set_path_cost(struct bstp_port *, uint32_t);
3891556Srgrimesint	bstp_set_edge(struct bstp_port *, int);
3901556Srgrimesint	bstp_set_autoedge(struct bstp_port *, int);
3911556Srgrimesint	bstp_set_ptp(struct bstp_port *, int);
3921556Srgrimesint	bstp_set_autoptp(struct bstp_port *, int);
3931556Srgrimesstruct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
3941556Srgrimes
3951556Srgrimes#endif /* _KERNEL */
3961556Srgrimes