Commit 59deab26 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

gianfar: Use pr_<level>, netdev_<level> and netif_<level>

Use the current logging styles.

Add #define DEBUG to get same output for <foo>_dbg messages.
Convert a few bare printks to pr_err.

Fix a likely copy/paste defect where a test was done with RX values:
        if (num_rx_qs > MAX_RX_QS) {
but TX limits were emitted:
        printk(KERN_ERR "num_rx_qs(=%d) greater than MAX_RX_QS(=%d)\n",
                              num_tx_qs, MAX_TX_QS);
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@conan.davemloft.net>
parent ea110733
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
* The driver then cleans up the buffer. * The driver then cleans up the buffer.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DEBUG
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -213,8 +216,7 @@ static int gfar_init_bds(struct net_device *ndev) ...@@ -213,8 +216,7 @@ static int gfar_init_bds(struct net_device *ndev)
} else { } else {
skb = gfar_new_skb(ndev); skb = gfar_new_skb(ndev);
if (!skb) { if (!skb) {
pr_err("%s: Can't allocate RX buffers\n", netdev_err(ndev, "Can't allocate RX buffers\n");
ndev->name);
goto err_rxalloc_fail; goto err_rxalloc_fail;
} }
rx_queue->rx_skbuff[j] = skb; rx_queue->rx_skbuff[j] = skb;
...@@ -258,9 +260,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev) ...@@ -258,9 +260,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
sizeof(struct rxbd8) * priv->total_rx_ring_size, sizeof(struct rxbd8) * priv->total_rx_ring_size,
&addr, GFP_KERNEL); &addr, GFP_KERNEL);
if (!vaddr) { if (!vaddr) {
if (netif_msg_ifup(priv)) netif_err(priv, ifup, ndev,
pr_err("%s: Could not allocate buffer descriptors!\n", "Could not allocate buffer descriptors!\n");
ndev->name);
return -ENOMEM; return -ENOMEM;
} }
...@@ -290,9 +291,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev) ...@@ -290,9 +291,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
tx_queue->tx_skbuff = kmalloc(sizeof(*tx_queue->tx_skbuff) * tx_queue->tx_skbuff = kmalloc(sizeof(*tx_queue->tx_skbuff) *
tx_queue->tx_ring_size, GFP_KERNEL); tx_queue->tx_ring_size, GFP_KERNEL);
if (!tx_queue->tx_skbuff) { if (!tx_queue->tx_skbuff) {
if (netif_msg_ifup(priv)) netif_err(priv, ifup, ndev,
pr_err("%s: Could not allocate tx_skbuff\n", "Could not allocate tx_skbuff\n");
ndev->name);
goto cleanup; goto cleanup;
} }
...@@ -306,9 +306,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev) ...@@ -306,9 +306,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
rx_queue->rx_ring_size, GFP_KERNEL); rx_queue->rx_ring_size, GFP_KERNEL);
if (!rx_queue->rx_skbuff) { if (!rx_queue->rx_skbuff) {
if (netif_msg_ifup(priv)) netif_err(priv, ifup, ndev,
pr_err("%s: Could not allocate rx_skbuff\n", "Could not allocate rx_skbuff\n");
ndev->name);
goto cleanup; goto cleanup;
} }
...@@ -628,9 +627,9 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) ...@@ -628,9 +627,9 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
num_tx_qs = tx_queues ? *tx_queues : 1; num_tx_qs = tx_queues ? *tx_queues : 1;
if (num_tx_qs > MAX_TX_QS) { if (num_tx_qs > MAX_TX_QS) {
printk(KERN_ERR "num_tx_qs(=%d) greater than MAX_TX_QS(=%d)\n", pr_err("num_tx_qs(=%d) greater than MAX_TX_QS(=%d)\n",
num_tx_qs, MAX_TX_QS); num_tx_qs, MAX_TX_QS);
printk(KERN_ERR "Cannot do alloc_etherdev, aborting\n"); pr_err("Cannot do alloc_etherdev, aborting\n");
return -EINVAL; return -EINVAL;
} }
...@@ -638,9 +637,9 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) ...@@ -638,9 +637,9 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
num_rx_qs = rx_queues ? *rx_queues : 1; num_rx_qs = rx_queues ? *rx_queues : 1;
if (num_rx_qs > MAX_RX_QS) { if (num_rx_qs > MAX_RX_QS) {
printk(KERN_ERR "num_rx_qs(=%d) greater than MAX_RX_QS(=%d)\n", pr_err("num_rx_qs(=%d) greater than MAX_RX_QS(=%d)\n",
num_tx_qs, MAX_TX_QS); num_rx_qs, MAX_RX_QS);
printk(KERN_ERR "Cannot do alloc_etherdev, aborting\n"); pr_err("Cannot do alloc_etherdev, aborting\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1163,8 +1162,7 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1163,8 +1162,7 @@ static int gfar_probe(struct platform_device *ofdev)
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
printk(KERN_ERR "%s: Cannot register net device, aborting.\n", pr_err("%s: Cannot register net device, aborting\n", dev->name);
dev->name);
goto register_fail; goto register_fail;
} }
...@@ -1215,17 +1213,17 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1215,17 +1213,17 @@ static int gfar_probe(struct platform_device *ofdev)
gfar_init_sysfs(dev); gfar_init_sysfs(dev);
/* Print out the device info */ /* Print out the device info */
printk(KERN_INFO DEVICE_NAME "%pM\n", dev->name, dev->dev_addr); netdev_info(dev, "mac: %pM\n", dev->dev_addr);
/* Even more device info helps when determining which kernel */ /* Even more device info helps when determining which kernel */
/* provided which set of benchmarks. */ /* provided which set of benchmarks. */
printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name); netdev_info(dev, "Running with NAPI enabled\n");
for (i = 0; i < priv->num_rx_queues; i++) for (i = 0; i < priv->num_rx_queues; i++)
printk(KERN_INFO "%s: RX BD ring size for Q[%d]: %d\n", netdev_info(dev, "RX BD ring size for Q[%d]: %d\n",
dev->name, i, priv->rx_queue[i]->rx_ring_size); i, priv->rx_queue[i]->rx_ring_size);
for(i = 0; i < priv->num_tx_queues; i++) for(i = 0; i < priv->num_tx_queues; i++)
printk(KERN_INFO "%s: TX BD ring size for Q[%d]: %d\n", netdev_info(dev, "TX BD ring size for Q[%d]: %d\n",
dev->name, i, priv->tx_queue[i]->tx_ring_size); i, priv->tx_queue[i]->tx_ring_size);
return 0; return 0;
...@@ -1858,34 +1856,30 @@ static int register_grp_irqs(struct gfar_priv_grp *grp) ...@@ -1858,34 +1856,30 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
* Transmit, and Receive */ * Transmit, and Receive */
if ((err = request_irq(grp->interruptError, gfar_error, 0, if ((err = request_irq(grp->interruptError, gfar_error, 0,
grp->int_name_er,grp)) < 0) { grp->int_name_er,grp)) < 0) {
if (netif_msg_intr(priv)) netif_err(priv, intr, dev, "Can't get IRQ %d\n",
printk(KERN_ERR "%s: Can't get IRQ %d\n", grp->interruptError);
dev->name, grp->interruptError);
goto err_irq_fail; goto err_irq_fail;
} }
if ((err = request_irq(grp->interruptTransmit, gfar_transmit, if ((err = request_irq(grp->interruptTransmit, gfar_transmit,
0, grp->int_name_tx, grp)) < 0) { 0, grp->int_name_tx, grp)) < 0) {
if (netif_msg_intr(priv)) netif_err(priv, intr, dev, "Can't get IRQ %d\n",
printk(KERN_ERR "%s: Can't get IRQ %d\n", grp->interruptTransmit);
dev->name, grp->interruptTransmit);
goto tx_irq_fail; goto tx_irq_fail;
} }
if ((err = request_irq(grp->interruptReceive, gfar_receive, 0, if ((err = request_irq(grp->interruptReceive, gfar_receive, 0,
grp->int_name_rx, grp)) < 0) { grp->int_name_rx, grp)) < 0) {
if (netif_msg_intr(priv)) netif_err(priv, intr, dev, "Can't get IRQ %d\n",
printk(KERN_ERR "%s: Can't get IRQ %d\n", grp->interruptReceive);
dev->name, grp->interruptReceive);
goto rx_irq_fail; goto rx_irq_fail;
} }
} else { } else {
if ((err = request_irq(grp->interruptTransmit, gfar_interrupt, 0, if ((err = request_irq(grp->interruptTransmit, gfar_interrupt, 0,
grp->int_name_tx, grp)) < 0) { grp->int_name_tx, grp)) < 0) {
if (netif_msg_intr(priv)) netif_err(priv, intr, dev, "Can't get IRQ %d\n",
printk(KERN_ERR "%s: Can't get IRQ %d\n", grp->interruptTransmit);
dev->name, grp->interruptTransmit);
goto err_irq_fail; goto err_irq_fail;
} }
} }
...@@ -2354,9 +2348,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu) ...@@ -2354,9 +2348,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
frame_size += VLAN_HLEN; frame_size += VLAN_HLEN;
if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) { if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) {
if (netif_msg_drv(priv)) netif_err(priv, drv, dev, "Invalid MTU setting\n");
printk(KERN_ERR "%s: Invalid MTU setting\n",
dev->name);
return -EINVAL; return -EINVAL;
} }
...@@ -2776,9 +2768,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) ...@@ -2776,9 +2768,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
gfar_process_frame(dev, skb, amount_pull); gfar_process_frame(dev, skb, amount_pull);
} else { } else {
if (netif_msg_rx_err(priv)) netif_warn(priv, rx_err, dev, "Missing skb!\n");
printk(KERN_WARNING
"%s: Missing skb!\n", dev->name);
rx_queue->stats.rx_dropped++; rx_queue->stats.rx_dropped++;
priv->extra_stats.rx_skbmissing++; priv->extra_stats.rx_skbmissing++;
} }
...@@ -2981,10 +2971,9 @@ static void adjust_link(struct net_device *dev) ...@@ -2981,10 +2971,9 @@ static void adjust_link(struct net_device *dev)
ecntrl &= ~(ECNTRL_R100); ecntrl &= ~(ECNTRL_R100);
break; break;
default: default:
if (netif_msg_link(priv)) netif_warn(priv, link, dev,
printk(KERN_WARNING "Ack! Speed (%d) is not 10/100/1000!\n",
"%s: Ack! Speed (%d) is not 10/100/1000!\n", phydev->speed);
dev->name, phydev->speed);
break; break;
} }
...@@ -3189,8 +3178,8 @@ static irqreturn_t gfar_error(int irq, void *grp_id) ...@@ -3189,8 +3178,8 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
/* Hmm... */ /* Hmm... */
if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv))
printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n", netdev_dbg(dev, "error interrupt (ievent=0x%08x imask=0x%08x)\n",
dev->name, events, gfar_read(&regs->imask)); events, gfar_read(&regs->imask));
/* Update the error counters */ /* Update the error counters */
if (events & IEVENT_TXE) { if (events & IEVENT_TXE) {
...@@ -3203,9 +3192,8 @@ static irqreturn_t gfar_error(int irq, void *grp_id) ...@@ -3203,9 +3192,8 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
if (events & IEVENT_XFUN) { if (events & IEVENT_XFUN) {
unsigned long flags; unsigned long flags;
if (netif_msg_tx_err(priv)) netif_dbg(priv, tx_err, dev,
printk(KERN_DEBUG "%s: TX FIFO underrun, " "TX FIFO underrun, packet dropped\n");
"packet dropped.\n", dev->name);
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
priv->extra_stats.tx_underrun++; priv->extra_stats.tx_underrun++;
...@@ -3218,8 +3206,7 @@ static irqreturn_t gfar_error(int irq, void *grp_id) ...@@ -3218,8 +3206,7 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
unlock_tx_qs(priv); unlock_tx_qs(priv);
local_irq_restore(flags); local_irq_restore(flags);
} }
if (netif_msg_tx_err(priv)) netif_dbg(priv, tx_err, dev, "Transmit Error\n");
printk(KERN_DEBUG "%s: Transmit Error\n", dev->name);
} }
if (events & IEVENT_BSY) { if (events & IEVENT_BSY) {
dev->stats.rx_errors++; dev->stats.rx_errors++;
...@@ -3227,29 +3214,25 @@ static irqreturn_t gfar_error(int irq, void *grp_id) ...@@ -3227,29 +3214,25 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
gfar_receive(irq, grp_id); gfar_receive(irq, grp_id);
if (netif_msg_rx_err(priv)) netif_dbg(priv, rx_err, dev, "busy error (rstat: %x)\n",
printk(KERN_DEBUG "%s: busy error (rstat: %x)\n", gfar_read(&regs->rstat));
dev->name, gfar_read(&regs->rstat));
} }
if (events & IEVENT_BABR) { if (events & IEVENT_BABR) {
dev->stats.rx_errors++; dev->stats.rx_errors++;
priv->extra_stats.rx_babr++; priv->extra_stats.rx_babr++;
if (netif_msg_rx_err(priv)) netif_dbg(priv, rx_err, dev, "babbling RX error\n");
printk(KERN_DEBUG "%s: babbling RX error\n", dev->name);
} }
if (events & IEVENT_EBERR) { if (events & IEVENT_EBERR) {
priv->extra_stats.eberr++; priv->extra_stats.eberr++;
if (netif_msg_rx_err(priv)) netif_dbg(priv, rx_err, dev, "bus error\n");
printk(KERN_DEBUG "%s: bus error\n", dev->name);
} }
if ((events & IEVENT_RXC) && netif_msg_rx_status(priv)) if (events & IEVENT_RXC)
printk(KERN_DEBUG "%s: control frame\n", dev->name); netif_dbg(priv, rx_status, dev, "control frame\n");
if (events & IEVENT_BABT) { if (events & IEVENT_BABT) {
priv->extra_stats.tx_babt++; priv->extra_stats.tx_babt++;
if (netif_msg_tx_err(priv)) netif_dbg(priv, tx_err, dev, "babbling TX error\n");
printk(KERN_DEBUG "%s: babbling TX error\n", dev->name);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
* by reference. * by reference.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -464,8 +466,7 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva ...@@ -464,8 +466,7 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
return -EINVAL; return -EINVAL;
if (!is_power_of_2(rvals->rx_pending)) { if (!is_power_of_2(rvals->rx_pending)) {
printk("%s: Ring sizes must be a power of 2\n", netdev_err(dev, "Ring sizes must be a power of 2\n");
dev->name);
return -EINVAL; return -EINVAL;
} }
...@@ -473,8 +474,7 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva ...@@ -473,8 +474,7 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
return -EINVAL; return -EINVAL;
if (!is_power_of_2(rvals->tx_pending)) { if (!is_power_of_2(rvals->tx_pending)) {
printk("%s: Ring sizes must be a power of 2\n", netdev_err(dev, "Ring sizes must be a power of 2\n");
dev->name);
return -EINVAL; return -EINVAL;
} }
...@@ -700,7 +700,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -700,7 +700,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
cmp_rqfpr = RQFPR_IPV6 |RQFPR_UDP; cmp_rqfpr = RQFPR_IPV6 |RQFPR_UDP;
break; break;
default: default:
printk(KERN_ERR "Right now this class is not supported\n"); pr_err("Right now this class is not supported\n");
return 0; return 0;
} }
...@@ -715,8 +715,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -715,8 +715,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
} }
if (i == MAX_FILER_IDX + 1) { if (i == MAX_FILER_IDX + 1) {
printk(KERN_ERR "No parse rule found, "); pr_err("No parse rule found, can't create hash rules\n");
printk(KERN_ERR "can't create hash rules\n");
return 0; return 0;
} }
......
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