Commit c991d168 authored by Ben Dooks's avatar Ben Dooks Committed by Jeff Garzik

DM9000: Use netif_msg to enable debugging options

Use the netif_msg_*() macros to enable the debugging based
on the board's msg_enable field. The output still goes via
the dev_dbg() macros, so will be tagged and output as
appropriate.
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 41c340f0
...@@ -714,7 +714,8 @@ dm9000_open(struct net_device *dev) ...@@ -714,7 +714,8 @@ dm9000_open(struct net_device *dev)
board_info_t *db = (board_info_t *) dev->priv; board_info_t *db = (board_info_t *) dev->priv;
unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK; unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK;
dev_dbg(db->dev, "entering %s\n", __func__); if (netif_msg_ifup(db))
dev_dbg(db->dev, "enabling %s\n", dev->name);
/* If there is no IRQ type specified, default to something that /* If there is no IRQ type specified, default to something that
* may work, and tell the user that this is a problem */ * may work, and tell the user that this is a problem */
...@@ -855,7 +856,8 @@ dm9000_stop(struct net_device *ndev) ...@@ -855,7 +856,8 @@ dm9000_stop(struct net_device *ndev)
{ {
board_info_t *db = (board_info_t *) ndev->priv; board_info_t *db = (board_info_t *) ndev->priv;
dm9000_dbg(db, 1, "entering %s\n", __func__); if (netif_msg_ifdown(db))
dev_dbg(db->dev, "shutting down %s\n", ndev->name);
netif_stop_queue(ndev); netif_stop_queue(ndev);
netif_carrier_off(ndev); netif_carrier_off(ndev);
...@@ -883,6 +885,9 @@ dm9000_tx_done(struct net_device *dev, board_info_t * db) ...@@ -883,6 +885,9 @@ dm9000_tx_done(struct net_device *dev, board_info_t * db)
db->tx_pkt_cnt--; db->tx_pkt_cnt--;
dev->stats.tx_packets++; dev->stats.tx_packets++;
if (netif_msg_tx_done(db))
dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status);
/* Queue packet check & send */ /* Queue packet check & send */
if (db->tx_pkt_cnt > 0) { if (db->tx_pkt_cnt > 0) {
iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff); iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff);
...@@ -918,6 +923,9 @@ dm9000_interrupt(int irq, void *dev_id) ...@@ -918,6 +923,9 @@ dm9000_interrupt(int irq, void *dev_id)
int_status = ior(db, DM9000_ISR); /* Got ISR */ int_status = ior(db, DM9000_ISR); /* Got ISR */
iow(db, DM9000_ISR, int_status); /* Clear ISR status */ iow(db, DM9000_ISR, int_status); /* Clear ISR status */
if (netif_msg_intr(db))
dev_dbg(db->dev, "interrupt status %02x\n", int_status);
/* Received the coming packet */ /* Received the coming packet */
if (int_status & ISR_PRS) if (int_status & ISR_PRS)
dm9000_rx(dev); dm9000_rx(dev);
...@@ -982,10 +990,15 @@ dm9000_rx(struct net_device *dev) ...@@ -982,10 +990,15 @@ dm9000_rx(struct net_device *dev)
RxLen = le16_to_cpu(rxhdr.RxLen); RxLen = le16_to_cpu(rxhdr.RxLen);
if (netif_msg_rx_status(db))
dev_dbg(db->dev, "RX: status %02x, length %04x\n",
rxhdr.RxStatus, RxLen);
/* Packet Status check */ /* Packet Status check */
if (RxLen < 0x40) { if (RxLen < 0x40) {
GoodPacket = false; GoodPacket = false;
dev_dbg(db->dev, "Bad Packet received (runt)\n"); if (netif_msg_rx_err(db))
dev_dbg(db->dev, "RX: Bad Packet (runt)\n");
} }
if (RxLen > DM9000_PKT_MAX) { if (RxLen > DM9000_PKT_MAX) {
...@@ -995,14 +1008,17 @@ dm9000_rx(struct net_device *dev) ...@@ -995,14 +1008,17 @@ dm9000_rx(struct net_device *dev)
if (rxhdr.RxStatus & 0xbf) { if (rxhdr.RxStatus & 0xbf) {
GoodPacket = false; GoodPacket = false;
if (rxhdr.RxStatus & 0x01) { if (rxhdr.RxStatus & 0x01) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "fifo error\n"); dev_dbg(db->dev, "fifo error\n");
dev->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
} }
if (rxhdr.RxStatus & 0x02) { if (rxhdr.RxStatus & 0x02) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "crc error\n"); dev_dbg(db->dev, "crc error\n");
dev->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
} }
if (rxhdr.RxStatus & 0x80) { if (rxhdr.RxStatus & 0x80) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "length error\n"); dev_dbg(db->dev, "length error\n");
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} }
......
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