8390 : Replace ei_debug with msg_enable/NETIF_MSG_* feature
Removed the shared ei_debug variable. Replaced it by adding u32 msg_enable to the private struct ei_device. Now each 8390 ethernet instance has a per-device logging variable. Changed older style printk() calls to more canonical forms. Tested on: ne, ne2k-pci, smc-ultra, and wd hardware. V4.0 - Substituted pr_info() and pr_debug() for printk() KERN_INFO and KERN_DEBUG V3.0 - Checked for cases where pr_cont() was most appropriate choice. - Changed module parameter from 'debug' to 'msg_enable' because debug was no longer the best description. V2.0 - Changed netif_msg_(drv|probe|ifdown|rx_err|tx_err|tx_queued|intr|rx_status|hw) to netif_(dbg|info|warn|err) where possible. Signed-off-by: Matthew Whitehead <tedheadster@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
7e98056964
commit
c45f812f02
@@ -99,11 +99,6 @@
|
||||
#define ei_block_input (ei_local->block_input)
|
||||
#define ei_get_8390_hdr (ei_local->get_8390_hdr)
|
||||
|
||||
/* use 0 for production, 1 for verification, >2 for debug */
|
||||
#ifndef ei_debug
|
||||
int ei_debug = 1;
|
||||
#endif
|
||||
|
||||
/* Index to functions. */
|
||||
static void ei_tx_intr(struct net_device *dev);
|
||||
static void ei_tx_err(struct net_device *dev);
|
||||
@@ -116,6 +111,11 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
|
||||
static void do_set_multicast_list(struct net_device *dev);
|
||||
static void __NS8390_init(struct net_device *dev, int startp);
|
||||
|
||||
static unsigned version_printed;
|
||||
static u32 msg_enable;
|
||||
module_param(msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
|
||||
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
|
||||
|
||||
/*
|
||||
* SMP and the 8390 setup.
|
||||
*
|
||||
@@ -345,19 +345,23 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
|
||||
if (ei_local->tx1 == 0) {
|
||||
output_page = ei_local->tx_start_page;
|
||||
ei_local->tx1 = send_length;
|
||||
if (ei_debug && ei_local->tx2 > 0)
|
||||
netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
|
||||
if ((netif_msg_tx_queued(ei_local)) &&
|
||||
ei_local->tx2 > 0)
|
||||
netdev_dbg(dev,
|
||||
"idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
|
||||
ei_local->tx2, ei_local->lasttx, ei_local->txing);
|
||||
} else if (ei_local->tx2 == 0) {
|
||||
output_page = ei_local->tx_start_page + TX_PAGES/2;
|
||||
ei_local->tx2 = send_length;
|
||||
if (ei_debug && ei_local->tx1 > 0)
|
||||
netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
|
||||
if ((netif_msg_tx_queued(ei_local)) &&
|
||||
ei_local->tx1 > 0)
|
||||
netdev_dbg(dev,
|
||||
"idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
|
||||
ei_local->tx1, ei_local->lasttx, ei_local->txing);
|
||||
} else { /* We should never get here. */
|
||||
if (ei_debug)
|
||||
netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
|
||||
ei_local->tx1, ei_local->tx2, ei_local->lasttx);
|
||||
netif_dbg(ei_local, tx_err, dev,
|
||||
"No Tx buffers free! tx1=%d tx2=%d last=%d\n",
|
||||
ei_local->tx1, ei_local->tx2, ei_local->lasttx);
|
||||
ei_local->irqlock = 0;
|
||||
netif_stop_queue(dev);
|
||||
ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR);
|
||||
@@ -388,7 +392,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
|
||||
} else
|
||||
ei_local->txqueue++;
|
||||
|
||||
if (ei_local->tx1 && ei_local->tx2)
|
||||
if (ei_local->tx1 && ei_local->tx2)
|
||||
netif_stop_queue(dev);
|
||||
else
|
||||
netif_start_queue(dev);
|
||||
@@ -445,9 +449,8 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
|
||||
|
||||
/* Change to page 0 and read the intr status reg. */
|
||||
ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
|
||||
if (ei_debug > 3)
|
||||
netdev_dbg(dev, "interrupt(isr=%#2.2x)\n",
|
||||
ei_inb_p(e8390_base + EN0_ISR));
|
||||
netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
|
||||
ei_inb_p(e8390_base + EN0_ISR));
|
||||
|
||||
/* !!Assumption!! -- we stay in page 0. Don't break this. */
|
||||
while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 &&
|
||||
@@ -485,7 +488,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
|
||||
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
|
||||
}
|
||||
|
||||
if (interrupts && ei_debug) {
|
||||
if (interrupts && (netif_msg_intr(ei_local))) {
|
||||
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
|
||||
if (nr_serviced >= MAX_SERVICE) {
|
||||
/* 0xFF is valid for a card removal */
|
||||
@@ -676,10 +679,11 @@ static void ei_receive(struct net_device *dev)
|
||||
Keep quiet if it looks like a card removal. One problem here
|
||||
is that some clones crash in roughly the same way.
|
||||
*/
|
||||
if (ei_debug > 0 &&
|
||||
if ((netif_msg_rx_status(ei_local)) &&
|
||||
this_frame != ei_local->current_page &&
|
||||
(this_frame != 0x0 || rxing_page != 0xFF))
|
||||
netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
|
||||
netdev_err(dev,
|
||||
"mismatched read page pointers %2x vs %2x\n",
|
||||
this_frame, ei_local->current_page);
|
||||
|
||||
if (this_frame == rxing_page) /* Read all the frames? */
|
||||
@@ -707,10 +711,10 @@ static void ei_receive(struct net_device *dev)
|
||||
}
|
||||
|
||||
if (pkt_len < 60 || pkt_len > 1518) {
|
||||
if (ei_debug)
|
||||
netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
|
||||
rx_frame.count, rx_frame.status,
|
||||
rx_frame.next);
|
||||
netif_dbg(ei_local, rx_status, dev,
|
||||
"bogus packet size: %d, status=%#2x nxpg=%#2x\n",
|
||||
rx_frame.count, rx_frame.status,
|
||||
rx_frame.next);
|
||||
dev->stats.rx_errors++;
|
||||
dev->stats.rx_length_errors++;
|
||||
} else if ((pkt_stat & 0x0F) == ENRSR_RXOK) {
|
||||
@@ -718,9 +722,9 @@ static void ei_receive(struct net_device *dev)
|
||||
|
||||
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
||||
if (skb == NULL) {
|
||||
if (ei_debug > 1)
|
||||
netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n",
|
||||
pkt_len);
|
||||
netif_err(ei_local, rx_err, dev,
|
||||
"Couldn't allocate a sk_buff of size %d\n",
|
||||
pkt_len);
|
||||
dev->stats.rx_dropped++;
|
||||
break;
|
||||
} else {
|
||||
@@ -736,10 +740,10 @@ static void ei_receive(struct net_device *dev)
|
||||
dev->stats.multicast++;
|
||||
}
|
||||
} else {
|
||||
if (ei_debug)
|
||||
netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
|
||||
rx_frame.status, rx_frame.next,
|
||||
rx_frame.count);
|
||||
netif_err(ei_local, rx_err, dev,
|
||||
"bogus packet: status=%#2x nxpg=%#2x size=%d\n",
|
||||
rx_frame.status, rx_frame.next,
|
||||
rx_frame.count);
|
||||
dev->stats.rx_errors++;
|
||||
/* NB: The NIC counts CRC, frame and missed errors. */
|
||||
if (pkt_stat & ENRSR_FO)
|
||||
@@ -789,8 +793,7 @@ static void ei_rx_overrun(struct net_device *dev)
|
||||
was_txing = ei_inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
|
||||
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
|
||||
|
||||
if (ei_debug > 1)
|
||||
netdev_dbg(dev, "Receiver overrun\n");
|
||||
netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
|
||||
dev->stats.rx_over_errors++;
|
||||
|
||||
/*
|
||||
@@ -965,8 +968,9 @@ static void __ei_set_multicast_list(struct net_device *dev)
|
||||
static void ethdev_setup(struct net_device *dev)
|
||||
{
|
||||
struct ei_device *ei_local = netdev_priv(dev);
|
||||
if (ei_debug > 1)
|
||||
printk(version);
|
||||
|
||||
if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
|
||||
pr_info("%s", version);
|
||||
|
||||
ether_setup(dev);
|
||||
|
||||
@@ -1035,9 +1039,10 @@ static void __NS8390_init(struct net_device *dev, int startp)
|
||||
ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
|
||||
for (i = 0; i < 6; i++) {
|
||||
ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
|
||||
if (ei_debug > 1 &&
|
||||
if ((netif_msg_probe(ei_local)) &&
|
||||
ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i)) != dev->dev_addr[i])
|
||||
netdev_err(dev, "Hw. address read/write mismap %d\n", i);
|
||||
netdev_err(dev,
|
||||
"Hw. address read/write mismap %d\n", i);
|
||||
}
|
||||
|
||||
ei_outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
|
||||
|
Reference in New Issue
Block a user