diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-02-04 19:02:16 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-11 11:06:32 -0500 |
commit | c991d168cb649d416c5a773a50d0754299f31366 (patch) | |
tree | 6c1ed7ca84648fdde413f4ef682255be29fc9f36 /drivers/net | |
parent | 41c340f0f89ce44be4956c146436c335dba47142 (diff) |
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: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/dm9000.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 45ab6edd1b5b..851618338b2e 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -714,7 +714,8 @@ dm9000_open(struct net_device *dev) | |||
714 | board_info_t *db = (board_info_t *) dev->priv; | 714 | board_info_t *db = (board_info_t *) dev->priv; |
715 | unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK; | 715 | unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK; |
716 | 716 | ||
717 | dev_dbg(db->dev, "entering %s\n", __func__); | 717 | if (netif_msg_ifup(db)) |
718 | dev_dbg(db->dev, "enabling %s\n", dev->name); | ||
718 | 719 | ||
719 | /* If there is no IRQ type specified, default to something that | 720 | /* If there is no IRQ type specified, default to something that |
720 | * may work, and tell the user that this is a problem */ | 721 | * may work, and tell the user that this is a problem */ |
@@ -855,7 +856,8 @@ dm9000_stop(struct net_device *ndev) | |||
855 | { | 856 | { |
856 | board_info_t *db = (board_info_t *) ndev->priv; | 857 | board_info_t *db = (board_info_t *) ndev->priv; |
857 | 858 | ||
858 | dm9000_dbg(db, 1, "entering %s\n", __func__); | 859 | if (netif_msg_ifdown(db)) |
860 | dev_dbg(db->dev, "shutting down %s\n", ndev->name); | ||
859 | 861 | ||
860 | netif_stop_queue(ndev); | 862 | netif_stop_queue(ndev); |
861 | netif_carrier_off(ndev); | 863 | netif_carrier_off(ndev); |
@@ -883,6 +885,9 @@ dm9000_tx_done(struct net_device *dev, board_info_t * db) | |||
883 | db->tx_pkt_cnt--; | 885 | db->tx_pkt_cnt--; |
884 | dev->stats.tx_packets++; | 886 | dev->stats.tx_packets++; |
885 | 887 | ||
888 | if (netif_msg_tx_done(db)) | ||
889 | dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status); | ||
890 | |||
886 | /* Queue packet check & send */ | 891 | /* Queue packet check & send */ |
887 | if (db->tx_pkt_cnt > 0) { | 892 | if (db->tx_pkt_cnt > 0) { |
888 | iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff); | 893 | iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff); |
@@ -918,6 +923,9 @@ dm9000_interrupt(int irq, void *dev_id) | |||
918 | int_status = ior(db, DM9000_ISR); /* Got ISR */ | 923 | int_status = ior(db, DM9000_ISR); /* Got ISR */ |
919 | iow(db, DM9000_ISR, int_status); /* Clear ISR status */ | 924 | iow(db, DM9000_ISR, int_status); /* Clear ISR status */ |
920 | 925 | ||
926 | if (netif_msg_intr(db)) | ||
927 | dev_dbg(db->dev, "interrupt status %02x\n", int_status); | ||
928 | |||
921 | /* Received the coming packet */ | 929 | /* Received the coming packet */ |
922 | if (int_status & ISR_PRS) | 930 | if (int_status & ISR_PRS) |
923 | dm9000_rx(dev); | 931 | dm9000_rx(dev); |
@@ -982,10 +990,15 @@ dm9000_rx(struct net_device *dev) | |||
982 | 990 | ||
983 | RxLen = le16_to_cpu(rxhdr.RxLen); | 991 | RxLen = le16_to_cpu(rxhdr.RxLen); |
984 | 992 | ||
993 | if (netif_msg_rx_status(db)) | ||
994 | dev_dbg(db->dev, "RX: status %02x, length %04x\n", | ||
995 | rxhdr.RxStatus, RxLen); | ||
996 | |||
985 | /* Packet Status check */ | 997 | /* Packet Status check */ |
986 | if (RxLen < 0x40) { | 998 | if (RxLen < 0x40) { |
987 | GoodPacket = false; | 999 | GoodPacket = false; |
988 | dev_dbg(db->dev, "Bad Packet received (runt)\n"); | 1000 | if (netif_msg_rx_err(db)) |
1001 | dev_dbg(db->dev, "RX: Bad Packet (runt)\n"); | ||
989 | } | 1002 | } |
990 | 1003 | ||
991 | if (RxLen > DM9000_PKT_MAX) { | 1004 | if (RxLen > DM9000_PKT_MAX) { |
@@ -995,15 +1008,18 @@ dm9000_rx(struct net_device *dev) | |||
995 | if (rxhdr.RxStatus & 0xbf) { | 1008 | if (rxhdr.RxStatus & 0xbf) { |
996 | GoodPacket = false; | 1009 | GoodPacket = false; |
997 | if (rxhdr.RxStatus & 0x01) { | 1010 | if (rxhdr.RxStatus & 0x01) { |
998 | dev_dbg(db->dev, "fifo error\n"); | 1011 | if (netif_msg_rx_err(db)) |
1012 | dev_dbg(db->dev, "fifo error\n"); | ||
999 | dev->stats.rx_fifo_errors++; | 1013 | dev->stats.rx_fifo_errors++; |
1000 | } | 1014 | } |
1001 | if (rxhdr.RxStatus & 0x02) { | 1015 | if (rxhdr.RxStatus & 0x02) { |
1002 | dev_dbg(db->dev, "crc error\n"); | 1016 | if (netif_msg_rx_err(db)) |
1017 | dev_dbg(db->dev, "crc error\n"); | ||
1003 | dev->stats.rx_crc_errors++; | 1018 | dev->stats.rx_crc_errors++; |
1004 | } | 1019 | } |
1005 | if (rxhdr.RxStatus & 0x80) { | 1020 | if (rxhdr.RxStatus & 0x80) { |
1006 | dev_dbg(db->dev, "length error\n"); | 1021 | if (netif_msg_rx_err(db)) |
1022 | dev_dbg(db->dev, "length error\n"); | ||
1007 | dev->stats.rx_length_errors++; | 1023 | dev->stats.rx_length_errors++; |
1008 | } | 1024 | } |
1009 | } | 1025 | } |