Commit 28a16c97 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

bridge: change console message interface

Use one set of macro's for all bridge messages.

Note: can't use netdev_XXX macro's because bridge is purely
virtual and has no device parent.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cfb478da
...@@ -38,7 +38,7 @@ static int __init br_init(void) ...@@ -38,7 +38,7 @@ static int __init br_init(void)
err = stp_proto_register(&br_stp_proto); err = stp_proto_register(&br_stp_proto);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "bridge: can't register sap for STP\n"); pr_err("bridge: can't register sap for STP\n");
return err; return err;
} }
......
...@@ -263,9 +263,8 @@ void br_netpoll_enable(struct net_bridge *br, ...@@ -263,9 +263,8 @@ void br_netpoll_enable(struct net_bridge *br,
dev->npinfo = br->dev->npinfo; dev->npinfo = br->dev->npinfo;
} else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) { } else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
br->dev->priv_flags |= IFF_DISABLE_NETPOLL; br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
printk(KERN_INFO "%s:new device %s" br_info(br,"new device %s does not support netpoll (disabling)",
" does not support netpoll (disabling)", dev->name);
br->dev->name, dev->name);
} }
} }
......
...@@ -353,8 +353,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, ...@@ -353,8 +353,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
*/ */
if (fdb->is_local) if (fdb->is_local)
return 0; return 0;
br_warn(br, "adding interface %s with same address "
printk(KERN_WARNING "%s adding interface with same address "
"as a received packet\n", "as a received packet\n",
source->dev->name); source->dev->name);
fdb_delete(fdb); fdb_delete(fdb);
...@@ -397,7 +396,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, ...@@ -397,7 +396,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
/* attempt to update an entry for a local interface */ /* attempt to update an entry for a local interface */
if (unlikely(fdb->is_local)) { if (unlikely(fdb->is_local)) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "%s: received packet with " br_warn(br, "received packet on %s with "
"own address as source address\n", "own address as source address\n",
source->dev->name); source->dev->name);
} else { } else {
......
...@@ -412,6 +412,6 @@ int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -412,6 +412,6 @@ int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
pr_debug("Bridge does not support ioctl 0x%x\n", cmd); br_debug(br, "Bridge does not support ioctl 0x%x\n", cmd);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -585,10 +585,9 @@ static struct net_bridge_mdb_entry *br_multicast_get_group( ...@@ -585,10 +585,9 @@ static struct net_bridge_mdb_entry *br_multicast_get_group(
if (unlikely(count > br->hash_elasticity && count)) { if (unlikely(count > br->hash_elasticity && count)) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO "%s: Multicast hash table " br_info(br, "Multicast hash table "
"chain limit reached: %s\n", "chain limit reached: %s\n",
br->dev->name, port ? port->dev->name : port ? port->dev->name : br->dev->name);
br->dev->name);
elasticity = br->hash_elasticity; elasticity = br->hash_elasticity;
} }
...@@ -596,11 +595,9 @@ static struct net_bridge_mdb_entry *br_multicast_get_group( ...@@ -596,11 +595,9 @@ static struct net_bridge_mdb_entry *br_multicast_get_group(
if (mdb->size >= max) { if (mdb->size >= max) {
max *= 2; max *= 2;
if (unlikely(max >= br->hash_max)) { if (unlikely(max >= br->hash_max)) {
printk(KERN_WARNING "%s: Multicast hash table maximum " br_warn(br, "Multicast hash table maximum "
"reached, disabling snooping: %s, %d\n", "reached, disabling snooping: %s, %d\n",
br->dev->name, port ? port->dev->name : port ? port->dev->name : br->dev->name, max);
br->dev->name,
max);
err = -E2BIG; err = -E2BIG;
disable: disable:
br->multicast_disabled = 1; br->multicast_disabled = 1;
...@@ -611,21 +608,18 @@ static struct net_bridge_mdb_entry *br_multicast_get_group( ...@@ -611,21 +608,18 @@ static struct net_bridge_mdb_entry *br_multicast_get_group(
if (max > mdb->max || elasticity) { if (max > mdb->max || elasticity) {
if (mdb->old) { if (mdb->old) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO "%s: Multicast hash table " br_info(br, "Multicast hash table "
"on fire: %s\n", "on fire: %s\n",
br->dev->name, port ? port->dev->name : port ? port->dev->name : br->dev->name);
br->dev->name);
err = -EEXIST; err = -EEXIST;
goto err; goto err;
} }
err = br_mdb_rehash(&br->mdb, max, elasticity); err = br_mdb_rehash(&br->mdb, max, elasticity);
if (err) { if (err) {
printk(KERN_WARNING "%s: Cannot rehash multicast " br_warn(br, "Cannot rehash multicast "
"hash table, disabling snooping: " "hash table, disabling snooping: %s, %d, %d\n",
"%s, %d, %d\n", port ? port->dev->name : br->dev->name,
br->dev->name, port ? port->dev->name :
br->dev->name,
mdb->size, err); mdb->size, err);
goto disable; goto disable;
} }
......
...@@ -42,7 +42,7 @@ static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *por ...@@ -42,7 +42,7 @@ static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *por
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
pr_debug("br_fill_info event %d port %s master %s\n", br_debug(br, "br_fill_info event %d port %s master %s\n",
event, dev->name, br->dev->name); event, dev->name, br->dev->name);
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*hdr), flags); nlh = nlmsg_put(skb, pid, seq, event, sizeof(*hdr), flags);
...@@ -87,7 +87,9 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) ...@@ -87,7 +87,9 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
struct sk_buff *skb; struct sk_buff *skb;
int err = -ENOBUFS; int err = -ENOBUFS;
pr_debug("bridge notify event=%d\n", event); br_debug(port->br, "port %u(%s) event %d\n",
(unsigned)port->port_no, port->dev->name, event);
skb = nlmsg_new(br_nlmsg_size(), GFP_ATOMIC); skb = nlmsg_new(br_nlmsg_size(), GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
goto errout; goto errout;
......
...@@ -240,6 +240,21 @@ struct br_input_skb_cb { ...@@ -240,6 +240,21 @@ struct br_input_skb_cb {
# define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (0) # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (0)
#endif #endif
#define br_printk(level, br, format, args...) \
printk(level "%s: " format, (br)->dev->name, ##args)
#define br_err(__br, format, args...) \
br_printk(KERN_ERR, __br, format, ##args)
#define br_warn(__br, format, args...) \
br_printk(KERN_WARNING, __br, format, ##args)
#define br_notice(__br, format, args...) \
br_printk(KERN_NOTICE, __br, format, ##args)
#define br_info(__br, format, args...) \
br_printk(KERN_INFO, __br, format, ##args)
#define br_debug(br, format, args...) \
pr_debug("%s: " format, (br)->dev->name, ##args)
extern struct notifier_block br_device_notifier; extern struct notifier_block br_device_notifier;
extern const u8 br_group_address[ETH_ALEN]; extern const u8 br_group_address[ETH_ALEN];
......
...@@ -31,10 +31,9 @@ static const char *const br_port_state_names[] = { ...@@ -31,10 +31,9 @@ static const char *const br_port_state_names[] = {
void br_log_state(const struct net_bridge_port *p) void br_log_state(const struct net_bridge_port *p)
{ {
pr_info("%s: port %d(%s) entering %s state\n", br_info(p->br, "port %u(%s) entering %s state\n",
p->br->dev->name, p->port_no, p->dev->name, (unsigned) p->port_no, p->dev->name,
br_port_state_names[p->state]); br_port_state_names[p->state]);
} }
/* called under bridge lock */ /* called under bridge lock */
...@@ -300,7 +299,7 @@ void br_topology_change_detection(struct net_bridge *br) ...@@ -300,7 +299,7 @@ void br_topology_change_detection(struct net_bridge *br)
if (br->stp_enabled != BR_KERNEL_STP) if (br->stp_enabled != BR_KERNEL_STP)
return; return;
pr_info("%s: topology change detected, %s\n", br->dev->name, br_info(br, "topology change detected, %s\n",
isroot ? "propagating" : "sending tcn bpdu"); isroot ? "propagating" : "sending tcn bpdu");
if (isroot) { if (isroot) {
...@@ -469,8 +468,8 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b ...@@ -469,8 +468,8 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
void br_received_tcn_bpdu(struct net_bridge_port *p) void br_received_tcn_bpdu(struct net_bridge_port *p)
{ {
if (br_is_designated_port(p)) { if (br_is_designated_port(p)) {
pr_info("%s: received tcn bpdu on port %i(%s)\n", br_info(p->br, "port %u(%s) received tcn bpdu\n",
p->br->dev->name, p->port_no, p->dev->name); (unsigned) p->port_no, p->dev->name);
br_topology_change_detection(p->br); br_topology_change_detection(p->br);
br_topology_change_acknowledge(p); br_topology_change_acknowledge(p);
......
...@@ -85,17 +85,16 @@ void br_stp_enable_port(struct net_bridge_port *p) ...@@ -85,17 +85,16 @@ void br_stp_enable_port(struct net_bridge_port *p)
{ {
br_init_port(p); br_init_port(p);
br_port_state_selection(p->br); br_port_state_selection(p->br);
br_log_state(p);
} }
/* called under bridge lock */ /* called under bridge lock */
void br_stp_disable_port(struct net_bridge_port *p) void br_stp_disable_port(struct net_bridge_port *p)
{ {
struct net_bridge *br; struct net_bridge *br = p->br;
int wasroot; int wasroot;
br = p->br; br_log_state(p);
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
br->dev->name, p->port_no, p->dev->name, "disabled");
wasroot = br_is_root_bridge(br); wasroot = br_is_root_bridge(br);
br_become_designated_port(p); br_become_designated_port(p);
...@@ -127,11 +126,10 @@ static void br_stp_start(struct net_bridge *br) ...@@ -127,11 +126,10 @@ static void br_stp_start(struct net_bridge *br)
r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
if (r == 0) { if (r == 0) {
br->stp_enabled = BR_USER_STP; br->stp_enabled = BR_USER_STP;
printk(KERN_INFO "%s: userspace STP started\n", br->dev->name); br_debug(br, "userspace STP started\n");
} else { } else {
br->stp_enabled = BR_KERNEL_STP; br->stp_enabled = BR_KERNEL_STP;
printk(KERN_INFO "%s: starting userspace STP failed, " br_debug(br, "using kernel STP\n");
"starting kernel STP\n", br->dev->name);
/* To start timers on any ports left in blocking */ /* To start timers on any ports left in blocking */
spin_lock_bh(&br->lock); spin_lock_bh(&br->lock);
...@@ -148,9 +146,7 @@ static void br_stp_stop(struct net_bridge *br) ...@@ -148,9 +146,7 @@ static void br_stp_stop(struct net_bridge *br)
if (br->stp_enabled == BR_USER_STP) { if (br->stp_enabled == BR_USER_STP) {
r = call_usermodehelper(BR_STP_PROG, argv, envp, 1); r = call_usermodehelper(BR_STP_PROG, argv, envp, 1);
printk(KERN_INFO "%s: userspace STP stopped, return code %d\n", br_info(br, "userspace STP stopped, return code %d\n", r);
br->dev->name, r);
/* To start timers on any ports left in blocking */ /* To start timers on any ports left in blocking */
spin_lock_bh(&br->lock); spin_lock_bh(&br->lock);
......
...@@ -35,7 +35,7 @@ static void br_hello_timer_expired(unsigned long arg) ...@@ -35,7 +35,7 @@ static void br_hello_timer_expired(unsigned long arg)
{ {
struct net_bridge *br = (struct net_bridge *)arg; struct net_bridge *br = (struct net_bridge *)arg;
pr_debug("%s: hello timer expired\n", br->dev->name); br_debug(br, "hello timer expired\n");
spin_lock(&br->lock); spin_lock(&br->lock);
if (br->dev->flags & IFF_UP) { if (br->dev->flags & IFF_UP) {
br_config_bpdu_generation(br); br_config_bpdu_generation(br);
...@@ -55,13 +55,9 @@ static void br_message_age_timer_expired(unsigned long arg) ...@@ -55,13 +55,9 @@ static void br_message_age_timer_expired(unsigned long arg)
if (p->state == BR_STATE_DISABLED) if (p->state == BR_STATE_DISABLED)
return; return;
br_info(br, "port %u(%s) neighbor %.2x%.2x.%pM lost\n",
pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n", (unsigned) p->port_no, p->dev->name,
br->dev->name, id->prio[0], id->prio[1], &id->addr);
id->prio[0], id->prio[1],
id->addr[0], id->addr[1], id->addr[2],
id->addr[3], id->addr[4], id->addr[5],
p->port_no, p->dev->name);
/* /*
* According to the spec, the message age timer cannot be * According to the spec, the message age timer cannot be
...@@ -87,8 +83,8 @@ static void br_forward_delay_timer_expired(unsigned long arg) ...@@ -87,8 +83,8 @@ static void br_forward_delay_timer_expired(unsigned long arg)
struct net_bridge_port *p = (struct net_bridge_port *) arg; struct net_bridge_port *p = (struct net_bridge_port *) arg;
struct net_bridge *br = p->br; struct net_bridge *br = p->br;
pr_debug("%s: %d(%s) forward delay timer\n", br_debug(br, "port %u(%s) forward delay timer\n",
br->dev->name, p->port_no, p->dev->name); (unsigned) p->port_no, p->dev->name);
spin_lock(&br->lock); spin_lock(&br->lock);
if (p->state == BR_STATE_LISTENING) { if (p->state == BR_STATE_LISTENING) {
p->state = BR_STATE_LEARNING; p->state = BR_STATE_LEARNING;
...@@ -107,7 +103,7 @@ static void br_tcn_timer_expired(unsigned long arg) ...@@ -107,7 +103,7 @@ static void br_tcn_timer_expired(unsigned long arg)
{ {
struct net_bridge *br = (struct net_bridge *) arg; struct net_bridge *br = (struct net_bridge *) arg;
pr_debug("%s: tcn timer expired\n", br->dev->name); br_debug(br, "tcn timer expired\n");
spin_lock(&br->lock); spin_lock(&br->lock);
if (br->dev->flags & IFF_UP) { if (br->dev->flags & IFF_UP) {
br_transmit_tcn(br); br_transmit_tcn(br);
...@@ -121,7 +117,7 @@ static void br_topology_change_timer_expired(unsigned long arg) ...@@ -121,7 +117,7 @@ static void br_topology_change_timer_expired(unsigned long arg)
{ {
struct net_bridge *br = (struct net_bridge *) arg; struct net_bridge *br = (struct net_bridge *) arg;
pr_debug("%s: topo change timer expired\n", br->dev->name); br_debug(br, "topo change timer expired\n");
spin_lock(&br->lock); spin_lock(&br->lock);
br->topology_change_detected = 0; br->topology_change_detected = 0;
br->topology_change = 0; br->topology_change = 0;
...@@ -132,8 +128,8 @@ static void br_hold_timer_expired(unsigned long arg) ...@@ -132,8 +128,8 @@ static void br_hold_timer_expired(unsigned long arg)
{ {
struct net_bridge_port *p = (struct net_bridge_port *) arg; struct net_bridge_port *p = (struct net_bridge_port *) arg;
pr_debug("%s: %d(%s) hold timer expired\n", br_debug(p->br, "port %u(%s) hold timer expired\n",
p->br->dev->name, p->port_no, p->dev->name); (unsigned) p->port_no, p->dev->name);
spin_lock(&p->br->lock); spin_lock(&p->br->lock);
if (p->config_pending) if (p->config_pending)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment