blob: fb3ebe6155134b4532ad4c85b2fea2260f0d6140 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Spanning tree protocol; generic parts
3 * Linux ethernet bridge
4 *
5 * Authors:
6 * Lennert Buytenhek <buytenh@gnu.org>
7 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <linux/kernel.h>
Franck Bui-Huu82524742008-05-12 21:21:05 +020014#include <linux/rculist.h>
Scott Feldman38dcf352014-11-28 14:34:20 +010015#include <net/switchdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17#include "br_private.h"
18#include "br_private_stp.h"
19
20/* since time values in bpdu are in jiffies and then scaled (1/256)
Joakim Tjernlundaaca7352012-03-01 08:12:18 +000021 * before sending, make sure that is at least one STP tick.
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 */
Joakim Tjernlundaaca7352012-03-01 08:12:18 +000023#define MESSAGE_AGE_INCR ((HZ / 256) + 1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Jan Engelhardt36cbd3d2009-08-05 10:42:58 -070025static const char *const br_port_state_names[] = {
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +090026 [BR_STATE_DISABLED] = "disabled",
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 [BR_STATE_LISTENING] = "listening",
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +090028 [BR_STATE_LEARNING] = "learning",
29 [BR_STATE_FORWARDING] = "forwarding",
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 [BR_STATE_BLOCKING] = "blocking",
31};
32
33void br_log_state(const struct net_bridge_port *p)
34{
Paulius Zaleckasd9e179e2012-03-06 22:25:14 +000035 br_info(p->br, "port %u(%s) entered %s state\n",
Eric Dumazet95c96172012-04-15 05:58:06 +000036 (unsigned int) p->port_no, p->dev->name,
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 br_port_state_names[p->state]);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
Florian Fainelli775dd692014-09-30 16:13:19 -070040void br_set_state(struct net_bridge_port *p, unsigned int state)
41{
Scott Feldman38dcf352014-11-28 14:34:20 +010042 int err;
43
Florian Fainelli775dd692014-09-30 16:13:19 -070044 p->state = state;
Scott Feldman38dcf352014-11-28 14:34:20 +010045 err = netdev_switch_port_stp_update(p->dev, state);
46 if (err && err != -EOPNOTSUPP)
47 br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
48 (unsigned int) p->port_no, p->dev->name);
Florian Fainelli775dd692014-09-30 16:13:19 -070049}
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/* called under bridge lock */
52struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no)
53{
54 struct net_bridge_port *p;
55
56 list_for_each_entry_rcu(p, &br->port_list, list) {
57 if (p->port_no == port_no)
58 return p;
59 }
60
61 return NULL;
62}
63
64/* called under bridge lock */
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +090065static int br_should_become_root_port(const struct net_bridge_port *p,
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 u16 root_port)
67{
68 struct net_bridge *br;
69 struct net_bridge_port *rp;
70 int t;
71
72 br = p->br;
73 if (p->state == BR_STATE_DISABLED ||
74 br_is_designated_port(p))
75 return 0;
76
77 if (memcmp(&br->bridge_id, &p->designated_root, 8) <= 0)
78 return 0;
79
80 if (!root_port)
81 return 1;
82
83 rp = br_get_port(br, root_port);
84
85 t = memcmp(&p->designated_root, &rp->designated_root, 8);
86 if (t < 0)
87 return 1;
88 else if (t > 0)
89 return 0;
90
91 if (p->designated_cost + p->path_cost <
92 rp->designated_cost + rp->path_cost)
93 return 1;
94 else if (p->designated_cost + p->path_cost >
95 rp->designated_cost + rp->path_cost)
96 return 0;
97
98 t = memcmp(&p->designated_bridge, &rp->designated_bridge, 8);
99 if (t < 0)
100 return 1;
101 else if (t > 0)
102 return 0;
103
104 if (p->designated_port < rp->designated_port)
105 return 1;
106 else if (p->designated_port > rp->designated_port)
107 return 0;
108
109 if (p->port_id < rp->port_id)
110 return 1;
111
112 return 0;
113}
114
stephen hemminger1007dd12012-11-13 07:53:08 +0000115static void br_root_port_block(const struct net_bridge *br,
116 struct net_bridge_port *p)
117{
118
119 br_notice(br, "port %u(%s) tried to become root port (blocked)",
120 (unsigned int) p->port_no, p->dev->name);
121
Florian Fainelli775dd692014-09-30 16:13:19 -0700122 br_set_state(p, BR_STATE_LISTENING);
stephen hemminger1007dd12012-11-13 07:53:08 +0000123 br_log_state(p);
124 br_ifinfo_notify(RTM_NEWLINK, p);
125
126 if (br->forward_delay > 0)
127 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
128}
129
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130/* called under bridge lock */
131static void br_root_selection(struct net_bridge *br)
132{
133 struct net_bridge_port *p;
134 u16 root_port = 0;
135
136 list_for_each_entry(p, &br->port_list, list) {
stephen hemminger1007dd12012-11-13 07:53:08 +0000137 if (!br_should_become_root_port(p, root_port))
138 continue;
139
140 if (p->flags & BR_ROOT_BLOCK)
141 br_root_port_block(br, p);
142 else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 root_port = p->port_no;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 }
145
146 br->root_port = root_port;
147
148 if (!root_port) {
149 br->designated_root = br->bridge_id;
150 br->root_path_cost = 0;
151 } else {
152 p = br_get_port(br, root_port);
153 br->designated_root = p->designated_root;
154 br->root_path_cost = p->designated_cost + p->path_cost;
155 }
156}
157
158/* called under bridge lock */
159void br_become_root_bridge(struct net_bridge *br)
160{
161 br->max_age = br->bridge_max_age;
162 br->hello_time = br->bridge_hello_time;
163 br->forward_delay = br->bridge_forward_delay;
164 br_topology_change_detection(br);
165 del_timer(&br->tcn_timer);
166
167 if (br->dev->flags & IFF_UP) {
168 br_config_bpdu_generation(br);
169 mod_timer(&br->hello_timer, jiffies + br->hello_time);
170 }
171}
172
173/* called under bridge lock */
174void br_transmit_config(struct net_bridge_port *p)
175{
176 struct br_config_bpdu bpdu;
177 struct net_bridge *br;
178
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 if (timer_pending(&p->hold_timer)) {
180 p->config_pending = 1;
181 return;
182 }
183
184 br = p->br;
185
186 bpdu.topology_change = br->topology_change;
187 bpdu.topology_change_ack = p->topology_change_ack;
188 bpdu.root = br->designated_root;
189 bpdu.root_path_cost = br->root_path_cost;
190 bpdu.bridge_id = br->bridge_id;
191 bpdu.port_id = p->port_id;
192 if (br_is_root_bridge(br))
193 bpdu.message_age = 0;
194 else {
195 struct net_bridge_port *root
196 = br_get_port(br, br->root_port);
stephen hemminger0c031502011-07-22 07:47:06 +0000197 bpdu.message_age = (jiffies - root->designated_age)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 + MESSAGE_AGE_INCR;
199 }
200 bpdu.max_age = br->max_age;
201 bpdu.hello_time = br->hello_time;
202 bpdu.forward_delay = br->forward_delay;
203
204 if (bpdu.message_age < br->max_age) {
205 br_send_config_bpdu(p, &bpdu);
206 p->topology_change_ack = 0;
207 p->config_pending = 0;
Stephen Hemminger9a834b82007-05-31 01:21:39 -0700208 mod_timer(&p->hold_timer,
209 round_jiffies(jiffies + BR_HOLD_TIME));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 }
211}
212
213/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000214static void br_record_config_information(struct net_bridge_port *p,
215 const struct br_config_bpdu *bpdu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216{
217 p->designated_root = bpdu->root;
218 p->designated_cost = bpdu->root_path_cost;
219 p->designated_bridge = bpdu->bridge_id;
220 p->designated_port = bpdu->port_id;
Joakim Tjernlund709e1b52012-03-01 08:12:19 +0000221 p->designated_age = jiffies - bpdu->message_age;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +0900223 mod_timer(&p->message_age_timer, jiffies
Chris Healy9a062012013-09-11 21:37:47 -0700224 + (bpdu->max_age - bpdu->message_age));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225}
226
227/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000228static void br_record_config_timeout_values(struct net_bridge *br,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 const struct br_config_bpdu *bpdu)
230{
231 br->max_age = bpdu->max_age;
232 br->hello_time = bpdu->hello_time;
233 br->forward_delay = bpdu->forward_delay;
234 br->topology_change = bpdu->topology_change;
235}
236
237/* called under bridge lock */
238void br_transmit_tcn(struct net_bridge *br)
239{
stephen hemminger91bc0332013-04-30 05:29:27 +0000240 struct net_bridge_port *p;
241
242 p = br_get_port(br, br->root_port);
243 if (p)
244 br_send_tcn_bpdu(p);
245 else
246 br_notice(br, "root port %u not found for topology notice\n",
247 br->root_port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248}
249
250/* called under bridge lock */
251static int br_should_become_designated_port(const struct net_bridge_port *p)
252{
253 struct net_bridge *br;
254 int t;
255
256 br = p->br;
257 if (br_is_designated_port(p))
258 return 1;
259
260 if (memcmp(&p->designated_root, &br->designated_root, 8))
261 return 1;
262
263 if (br->root_path_cost < p->designated_cost)
264 return 1;
265 else if (br->root_path_cost > p->designated_cost)
266 return 0;
267
268 t = memcmp(&br->bridge_id, &p->designated_bridge, 8);
269 if (t < 0)
270 return 1;
271 else if (t > 0)
272 return 0;
273
274 if (p->port_id < p->designated_port)
275 return 1;
276
277 return 0;
278}
279
280/* called under bridge lock */
281static void br_designated_port_selection(struct net_bridge *br)
282{
283 struct net_bridge_port *p;
284
285 list_for_each_entry(p, &br->port_list, list) {
286 if (p->state != BR_STATE_DISABLED &&
287 br_should_become_designated_port(p))
288 br_become_designated_port(p);
289
290 }
291}
292
293/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000294static int br_supersedes_port_info(const struct net_bridge_port *p,
295 const struct br_config_bpdu *bpdu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296{
297 int t;
298
299 t = memcmp(&bpdu->root, &p->designated_root, 8);
300 if (t < 0)
301 return 1;
302 else if (t > 0)
303 return 0;
304
305 if (bpdu->root_path_cost < p->designated_cost)
306 return 1;
307 else if (bpdu->root_path_cost > p->designated_cost)
308 return 0;
309
310 t = memcmp(&bpdu->bridge_id, &p->designated_bridge, 8);
311 if (t < 0)
312 return 1;
313 else if (t > 0)
314 return 0;
315
316 if (memcmp(&bpdu->bridge_id, &p->br->bridge_id, 8))
317 return 1;
318
319 if (bpdu->port_id <= p->designated_port)
320 return 1;
321
322 return 0;
323}
324
325/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000326static void br_topology_change_acknowledged(struct net_bridge *br)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327{
328 br->topology_change_detected = 0;
329 del_timer(&br->tcn_timer);
330}
331
332/* called under bridge lock */
333void br_topology_change_detection(struct net_bridge *br)
334{
335 int isroot = br_is_root_bridge(br);
336
Stephen Hemminger4f0611a2009-05-15 06:11:58 +0000337 if (br->stp_enabled != BR_KERNEL_STP)
338 return;
339
stephen hemminger28a16c92010-05-10 09:31:09 +0000340 br_info(br, "topology change detected, %s\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 isroot ? "propagating" : "sending tcn bpdu");
342
343 if (isroot) {
344 br->topology_change = 1;
345 mod_timer(&br->topology_change_timer, jiffies
346 + br->bridge_forward_delay + br->bridge_max_age);
347 } else if (!br->topology_change_detected) {
348 br_transmit_tcn(br);
349 mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time);
350 }
351
352 br->topology_change_detected = 1;
353}
354
355/* called under bridge lock */
356void br_config_bpdu_generation(struct net_bridge *br)
357{
358 struct net_bridge_port *p;
359
360 list_for_each_entry(p, &br->port_list, list) {
361 if (p->state != BR_STATE_DISABLED &&
362 br_is_designated_port(p))
363 br_transmit_config(p);
364 }
365}
366
367/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000368static void br_reply(struct net_bridge_port *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369{
370 br_transmit_config(p);
371}
372
373/* called under bridge lock */
374void br_configuration_update(struct net_bridge *br)
375{
376 br_root_selection(br);
377 br_designated_port_selection(br);
378}
379
380/* called under bridge lock */
381void br_become_designated_port(struct net_bridge_port *p)
382{
383 struct net_bridge *br;
384
385 br = p->br;
386 p->designated_root = br->designated_root;
387 p->designated_cost = br->root_path_cost;
388 p->designated_bridge = br->bridge_id;
389 p->designated_port = p->port_id;
390}
391
392
393/* called under bridge lock */
394static void br_make_blocking(struct net_bridge_port *p)
395{
396 if (p->state != BR_STATE_DISABLED &&
397 p->state != BR_STATE_BLOCKING) {
398 if (p->state == BR_STATE_FORWARDING ||
399 p->state == BR_STATE_LEARNING)
400 br_topology_change_detection(p->br);
401
Florian Fainelli775dd692014-09-30 16:13:19 -0700402 br_set_state(p, BR_STATE_BLOCKING);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 br_log_state(p);
stephen hemminger4ecb9612011-07-22 07:47:09 +0000404 br_ifinfo_notify(RTM_NEWLINK, p);
405
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406 del_timer(&p->forward_delay_timer);
407 }
408}
409
410/* called under bridge lock */
411static void br_make_forwarding(struct net_bridge_port *p)
412{
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700413 struct net_bridge *br = p->br;
Stephen Hemminger9cde0702007-03-21 14:22:44 -0700414
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700415 if (p->state != BR_STATE_BLOCKING)
416 return;
417
stephen hemmingera461c022011-03-10 05:57:04 +0000418 if (br->stp_enabled == BR_NO_STP || br->forward_delay == 0) {
Florian Fainelli775dd692014-09-30 16:13:19 -0700419 br_set_state(p, BR_STATE_FORWARDING);
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700420 br_topology_change_detection(br);
421 del_timer(&p->forward_delay_timer);
stephen hemminger160d73b2011-07-22 07:47:10 +0000422 } else if (br->stp_enabled == BR_KERNEL_STP)
Florian Fainelli775dd692014-09-30 16:13:19 -0700423 br_set_state(p, BR_STATE_LISTENING);
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700424 else
Florian Fainelli775dd692014-09-30 16:13:19 -0700425 br_set_state(p, BR_STATE_LEARNING);
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700426
Herbert Xu3fe2d7c2010-02-28 00:49:38 -0800427 br_multicast_enable_port(p);
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700428 br_log_state(p);
stephen hemminger4ecb9612011-07-22 07:47:09 +0000429 br_ifinfo_notify(RTM_NEWLINK, p);
Stephen Hemmingeref647f12008-08-05 18:42:51 -0700430
431 if (br->forward_delay != 0)
432 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433}
434
435/* called under bridge lock */
436void br_port_state_selection(struct net_bridge *br)
437{
438 struct net_bridge_port *p;
stephen hemminger1faa4352011-03-07 08:34:06 +0000439 unsigned int liveports = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440
441 list_for_each_entry(p, &br->port_list, list) {
stephen hemminger1faa4352011-03-07 08:34:06 +0000442 if (p->state == BR_STATE_DISABLED)
443 continue;
444
Vitalii Demianetsb03b6dd2011-11-25 00:16:37 +0000445 /* Don't change port states if userspace is handling STP */
446 if (br->stp_enabled != BR_USER_STP) {
447 if (p->port_no == br->root_port) {
448 p->config_pending = 0;
449 p->topology_change_ack = 0;
450 br_make_forwarding(p);
451 } else if (br_is_designated_port(p)) {
452 del_timer(&p->message_age_timer);
453 br_make_forwarding(p);
454 } else {
455 p->config_pending = 0;
456 p->topology_change_ack = 0;
457 br_make_blocking(p);
458 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 }
460
stephen hemminger1faa4352011-03-07 08:34:06 +0000461 if (p->state == BR_STATE_FORWARDING)
462 ++liveports;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 }
stephen hemminger1faa4352011-03-07 08:34:06 +0000464
465 if (liveports == 0)
466 netif_carrier_off(br->dev);
467 else
468 netif_carrier_on(br->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469}
470
471/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000472static void br_topology_change_acknowledge(struct net_bridge_port *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473{
474 p->topology_change_ack = 1;
475 br_transmit_config(p);
476}
477
478/* called under bridge lock */
stephen hemminger160d73b2011-07-22 07:47:10 +0000479void br_received_config_bpdu(struct net_bridge_port *p,
480 const struct br_config_bpdu *bpdu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481{
482 struct net_bridge *br;
483 int was_root;
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +0900484
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 br = p->br;
486 was_root = br_is_root_bridge(br);
487
488 if (br_supersedes_port_info(p, bpdu)) {
489 br_record_config_information(p, bpdu);
490 br_configuration_update(br);
491 br_port_state_selection(br);
492
493 if (!br_is_root_bridge(br) && was_root) {
494 del_timer(&br->hello_timer);
495 if (br->topology_change_detected) {
496 del_timer(&br->topology_change_timer);
497 br_transmit_tcn(br);
498
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +0900499 mod_timer(&br->tcn_timer,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 jiffies + br->bridge_hello_time);
501 }
502 }
503
504 if (p->port_no == br->root_port) {
505 br_record_config_timeout_values(br, bpdu);
506 br_config_bpdu_generation(br);
507 if (bpdu->topology_change_ack)
508 br_topology_change_acknowledged(br);
509 }
YOSHIFUJI Hideaki9d6f2292007-02-09 23:24:35 +0900510 } else if (br_is_designated_port(p)) {
511 br_reply(p);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 }
513}
514
515/* called under bridge lock */
516void br_received_tcn_bpdu(struct net_bridge_port *p)
517{
518 if (br_is_designated_port(p)) {
stephen hemminger28a16c92010-05-10 09:31:09 +0000519 br_info(p->br, "port %u(%s) received tcn bpdu\n",
Eric Dumazet95c96172012-04-15 05:58:06 +0000520 (unsigned int) p->port_no, p->dev->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521
522 br_topology_change_detection(p->br);
523 br_topology_change_acknowledge(p);
524 }
525}
stephen hemminger14f98f22011-04-04 14:03:33 +0000526
527/* Change bridge STP parameter */
528int br_set_hello_time(struct net_bridge *br, unsigned long val)
529{
530 unsigned long t = clock_t_to_jiffies(val);
531
532 if (t < BR_MIN_HELLO_TIME || t > BR_MAX_HELLO_TIME)
533 return -ERANGE;
534
535 spin_lock_bh(&br->lock);
536 br->bridge_hello_time = t;
537 if (br_is_root_bridge(br))
538 br->hello_time = br->bridge_hello_time;
539 spin_unlock_bh(&br->lock);
540 return 0;
541}
542
543int br_set_max_age(struct net_bridge *br, unsigned long val)
544{
545 unsigned long t = clock_t_to_jiffies(val);
546
547 if (t < BR_MIN_MAX_AGE || t > BR_MAX_MAX_AGE)
548 return -ERANGE;
549
550 spin_lock_bh(&br->lock);
551 br->bridge_max_age = t;
552 if (br_is_root_bridge(br))
553 br->max_age = br->bridge_max_age;
554 spin_unlock_bh(&br->lock);
555 return 0;
556
557}
558
Herbert Xube4f1542013-09-12 17:12:05 +1000559void __br_set_forward_delay(struct net_bridge *br, unsigned long t)
stephen hemminger14f98f22011-04-04 14:03:33 +0000560{
stephen hemminger14f98f22011-04-04 14:03:33 +0000561 br->bridge_forward_delay = t;
562 if (br_is_root_bridge(br))
563 br->forward_delay = br->bridge_forward_delay;
Herbert Xube4f1542013-09-12 17:12:05 +1000564}
565
566int br_set_forward_delay(struct net_bridge *br, unsigned long val)
567{
568 unsigned long t = clock_t_to_jiffies(val);
569 int err = -ERANGE;
570
571 spin_lock_bh(&br->lock);
572 if (br->stp_enabled != BR_NO_STP &&
573 (t < BR_MIN_FORWARD_DELAY || t > BR_MAX_FORWARD_DELAY))
574 goto unlock;
575
576 __br_set_forward_delay(br, t);
577 err = 0;
578
579unlock:
stephen hemminger14f98f22011-04-04 14:03:33 +0000580 spin_unlock_bh(&br->lock);
Herbert Xube4f1542013-09-12 17:12:05 +1000581 return err;
stephen hemminger14f98f22011-04-04 14:03:33 +0000582}