diff options
Diffstat (limited to 'drivers/net/sunvnet.c')
-rw-r--r-- | drivers/net/sunvnet.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c index d281a7b34701..bf3c762de620 100644 --- a/drivers/net/sunvnet.c +++ b/drivers/net/sunvnet.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net> | 3 | * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
7 | |||
6 | #include <linux/module.h> | 8 | #include <linux/module.h> |
7 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
8 | #include <linux/types.h> | 10 | #include <linux/types.h> |
@@ -20,7 +22,6 @@ | |||
20 | #include "sunvnet.h" | 22 | #include "sunvnet.h" |
21 | 23 | ||
22 | #define DRV_MODULE_NAME "sunvnet" | 24 | #define DRV_MODULE_NAME "sunvnet" |
23 | #define PFX DRV_MODULE_NAME ": " | ||
24 | #define DRV_MODULE_VERSION "1.0" | 25 | #define DRV_MODULE_VERSION "1.0" |
25 | #define DRV_MODULE_RELDATE "June 25, 2007" | 26 | #define DRV_MODULE_RELDATE "June 25, 2007" |
26 | 27 | ||
@@ -45,9 +46,9 @@ static int vnet_handle_unknown(struct vnet_port *port, void *arg) | |||
45 | { | 46 | { |
46 | struct vio_msg_tag *pkt = arg; | 47 | struct vio_msg_tag *pkt = arg; |
47 | 48 | ||
48 | printk(KERN_ERR PFX "Received unknown msg [%02x:%02x:%04x:%08x]\n", | 49 | pr_err("Received unknown msg [%02x:%02x:%04x:%08x]\n", |
49 | pkt->type, pkt->stype, pkt->stype_env, pkt->sid); | 50 | pkt->type, pkt->stype, pkt->stype_env, pkt->sid); |
50 | printk(KERN_ERR PFX "Resetting connection.\n"); | 51 | pr_err("Resetting connection\n"); |
51 | 52 | ||
52 | ldc_disconnect(port->vio.lp); | 53 | ldc_disconnect(port->vio.lp); |
53 | 54 | ||
@@ -400,8 +401,8 @@ static int vnet_rx(struct vnet_port *port, void *msgbuf) | |||
400 | if (unlikely(pkt->tag.stype_env != VIO_DRING_DATA)) | 401 | if (unlikely(pkt->tag.stype_env != VIO_DRING_DATA)) |
401 | return 0; | 402 | return 0; |
402 | if (unlikely(pkt->seq != dr->rcv_nxt)) { | 403 | if (unlikely(pkt->seq != dr->rcv_nxt)) { |
403 | printk(KERN_ERR PFX "RX out of sequence seq[0x%llx] " | 404 | pr_err("RX out of sequence seq[0x%llx] rcv_nxt[0x%llx]\n", |
404 | "rcv_nxt[0x%llx]\n", pkt->seq, dr->rcv_nxt); | 405 | pkt->seq, dr->rcv_nxt); |
405 | return 0; | 406 | return 0; |
406 | } | 407 | } |
407 | 408 | ||
@@ -464,8 +465,7 @@ static int handle_mcast(struct vnet_port *port, void *msgbuf) | |||
464 | struct vio_net_mcast_info *pkt = msgbuf; | 465 | struct vio_net_mcast_info *pkt = msgbuf; |
465 | 466 | ||
466 | if (pkt->tag.stype != VIO_SUBTYPE_ACK) | 467 | if (pkt->tag.stype != VIO_SUBTYPE_ACK) |
467 | printk(KERN_ERR PFX "%s: Got unexpected MCAST reply " | 468 | pr_err("%s: Got unexpected MCAST reply [%02x:%02x:%04x:%08x]\n", |
468 | "[%02x:%02x:%04x:%08x]\n", | ||
469 | port->vp->dev->name, | 469 | port->vp->dev->name, |
470 | pkt->tag.type, | 470 | pkt->tag.type, |
471 | pkt->tag.stype, | 471 | pkt->tag.stype, |
@@ -520,7 +520,7 @@ static void vnet_event(void *arg, int event) | |||
520 | } | 520 | } |
521 | 521 | ||
522 | if (unlikely(event != LDC_EVENT_DATA_READY)) { | 522 | if (unlikely(event != LDC_EVENT_DATA_READY)) { |
523 | printk(KERN_WARNING PFX "Unexpected LDC event %d\n", event); | 523 | pr_warning("Unexpected LDC event %d\n", event); |
524 | spin_unlock_irqrestore(&vio->lock, flags); | 524 | spin_unlock_irqrestore(&vio->lock, flags); |
525 | return; | 525 | return; |
526 | } | 526 | } |
@@ -662,8 +662,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
662 | netif_stop_queue(dev); | 662 | netif_stop_queue(dev); |
663 | 663 | ||
664 | /* This is a hard error, log it. */ | 664 | /* This is a hard error, log it. */ |
665 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " | 665 | netdev_err(dev, "BUG! Tx Ring full when queue awake!\n"); |
666 | "queue awake!\n", dev->name); | ||
667 | dev->stats.tx_errors++; | 666 | dev->stats.tx_errors++; |
668 | } | 667 | } |
669 | spin_unlock_irqrestore(&port->vio.lock, flags); | 668 | spin_unlock_irqrestore(&port->vio.lock, flags); |
@@ -696,8 +695,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
696 | 695 | ||
697 | err = __vnet_tx_trigger(port); | 696 | err = __vnet_tx_trigger(port); |
698 | if (unlikely(err < 0)) { | 697 | if (unlikely(err < 0)) { |
699 | printk(KERN_INFO PFX "%s: TX trigger error %d\n", | 698 | netdev_info(dev, "TX trigger error %d\n", err); |
700 | dev->name, err); | ||
701 | d->hdr.state = VIO_DESC_FREE; | 699 | d->hdr.state = VIO_DESC_FREE; |
702 | dev->stats.tx_carrier_errors++; | 700 | dev->stats.tx_carrier_errors++; |
703 | goto out_dropped_unlock; | 701 | goto out_dropped_unlock; |
@@ -952,12 +950,12 @@ static int __devinit vnet_port_alloc_tx_bufs(struct vnet_port *port) | |||
952 | 950 | ||
953 | err = -ENOMEM; | 951 | err = -ENOMEM; |
954 | if (!buf) { | 952 | if (!buf) { |
955 | printk(KERN_ERR "TX buffer allocation failure\n"); | 953 | pr_err("TX buffer allocation failure\n"); |
956 | goto err_out; | 954 | goto err_out; |
957 | } | 955 | } |
958 | err = -EFAULT; | 956 | err = -EFAULT; |
959 | if ((unsigned long)buf & (8UL - 1)) { | 957 | if ((unsigned long)buf & (8UL - 1)) { |
960 | printk(KERN_ERR "TX buffer misaligned\n"); | 958 | pr_err("TX buffer misaligned\n"); |
961 | kfree(buf); | 959 | kfree(buf); |
962 | goto err_out; | 960 | goto err_out; |
963 | } | 961 | } |
@@ -1030,7 +1028,7 @@ static struct vnet * __devinit vnet_new(const u64 *local_mac) | |||
1030 | 1028 | ||
1031 | dev = alloc_etherdev(sizeof(*vp)); | 1029 | dev = alloc_etherdev(sizeof(*vp)); |
1032 | if (!dev) { | 1030 | if (!dev) { |
1033 | printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); | 1031 | pr_err("Etherdev alloc failed, aborting\n"); |
1034 | return ERR_PTR(-ENOMEM); | 1032 | return ERR_PTR(-ENOMEM); |
1035 | } | 1033 | } |
1036 | 1034 | ||
@@ -1056,12 +1054,11 @@ static struct vnet * __devinit vnet_new(const u64 *local_mac) | |||
1056 | 1054 | ||
1057 | err = register_netdev(dev); | 1055 | err = register_netdev(dev); |
1058 | if (err) { | 1056 | if (err) { |
1059 | printk(KERN_ERR PFX "Cannot register net device, " | 1057 | pr_err("Cannot register net device, aborting\n"); |
1060 | "aborting.\n"); | ||
1061 | goto err_out_free_dev; | 1058 | goto err_out_free_dev; |
1062 | } | 1059 | } |
1063 | 1060 | ||
1064 | printk(KERN_INFO "%s: Sun LDOM vnet %pM\n", dev->name, dev->dev_addr); | 1061 | netdev_info(dev, "Sun LDOM vnet %pM\n", dev->dev_addr); |
1065 | 1062 | ||
1066 | list_add(&vp->list, &vnet_list); | 1063 | list_add(&vp->list, &vnet_list); |
1067 | 1064 | ||
@@ -1133,10 +1130,7 @@ static struct vio_driver_ops vnet_vio_ops = { | |||
1133 | 1130 | ||
1134 | static void __devinit print_version(void) | 1131 | static void __devinit print_version(void) |
1135 | { | 1132 | { |
1136 | static int version_printed; | 1133 | printk_once(KERN_INFO "%s", version); |
1137 | |||
1138 | if (version_printed++ == 0) | ||
1139 | printk(KERN_INFO "%s", version); | ||
1140 | } | 1134 | } |
1141 | 1135 | ||
1142 | const char *remote_macaddr_prop = "remote-mac-address"; | 1136 | const char *remote_macaddr_prop = "remote-mac-address"; |
@@ -1157,7 +1151,7 @@ static int __devinit vnet_port_probe(struct vio_dev *vdev, | |||
1157 | 1151 | ||
1158 | vp = vnet_find_parent(hp, vdev->mp); | 1152 | vp = vnet_find_parent(hp, vdev->mp); |
1159 | if (IS_ERR(vp)) { | 1153 | if (IS_ERR(vp)) { |
1160 | printk(KERN_ERR PFX "Cannot find port parent vnet.\n"); | 1154 | pr_err("Cannot find port parent vnet\n"); |
1161 | err = PTR_ERR(vp); | 1155 | err = PTR_ERR(vp); |
1162 | goto err_out_put_mdesc; | 1156 | goto err_out_put_mdesc; |
1163 | } | 1157 | } |
@@ -1165,15 +1159,14 @@ static int __devinit vnet_port_probe(struct vio_dev *vdev, | |||
1165 | rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len); | 1159 | rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len); |
1166 | err = -ENODEV; | 1160 | err = -ENODEV; |
1167 | if (!rmac) { | 1161 | if (!rmac) { |
1168 | printk(KERN_ERR PFX "Port lacks %s property.\n", | 1162 | pr_err("Port lacks %s property\n", remote_macaddr_prop); |
1169 | remote_macaddr_prop); | ||
1170 | goto err_out_put_mdesc; | 1163 | goto err_out_put_mdesc; |
1171 | } | 1164 | } |
1172 | 1165 | ||
1173 | port = kzalloc(sizeof(*port), GFP_KERNEL); | 1166 | port = kzalloc(sizeof(*port), GFP_KERNEL); |
1174 | err = -ENOMEM; | 1167 | err = -ENOMEM; |
1175 | if (!port) { | 1168 | if (!port) { |
1176 | printk(KERN_ERR PFX "Cannot allocate vnet_port.\n"); | 1169 | pr_err("Cannot allocate vnet_port\n"); |
1177 | goto err_out_put_mdesc; | 1170 | goto err_out_put_mdesc; |
1178 | } | 1171 | } |
1179 | 1172 | ||
@@ -1214,9 +1207,8 @@ static int __devinit vnet_port_probe(struct vio_dev *vdev, | |||
1214 | 1207 | ||
1215 | dev_set_drvdata(&vdev->dev, port); | 1208 | dev_set_drvdata(&vdev->dev, port); |
1216 | 1209 | ||
1217 | printk(KERN_INFO "%s: PORT ( remote-mac %pM%s )\n", | 1210 | pr_info("%s: PORT ( remote-mac %pM%s )\n", |
1218 | vp->dev->name, port->raddr, | 1211 | vp->dev->name, port->raddr, switch_port ? " switch-port" : ""); |
1219 | switch_port ? " switch-port" : ""); | ||
1220 | 1212 | ||
1221 | vio_port_up(&port->vio); | 1213 | vio_port_up(&port->vio); |
1222 | 1214 | ||