提交 160d73b8 编写于 作者: S stephen hemminger 提交者: David S. Miller

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: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4ecb961c
...@@ -56,7 +56,8 @@ extern void br_become_root_bridge(struct net_bridge *br); ...@@ -56,7 +56,8 @@ extern void br_become_root_bridge(struct net_bridge *br);
extern void br_config_bpdu_generation(struct net_bridge *); extern void br_config_bpdu_generation(struct net_bridge *);
extern void br_configuration_update(struct net_bridge *); extern void br_configuration_update(struct net_bridge *);
extern void br_port_state_selection(struct net_bridge *); extern void br_port_state_selection(struct net_bridge *);
extern void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu); extern void br_received_config_bpdu(struct net_bridge_port *p,
const struct br_config_bpdu *bpdu);
extern void br_received_tcn_bpdu(struct net_bridge_port *p); extern void br_received_tcn_bpdu(struct net_bridge_port *p);
extern void br_transmit_config(struct net_bridge_port *p); extern void br_transmit_config(struct net_bridge_port *p);
extern void br_transmit_tcn(struct net_bridge *br); extern void br_transmit_tcn(struct net_bridge *br);
......
...@@ -109,7 +109,6 @@ static void br_root_selection(struct net_bridge *br) ...@@ -109,7 +109,6 @@ static void br_root_selection(struct net_bridge *br)
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {
if (br_should_become_root_port(p, root_port)) if (br_should_become_root_port(p, root_port))
root_port = p->port_no; root_port = p->port_no;
} }
br->root_port = root_port; br->root_port = root_port;
...@@ -145,7 +144,6 @@ void br_transmit_config(struct net_bridge_port *p) ...@@ -145,7 +144,6 @@ void br_transmit_config(struct net_bridge_port *p)
struct br_config_bpdu bpdu; struct br_config_bpdu bpdu;
struct net_bridge *br; struct net_bridge *br;
if (timer_pending(&p->hold_timer)) { if (timer_pending(&p->hold_timer)) {
p->config_pending = 1; p->config_pending = 1;
return; return;
...@@ -181,8 +179,8 @@ void br_transmit_config(struct net_bridge_port *p) ...@@ -181,8 +179,8 @@ void br_transmit_config(struct net_bridge_port *p)
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_record_config_information(struct net_bridge_port *p, static void br_record_config_information(struct net_bridge_port *p,
const struct br_config_bpdu *bpdu) const struct br_config_bpdu *bpdu)
{ {
p->designated_root = bpdu->root; p->designated_root = bpdu->root;
p->designated_cost = bpdu->root_path_cost; p->designated_cost = bpdu->root_path_cost;
...@@ -195,7 +193,7 @@ static inline void br_record_config_information(struct net_bridge_port *p, ...@@ -195,7 +193,7 @@ static inline void br_record_config_information(struct net_bridge_port *p,
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_record_config_timeout_values(struct net_bridge *br, static void br_record_config_timeout_values(struct net_bridge *br,
const struct br_config_bpdu *bpdu) const struct br_config_bpdu *bpdu)
{ {
br->max_age = bpdu->max_age; br->max_age = bpdu->max_age;
...@@ -254,7 +252,8 @@ static void br_designated_port_selection(struct net_bridge *br) ...@@ -254,7 +252,8 @@ static void br_designated_port_selection(struct net_bridge *br)
} }
/* called under bridge lock */ /* called under bridge lock */
static int br_supersedes_port_info(struct net_bridge_port *p, struct br_config_bpdu *bpdu) static int br_supersedes_port_info(const struct net_bridge_port *p,
const struct br_config_bpdu *bpdu)
{ {
int t; int t;
...@@ -285,7 +284,7 @@ static int br_supersedes_port_info(struct net_bridge_port *p, struct br_config_b ...@@ -285,7 +284,7 @@ static int br_supersedes_port_info(struct net_bridge_port *p, struct br_config_b
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_topology_change_acknowledged(struct net_bridge *br) static void br_topology_change_acknowledged(struct net_bridge *br)
{ {
br->topology_change_detected = 0; br->topology_change_detected = 0;
del_timer(&br->tcn_timer); del_timer(&br->tcn_timer);
...@@ -327,7 +326,7 @@ void br_config_bpdu_generation(struct net_bridge *br) ...@@ -327,7 +326,7 @@ void br_config_bpdu_generation(struct net_bridge *br)
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_reply(struct net_bridge_port *p) static void br_reply(struct net_bridge_port *p)
{ {
br_transmit_config(p); br_transmit_config(p);
} }
...@@ -381,8 +380,7 @@ static void br_make_forwarding(struct net_bridge_port *p) ...@@ -381,8 +380,7 @@ static void br_make_forwarding(struct net_bridge_port *p)
p->state = BR_STATE_FORWARDING; p->state = BR_STATE_FORWARDING;
br_topology_change_detection(br); br_topology_change_detection(br);
del_timer(&p->forward_delay_timer); del_timer(&p->forward_delay_timer);
} } else if (br->stp_enabled == BR_KERNEL_STP)
else if (br->stp_enabled == BR_KERNEL_STP)
p->state = BR_STATE_LISTENING; p->state = BR_STATE_LISTENING;
else else
p->state = BR_STATE_LEARNING; p->state = BR_STATE_LEARNING;
...@@ -433,14 +431,15 @@ void br_port_state_selection(struct net_bridge *br) ...@@ -433,14 +431,15 @@ void br_port_state_selection(struct net_bridge *br)
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_topology_change_acknowledge(struct net_bridge_port *p) static void br_topology_change_acknowledge(struct net_bridge_port *p)
{ {
p->topology_change_ack = 1; p->topology_change_ack = 1;
br_transmit_config(p); br_transmit_config(p);
} }
/* called under bridge lock */ /* called under bridge lock */
void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu) void br_received_config_bpdu(struct net_bridge_port *p,
const struct br_config_bpdu *bpdu)
{ {
struct net_bridge *br; struct net_bridge *br;
int was_root; int was_root;
......
...@@ -222,9 +222,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, ...@@ -222,9 +222,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
} }
br_received_config_bpdu(p, &bpdu); br_received_config_bpdu(p, &bpdu);
} } else if (buf[0] == BPDU_TYPE_TCN) {
else if (buf[0] == BPDU_TYPE_TCN) {
br_received_tcn_bpdu(p); br_received_tcn_bpdu(p);
} }
out: out:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册