blob: 05ed9bc7e42672f38223bd08449e2f06c45cc493 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Linux ethernet bridge
3 *
4 * Authors:
5 * Lennert Buytenhek <buytenh@gnu.org>
6 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _BR_PRIVATE_STP_H
14#define _BR_PRIVATE_STP_H
15
16#define BPDU_TYPE_CONFIG 0
17#define BPDU_TYPE_TCN 0x80
18
stephen hemminger14f98f22011-04-04 14:03:33 +000019/* IEEE 802.1D-1998 timer values */
20#define BR_MIN_HELLO_TIME (1*HZ)
21#define BR_MAX_HELLO_TIME (10*HZ)
22
23#define BR_MIN_FORWARD_DELAY (2*HZ)
24#define BR_MAX_FORWARD_DELAY (30*HZ)
25
26#define BR_MIN_MAX_AGE (6*HZ)
27#define BR_MAX_MAX_AGE (40*HZ)
28
29#define BR_MIN_PATH_COST 1
30#define BR_MAX_PATH_COST 65535
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032struct br_config_bpdu
33{
34 unsigned topology_change:1;
35 unsigned topology_change_ack:1;
36 bridge_id root;
37 int root_path_cost;
38 bridge_id bridge_id;
39 port_id port_id;
40 int message_age;
41 int max_age;
42 int hello_time;
43 int forward_delay;
44};
45
46/* called under bridge lock */
47static inline int br_is_designated_port(const struct net_bridge_port *p)
48{
49 return !memcmp(&p->designated_bridge, &p->br->bridge_id, 8) &&
50 (p->designated_port == p->port_id);
51}
52
53
54/* br_stp.c */
55extern void br_become_root_bridge(struct net_bridge *br);
56extern void br_config_bpdu_generation(struct net_bridge *);
57extern void br_configuration_update(struct net_bridge *);
58extern void br_port_state_selection(struct net_bridge *);
stephen hemminger160d73b2011-07-22 07:47:10 +000059extern void br_received_config_bpdu(struct net_bridge_port *p,
60 const struct br_config_bpdu *bpdu);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061extern void br_received_tcn_bpdu(struct net_bridge_port *p);
62extern void br_transmit_config(struct net_bridge_port *p);
63extern void br_transmit_tcn(struct net_bridge *br);
64extern void br_topology_change_detection(struct net_bridge *br);
65
66/* br_stp_bpdu.c */
67extern void br_send_config_bpdu(struct net_bridge_port *, struct br_config_bpdu *);
68extern void br_send_tcn_bpdu(struct net_bridge_port *);
69
70#endif