diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-07-22 03:47:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-22 20:01:13 -0400 |
commit | 160d73b8455edb1a12967e207790b1a93a4cb0e1 (patch) | |
tree | adba1755432a81fd4d258ecdeb2207d94e36be03 /net | |
parent | 4ecb961c8b474ebef5aff55f715c7875e69dd57b (diff) |
bridge: minor cleanups
Some minor cleanups that won't impact code:
1. Remove inline from non-critical functions; compiler will most
likely inline them anyway.
2. Make function args const where possible.
3. Whitespace cleanup
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_private_stp.h | 3 | ||||
-rw-r--r-- | net/bridge/br_stp.c | 23 | ||||
-rw-r--r-- | net/bridge/br_stp_bpdu.c | 4 |
3 files changed, 14 insertions, 16 deletions
diff --git a/net/bridge/br_private_stp.h b/net/bridge/br_private_stp.h index 642ef47a867e..05ed9bc7e426 100644 --- a/net/bridge/br_private_stp.h +++ b/net/bridge/br_private_stp.h | |||
@@ -56,7 +56,8 @@ extern void br_become_root_bridge(struct net_bridge *br); | |||
56 | extern void br_config_bpdu_generation(struct net_bridge *); | 56 | extern void br_config_bpdu_generation(struct net_bridge *); |
57 | extern void br_configuration_update(struct net_bridge *); | 57 | extern void br_configuration_update(struct net_bridge *); |
58 | extern void br_port_state_selection(struct net_bridge *); | 58 | extern void br_port_state_selection(struct net_bridge *); |
59 | extern void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu); | 59 | extern void br_received_config_bpdu(struct net_bridge_port *p, |
60 | const struct br_config_bpdu *bpdu); | ||
60 | extern void br_received_tcn_bpdu(struct net_bridge_port *p); | 61 | extern void br_received_tcn_bpdu(struct net_bridge_port *p); |
61 | extern void br_transmit_config(struct net_bridge_port *p); | 62 | extern void br_transmit_config(struct net_bridge_port *p); |
62 | extern void br_transmit_tcn(struct net_bridge *br); | 63 | extern void br_transmit_tcn(struct net_bridge *br); |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index 4d651af57a90..ad0a3f7cf6cc 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
@@ -109,7 +109,6 @@ static void br_root_selection(struct net_bridge *br) | |||
109 | list_for_each_entry(p, &br->port_list, list) { | 109 | list_for_each_entry(p, &br->port_list, list) { |
110 | if (br_should_become_root_port(p, root_port)) | 110 | if (br_should_become_root_port(p, root_port)) |
111 | root_port = p->port_no; | 111 | root_port = p->port_no; |
112 | |||
113 | } | 112 | } |
114 | 113 | ||
115 | br->root_port = root_port; | 114 | br->root_port = root_port; |
@@ -145,7 +144,6 @@ void br_transmit_config(struct net_bridge_port *p) | |||
145 | struct br_config_bpdu bpdu; | 144 | struct br_config_bpdu bpdu; |
146 | struct net_bridge *br; | 145 | struct net_bridge *br; |
147 | 146 | ||
148 | |||
149 | if (timer_pending(&p->hold_timer)) { | 147 | if (timer_pending(&p->hold_timer)) { |
150 | p->config_pending = 1; | 148 | p->config_pending = 1; |
151 | return; | 149 | return; |
@@ -181,8 +179,8 @@ void br_transmit_config(struct net_bridge_port *p) | |||
181 | } | 179 | } |
182 | 180 | ||
183 | /* called under bridge lock */ | 181 | /* called under bridge lock */ |
184 | static inline void br_record_config_information(struct net_bridge_port *p, | 182 | static void br_record_config_information(struct net_bridge_port *p, |
185 | const struct br_config_bpdu *bpdu) | 183 | const struct br_config_bpdu *bpdu) |
186 | { | 184 | { |
187 | p->designated_root = bpdu->root; | 185 | p->designated_root = bpdu->root; |
188 | p->designated_cost = bpdu->root_path_cost; | 186 | p->designated_cost = bpdu->root_path_cost; |
@@ -195,7 +193,7 @@ static inline void br_record_config_information(struct net_bridge_port *p, | |||
195 | } | 193 | } |
196 | 194 | ||
197 | /* called under bridge lock */ | 195 | /* called under bridge lock */ |
198 | static inline void br_record_config_timeout_values(struct net_bridge *br, | 196 | static void br_record_config_timeout_values(struct net_bridge *br, |
199 | const struct br_config_bpdu *bpdu) | 197 | const struct br_config_bpdu *bpdu) |
200 | { | 198 | { |
201 | br->max_age = bpdu->max_age; | 199 | br->max_age = bpdu->max_age; |
@@ -254,7 +252,8 @@ static void br_designated_port_selection(struct net_bridge *br) | |||
254 | } | 252 | } |
255 | 253 | ||
256 | /* called under bridge lock */ | 254 | /* called under bridge lock */ |
257 | static int br_supersedes_port_info(struct net_bridge_port *p, struct br_config_bpdu *bpdu) | 255 | static int br_supersedes_port_info(const struct net_bridge_port *p, |
256 | const struct br_config_bpdu *bpdu) | ||
258 | { | 257 | { |
259 | int t; | 258 | int t; |
260 | 259 | ||
@@ -285,7 +284,7 @@ static int br_supersedes_port_info(struct net_bridge_port *p, struct br_config_b | |||
285 | } | 284 | } |
286 | 285 | ||
287 | /* called under bridge lock */ | 286 | /* called under bridge lock */ |
288 | static inline void br_topology_change_acknowledged(struct net_bridge *br) | 287 | static void br_topology_change_acknowledged(struct net_bridge *br) |
289 | { | 288 | { |
290 | br->topology_change_detected = 0; | 289 | br->topology_change_detected = 0; |
291 | del_timer(&br->tcn_timer); | 290 | del_timer(&br->tcn_timer); |
@@ -327,7 +326,7 @@ void br_config_bpdu_generation(struct net_bridge *br) | |||
327 | } | 326 | } |
328 | 327 | ||
329 | /* called under bridge lock */ | 328 | /* called under bridge lock */ |
330 | static inline void br_reply(struct net_bridge_port *p) | 329 | static void br_reply(struct net_bridge_port *p) |
331 | { | 330 | { |
332 | br_transmit_config(p); | 331 | br_transmit_config(p); |
333 | } | 332 | } |
@@ -381,8 +380,7 @@ static void br_make_forwarding(struct net_bridge_port *p) | |||
381 | p->state = BR_STATE_FORWARDING; | 380 | p->state = BR_STATE_FORWARDING; |
382 | br_topology_change_detection(br); | 381 | br_topology_change_detection(br); |
383 | del_timer(&p->forward_delay_timer); | 382 | del_timer(&p->forward_delay_timer); |
384 | } | 383 | } else if (br->stp_enabled == BR_KERNEL_STP) |
385 | else if (br->stp_enabled == BR_KERNEL_STP) | ||
386 | p->state = BR_STATE_LISTENING; | 384 | p->state = BR_STATE_LISTENING; |
387 | else | 385 | else |
388 | p->state = BR_STATE_LEARNING; | 386 | p->state = BR_STATE_LEARNING; |
@@ -433,14 +431,15 @@ void br_port_state_selection(struct net_bridge *br) | |||
433 | } | 431 | } |
434 | 432 | ||
435 | /* called under bridge lock */ | 433 | /* called under bridge lock */ |
436 | static inline void br_topology_change_acknowledge(struct net_bridge_port *p) | 434 | static void br_topology_change_acknowledge(struct net_bridge_port *p) |
437 | { | 435 | { |
438 | p->topology_change_ack = 1; | 436 | p->topology_change_ack = 1; |
439 | br_transmit_config(p); | 437 | br_transmit_config(p); |
440 | } | 438 | } |
441 | 439 | ||
442 | /* called under bridge lock */ | 440 | /* called under bridge lock */ |
443 | void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu) | 441 | void br_received_config_bpdu(struct net_bridge_port *p, |
442 | const struct br_config_bpdu *bpdu) | ||
444 | { | 443 | { |
445 | struct net_bridge *br; | 444 | struct net_bridge *br; |
446 | int was_root; | 445 | int was_root; |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index b69232b3718b..e16aade51ae0 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -222,9 +222,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, | |||
222 | } | 222 | } |
223 | 223 | ||
224 | br_received_config_bpdu(p, &bpdu); | 224 | br_received_config_bpdu(p, &bpdu); |
225 | } | 225 | } else if (buf[0] == BPDU_TYPE_TCN) { |
226 | |||
227 | else if (buf[0] == BPDU_TYPE_TCN) { | ||
228 | br_received_tcn_bpdu(p); | 226 | br_received_tcn_bpdu(p); |
229 | } | 227 | } |
230 | out: | 228 | out: |