bridgestp.h revision 222834
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:
451556Srgrimes * 1. Redistributions of source code must retain the above copyright
461556Srgrimes *    notice, this list of conditions and the following disclaimer.
471556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
481556Srgrimes *    notice, this list of conditions and the following disclaimer in the
491556Srgrimes *    documentation and/or other materials provided with the distribution.
5017987Speter * 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
58223060Sjilles * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
59100578Stjr * 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 222834 2011-06-07 20:46:03Z zec $
7146684Skris */
721556Srgrimes
731556Srgrimes/*
741556Srgrimes * Data structure and control definitions for STP interfaces.
75253658Sjilles */
76247206Sjilles
77277973Sjilles#include <sys/callout.h>
78276038Sjilles#include <sys/queue.h>
7938950Scracauer
80157811Sschweikh/* STP port states */
8138521Scracauer#define	BSTP_IFSTATE_DISABLED	0
8220902Ssteve#define	BSTP_IFSTATE_LISTENING	1
83217472Sjilles#define	BSTP_IFSTATE_LEARNING	2
841556Srgrimes#define	BSTP_IFSTATE_FORWARDING	3
85217175Sjilles#define	BSTP_IFSTATE_BLOCKING	4
86217175Sjilles#define	BSTP_IFSTATE_DISCARDING	5
87217175Sjilles
88213811Sobrien#define	BSTP_TCSTATE_ACTIVE	1
8917987Speter#define	BSTP_TCSTATE_DETECTED	2
9020902Ssteve#define	BSTP_TCSTATE_INACTIVE	3
911556Srgrimes#define	BSTP_TCSTATE_LEARNING	4
9220902Ssteve#define	BSTP_TCSTATE_PROPAG	5
93125727Snjl#define	BSTP_TCSTATE_ACK	6
94125727Snjl#define	BSTP_TCSTATE_TC		7
9520902Ssteve#define	BSTP_TCSTATE_TCN	8
96213811Sobrien
9790111Simp#define	BSTP_ROLE_DISABLED	0
9820902Ssteve#define	BSTP_ROLE_ROOT		1
9920902Ssteve#define	BSTP_ROLE_DESIGNATED	2
10020902Ssteve#define	BSTP_ROLE_ALTERNATE	3
10120902Ssteve#define	BSTP_ROLE_BACKUP	4
10220902Ssteve
10320902Ssteve#ifdef _KERNEL
10420902Ssteve
105218285Sjilles/* STP port flags */
10620902Ssteve#define	BSTP_PORT_CANMIGRATE	0x0001
10720902Ssteve#define	BSTP_PORT_NEWINFO	0x0002
10820902Ssteve#define	BSTP_PORT_DISPUTED	0x0004
10920902Ssteve#define	BSTP_PORT_ADMCOST	0x0008
110218285Sjilles#define	BSTP_PORT_AUTOEDGE	0x0010
11120902Ssteve#define	BSTP_PORT_AUTOPTP	0x0020
112125155Snjl#define	BSTP_PORT_ADMEDGE	0x0040
113125728Snjl#define	BSTP_PORT_PNDCOST	0x0080
114125728Snjl
11520902Ssteve/* BPDU priority */
11620902Ssteve#define	BSTP_PDU_SUPERIOR	1
11720902Ssteve#define	BSTP_PDU_REPEATED	2
11820902Ssteve#define	BSTP_PDU_INFERIOR	3
11920902Ssteve#define	BSTP_PDU_INFERIORALT	4
12020902Ssteve#define	BSTP_PDU_OTHER		5
12120902Ssteve
12220902Ssteve/* BPDU flags */
12320902Ssteve#define	BSTP_PDU_PRMASK		0x0c		/* Port Role */
124213811Sobrien#define	BSTP_PDU_PRSHIFT	2		/* Port Role offset */
12590111Simp#define	BSTP_PDU_F_UNKN		0x00		/* Unknown port    (00) */
12620902Ssteve#define	BSTP_PDU_F_ALT		0x01		/* Alt/Backup port (01) */
127125727Snjl#define	BSTP_PDU_F_ROOT		0x02		/* Root port       (10) */
12820902Ssteve#define	BSTP_PDU_F_DESG		0x03		/* Designated port (11) */
129125727Snjl
130125155Snjl#define	BSTP_PDU_STPMASK	0x81		/* strip unused STP flags */
131125727Snjl#define	BSTP_PDU_RSTPMASK	0x7f		/* strip unused RSTP flags */
132125727Snjl#define	BSTP_PDU_F_TC		0x01		/* Topology change */
133125727Snjl#define	BSTP_PDU_F_P		0x02		/* Proposal flag */
134125727Snjl#define	BSTP_PDU_F_L		0x10		/* Learning flag */
135125727Snjl#define	BSTP_PDU_F_F		0x20		/* Forwarding flag */
136125727Snjl#define	BSTP_PDU_F_A		0x40		/* Agreement flag */
137125727Snjl#define	BSTP_PDU_F_TCA		0x80		/* Topology change ack */
138125727Snjl
139217425Sjilles/*
14020902Ssteve * Spanning tree defaults.
141125727Snjl */
142125727Snjl#define	BSTP_DEFAULT_MAX_AGE		(20 * 256)
14320902Ssteve#define	BSTP_DEFAULT_HELLO_TIME		(2 * 256)
144125727Snjl#define	BSTP_DEFAULT_FORWARD_DELAY	(15 * 256)
14520902Ssteve#define	BSTP_DEFAULT_HOLD_TIME		(1 * 256)
14620902Ssteve#define	BSTP_DEFAULT_MIGRATE_DELAY	(3 * 256)
14720902Ssteve#define	BSTP_DEFAULT_HOLD_COUNT		6
14820902Ssteve#define	BSTP_DEFAULT_BRIDGE_PRIORITY	0x8000
14920902Ssteve#define	BSTP_DEFAULT_PORT_PRIORITY	0x80
1501556Srgrimes#define	BSTP_DEFAULT_PATH_COST		55
1511556Srgrimes#define	BSTP_MIN_HELLO_TIME		(1 * 256)
15217987Speter#define	BSTP_MIN_MAX_AGE		(6 * 256)
153248980Sjilles#define	BSTP_MIN_FORWARD_DELAY		(4 * 256)
15417987Speter#define	BSTP_MIN_HOLD_COUNT		1
1551556Srgrimes#define	BSTP_MAX_HELLO_TIME		(2 * 256)
1561556Srgrimes#define	BSTP_MAX_MAX_AGE		(40 * 256)
157199641Sjilles#define	BSTP_MAX_FORWARD_DELAY		(30 * 256)
158217461Sjilles#define	BSTP_MAX_HOLD_COUNT		10
1591556Srgrimes#define	BSTP_MAX_PRIORITY		61440
160217461Sjilles#define	BSTP_MAX_PORT_PRIORITY		240
161217461Sjilles#define	BSTP_MAX_PATH_COST		200000000
162217461Sjilles
163217461Sjilles/* BPDU message types */
164217461Sjilles#define	BSTP_MSGTYPE_CFG	0x00		/* Configuration */
165217461Sjilles#define	BSTP_MSGTYPE_RSTP	0x02		/* Rapid STP */
166217461Sjilles#define	BSTP_MSGTYPE_TCN	0x80		/* Topology chg notification */
167217461Sjilles
168217461Sjilles/* Protocol versions */
169217461Sjilles#define	BSTP_PROTO_ID		0x00
170125155Snjl#define	BSTP_PROTO_STP		0x00
171125727Snjl#define	BSTP_PROTO_RSTP		0x02
172153244Sstefanf#define	BSTP_PROTO_MAX		BSTP_PROTO_RSTP
173153244Sstefanf
174125727Snjl#define	BSTP_INFO_RECEIVED	1
175218285Sjilles#define	BSTP_INFO_MINE		2
176125727Snjl#define	BSTP_INFO_AGED		3
177153244Sstefanf#define	BSTP_INFO_DISABLED	4
178125727Snjl
179153244Sstefanf
180125727Snjl#define	BSTP_MESSAGE_AGE_INCR	(1 * 256)	/* in 256ths of a second */
181125727Snjl#define	BSTP_TICK_VAL		(1 * 256)	/* in 256ths of a second */
1821556Srgrimes#define	BSTP_LINK_TIMER		(BSTP_TICK_VAL * 15)
1831556Srgrimes
1841556Srgrimes/*
18520902Ssteve * Driver callbacks for STP state changes
186281718Sbdrewery */
187217461Sjillestypedef void (*bstp_state_cb_t)(struct ifnet *, int);
188217461Sjillestypedef void (*bstp_rtage_cb_t)(struct ifnet *, int);
189217461Sjillesstruct bstp_cb_ops {
19020902Ssteve	bstp_state_cb_t	bcb_state;
19120902Ssteve	bstp_rtage_cb_t	bcb_rtage;
19220902Ssteve};
19320902Ssteve
194230117Sjilles/*
195199641Sjilles * Because BPDU's do not make nicely aligned structures, two different
196216622Sjilles * declarations are used: bstp_?bpdu (wire representation, packed) and
197199641Sjilles * bstp_*_unit (internal, nicely aligned version).
198230117Sjilles */
199199641Sjilles
2001556Srgrimes/* configuration bridge protocol data unit */
2011556Srgrimesstruct bstp_cbpdu {
2021556Srgrimes	uint8_t		cbu_dsap;		/* LLC: destination sap */
2031556Srgrimes	uint8_t		cbu_ssap;		/* LLC: source sap */
2041556Srgrimes	uint8_t		cbu_ctl;		/* LLC: control */
2051556Srgrimes	uint16_t	cbu_protoid;		/* protocol id */
2061556Srgrimes	uint8_t		cbu_protover;		/* protocol version */
2071556Srgrimes	uint8_t		cbu_bpdutype;		/* message type */
2081556Srgrimes	uint8_t		cbu_flags;		/* flags (below) */
2091556Srgrimes
210199641Sjilles	/* root id */
2111556Srgrimes	uint16_t	cbu_rootpri;		/* root priority */
2121556Srgrimes	uint8_t		cbu_rootaddr[6];	/* root address */
2131556Srgrimes
2141556Srgrimes	uint32_t	cbu_rootpathcost;	/* root path cost */
2151556Srgrimes
2161556Srgrimes	/* bridge id */
2171556Srgrimes	uint16_t	cbu_bridgepri;		/* bridge priority */
21890111Simp	uint8_t		cbu_bridgeaddr[6];	/* bridge address */
21920902Ssteve
22038950Scracauer	uint16_t	cbu_portid;		/* port id */
2211556Srgrimes	uint16_t	cbu_messageage;		/* current message age */
22220902Ssteve	uint16_t	cbu_maxage;		/* maximum age */
2231556Srgrimes	uint16_t	cbu_hellotime;		/* hello time */
2241556Srgrimes	uint16_t	cbu_forwarddelay;	/* forwarding delay */
2251556Srgrimes	uint8_t		cbu_versionlen;		/* version 1 length */
2261556Srgrimes} __packed;
2271556Srgrimes#define	BSTP_BPDU_STP_LEN	(3 + 35)	/* LLC + STP pdu */
2281556Srgrimes#define	BSTP_BPDU_RSTP_LEN	(3 + 36)	/* LLC + RSTP pdu */
2291556Srgrimes
2301556Srgrimes/* topology change notification bridge protocol data unit */
2311556Srgrimesstruct bstp_tbpdu {
2321556Srgrimes	uint8_t		tbu_dsap;		/* LLC: destination sap */
2331556Srgrimes	uint8_t		tbu_ssap;		/* LLC: source sap */
2341556Srgrimes	uint8_t		tbu_ctl;		/* LLC: control */
2351556Srgrimes	uint16_t	tbu_protoid;		/* protocol id */
236194127Sjilles	uint8_t		tbu_protover;		/* protocol version */
237194127Sjilles	uint8_t		tbu_bpdutype;		/* message type */
238194127Sjilles} __packed;
239194127Sjilles
240194127Sjilles/*
241194127Sjilles * Timekeeping structure used in spanning tree code.
242194127Sjilles */
243194127Sjillesstruct bstp_timer {
244194127Sjilles	int		active;
245194127Sjilles	int		latched;
246194127Sjilles	int		value;
247194127Sjilles};
248194127Sjilles
249194127Sjillesstruct bstp_pri_vector {
250194127Sjilles	uint64_t		pv_root_id;
2511556Srgrimes	uint32_t		pv_cost;
2521556Srgrimes	uint64_t		pv_dbridge_id;
2531556Srgrimes	uint16_t		pv_dport_id;
25431098Sbde	uint16_t		pv_port_id;
25590111Simp};
25617987Speter
2571556Srgrimesstruct bstp_config_unit {
258199205Sjilles	struct bstp_pri_vector	cu_pv;
259199205Sjilles	uint16_t	cu_message_age;
2601556Srgrimes	uint16_t	cu_max_age;
2611556Srgrimes	uint16_t	cu_forward_delay;
2621556Srgrimes	uint16_t	cu_hello_time;
2631556Srgrimes	uint8_t		cu_message_type;
2641556Srgrimes	uint8_t		cu_topology_change_ack;
2651556Srgrimes	uint8_t		cu_topology_change;
2661556Srgrimes	uint8_t		cu_proposal;
2671556Srgrimes	uint8_t		cu_agree;
26838521Scracauer	uint8_t		cu_learning;
2691556Srgrimes	uint8_t		cu_forwarding;
2701556Srgrimes	uint8_t		cu_role;
27138521Scracauer};
2721556Srgrimes
2731556Srgrimesstruct bstp_tcn_unit {
2741556Srgrimes	uint8_t		tu_message_type;
2751556Srgrimes};
2761556Srgrimes
2771556Srgrimesstruct bstp_port {
2781556Srgrimes	LIST_ENTRY(bstp_port)	bp_next;
2791556Srgrimes	struct ifnet		*bp_ifp;	/* parent if */
2801556Srgrimes	struct bstp_state	*bp_bs;
2811556Srgrimes	uint8_t			bp_active;
28238535Scracauer	uint8_t			bp_protover;
28338521Scracauer	uint32_t		bp_flags;
2841556Srgrimes	uint32_t		bp_path_cost;
28538521Scracauer	uint16_t		bp_port_msg_age;
2861556Srgrimes	uint16_t		bp_port_max_age;
2871556Srgrimes	uint16_t		bp_port_fdelay;
2881556Srgrimes	uint16_t		bp_port_htime;
2891556Srgrimes	uint16_t		bp_desg_msg_age;
2901556Srgrimes	uint16_t		bp_desg_max_age;
29138521Scracauer	uint16_t		bp_desg_fdelay;
2921556Srgrimes	uint16_t		bp_desg_htime;
2931556Srgrimes	struct bstp_timer	bp_edge_delay_timer;
2941556Srgrimes	struct bstp_timer	bp_forward_delay_timer;
2951556Srgrimes	struct bstp_timer	bp_hello_timer;
2961556Srgrimes	struct bstp_timer	bp_message_age_timer;
29717987Speter	struct bstp_timer	bp_migrate_delay_timer;
29820902Ssteve	struct bstp_timer	bp_recent_backup_timer;
2998855Srgrimes	struct bstp_timer	bp_recent_root_timer;
3008855Srgrimes	struct bstp_timer	bp_tc_timer;
3018855Srgrimes	struct bstp_config_unit bp_msg_cu;
3021556Srgrimes	struct bstp_pri_vector	bp_desg_pv;
30317987Speter	struct bstp_pri_vector	bp_port_pv;
30417987Speter	uint16_t		bp_port_id;
30517987Speter	uint8_t			bp_state;
30617987Speter	uint8_t			bp_tcstate;
30717987Speter	uint8_t			bp_role;
30817987Speter	uint8_t			bp_infois;
30931098Sbde	uint8_t			bp_tc_ack;
31017987Speter	uint8_t			bp_tc_prop;
3111556Srgrimes	uint8_t			bp_fdbflush;
3128855Srgrimes	uint8_t			bp_priority;
3131556Srgrimes	uint8_t			bp_ptp_link;
3141556Srgrimes	uint8_t			bp_agree;
3151556Srgrimes	uint8_t			bp_agreed;
3161556Srgrimes	uint8_t			bp_sync;
3171556Srgrimes	uint8_t			bp_synced;
3181556Srgrimes	uint8_t			bp_proposing;
3191556Srgrimes	uint8_t			bp_proposed;
3201556Srgrimes	uint8_t			bp_operedge;
3211556Srgrimes	uint8_t			bp_reroot;
32231098Sbde	uint8_t			bp_rcvdtc;
3231556Srgrimes	uint8_t			bp_rcvdtca;
3241556Srgrimes	uint8_t			bp_rcvdtcn;
3251556Srgrimes	uint32_t		bp_forward_transitions;
3261556Srgrimes	uint8_t			bp_txcount;
3271556Srgrimes	struct task		bp_statetask;
3281556Srgrimes	struct task		bp_rtagetask;
329199205Sjilles};
330199205Sjilles
331199205Sjilles/*
332199205Sjilles * Software state for each bridge STP.
3331556Srgrimes */
3341556Srgrimesstruct bstp_state {
33520902Ssteve	LIST_ENTRY(bstp_state)	bs_list;
3361556Srgrimes	uint8_t			bs_running;
3371556Srgrimes	struct mtx		bs_mtx;
3381556Srgrimes	struct bstp_pri_vector	bs_bridge_pv;
339213811Sobrien	struct bstp_pri_vector	bs_root_pv;
34090111Simp	struct bstp_port	*bs_root_port;
34117987Speter	uint8_t			bs_protover;
3421556Srgrimes	uint16_t		bs_migration_delay;
3431556Srgrimes	uint16_t		bs_edge_delay;
3441556Srgrimes	uint16_t		bs_bridge_max_age;
34517987Speter	uint16_t		bs_bridge_fdelay;
34617987Speter	uint16_t		bs_bridge_htime;
34717987Speter	uint16_t		bs_root_msg_age;
3481556Srgrimes	uint16_t		bs_root_max_age;
3491556Srgrimes	uint16_t		bs_root_fdelay;
35020902Ssteve	uint16_t		bs_root_htime;
3511556Srgrimes	uint16_t		bs_hold_time;
3521556Srgrimes	uint16_t		bs_bridge_priority;
3531556Srgrimes	uint8_t			bs_txholdcount;
3541556Srgrimes	uint8_t			bs_allsynced;
35590111Simp	struct callout		bs_bstpcallout;	/* STP callout */
35617987Speter	struct bstp_timer	bs_link_timer;
35720902Ssteve	struct timeval		bs_last_tc_time;
358257399Sjilles	LIST_HEAD(, bstp_port)	bs_bplist;
359257399Sjilles	bstp_state_cb_t		bs_state_cb;
36020902Ssteve	bstp_rtage_cb_t		bs_rtage_cb;
3611556Srgrimes	struct vnet		*bs_vnet;
362257399Sjilles};
3631556Srgrimes
3641556Srgrimes#define	BSTP_LOCK_INIT(_bs)	mtx_init(&(_bs)->bs_mtx, "bstp", NULL, MTX_DEF)
3651556Srgrimes#define	BSTP_LOCK_DESTROY(_bs)	mtx_destroy(&(_bs)->bs_mtx)
3661556Srgrimes#define	BSTP_LOCK(_bs)		mtx_lock(&(_bs)->bs_mtx)
367238888Sjilles#define	BSTP_UNLOCK(_bs)	mtx_unlock(&(_bs)->bs_mtx)
368238888Sjilles#define	BSTP_LOCK_ASSERT(_bs)	mtx_assert(&(_bs)->bs_mtx, MA_OWNED)
369238888Sjilles
370238888Sjillesextern const uint8_t bstp_etheraddr[];
371238888Sjilles
372238888Sjillesextern	void (*bstp_linkstate_p)(struct ifnet *ifp, int state);
373238888Sjilles
374238888Sjillesvoid	bstp_attach(struct bstp_state *, struct bstp_cb_ops *);
3751556Srgrimesvoid	bstp_detach(struct bstp_state *);
3761556Srgrimesvoid	bstp_init(struct bstp_state *);
3771556Srgrimesvoid	bstp_stop(struct bstp_state *);
3781556Srgrimesint	bstp_create(struct bstp_state *, struct bstp_port *, struct ifnet *);
37990111Simpint	bstp_enable(struct bstp_port *);
38017987Spetervoid	bstp_disable(struct bstp_port *);
38131098Sbdevoid	bstp_destroy(struct bstp_port *);
3821556Srgrimesvoid	bstp_linkstate(struct ifnet *, int);
383276038Sjillesint	bstp_set_htime(struct bstp_state *, int);
384276038Sjillesint	bstp_set_fdelay(struct bstp_state *, int);
385276038Sjillesint	bstp_set_maxage(struct bstp_state *, int);
386276038Sjillesint	bstp_set_holdcount(struct bstp_state *, int);
387276038Sjillesint	bstp_set_protocol(struct bstp_state *, int);
388276038Sjillesint	bstp_set_priority(struct bstp_state *, int);
389276038Sjillesint	bstp_set_port_priority(struct bstp_port *, int);
390276038Sjillesint	bstp_set_path_cost(struct bstp_port *, uint32_t);
391276038Sjillesint	bstp_set_edge(struct bstp_port *, int);
3921556Srgrimesint	bstp_set_autoedge(struct bstp_port *, int);
3931556Srgrimesint	bstp_set_ptp(struct bstp_port *, int);
39438950Scracauerint	bstp_set_autoptp(struct bstp_port *, int);
39538950Scracauerstruct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
396255157Sjilles
397255157Sjilles#endif /* _KERNEL */
398100578Stjr