netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: netdev@vger.kernel.org
Cc: vince@simtec.co.uk, Ben Dooks <ben-linux@fluff.org>
Subject: [patch 15/22] NET: DM9000: Use netif_msg to enable debugging options
Date: Mon, 19 Nov 2007 20:39:25 +0000	[thread overview]
Message-ID: <20071119204015.342133927@fluff.org> (raw)
In-Reply-To: 20071119203910.687238131@fluff.org

[-- Attachment #1: simtec/simtec-drivers-net-dm9000-debug-msglevel.patch --]
[-- Type: text/plain, Size: 2943 bytes --]

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>

Index: linux-2.6.23-quilt4/drivers/net/dm9000.c
===================================================================
--- linux-2.6.23-quilt4.orig/drivers/net/dm9000.c
+++ linux-2.6.23-quilt4/drivers/net/dm9000.c
@@ -745,7 +745,8 @@ dm9000_open(struct net_device *dev)
 	board_info_t *db = (board_info_t *) dev->priv;
 	unsigned long irqflags = IRQF_SHARED;
 
-	dev_dbg(db->dev, "entering %s\n", __func__);
+	if (netif_msg_ifup(db))
+		dev_dbg(db->dev, "enabling %s\n", dev->name);
 
 	if (db->platdata)
 		irqflags |= db->platdata->irqflags;
@@ -881,7 +882,8 @@ dm9000_stop(struct net_device *ndev)
 {
 	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);
 
 	/* deleted timer */
 	kthread_stop(db->thread);
@@ -912,6 +914,9 @@ dm9000_tx_done(struct net_device *dev, b
 		db->tx_pkt_cnt--;
 		db->stats.tx_packets++;
 
+		if (netif_msg_tx_done(db))
+			dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status);
+
 		/* Queue packet check & send */
 		if (db->tx_pkt_cnt > 0) {
 			iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff);
@@ -947,6 +952,9 @@ dm9000_interrupt(int irq, void *dev_id)
 	int_status = ior(db, DM9000_ISR);	/* Got ISR */
 	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 */
 	if (int_status & ISR_PRS)
 		dm9000_rx(dev);
@@ -1048,10 +1056,15 @@ dm9000_rx(struct net_device *dev)
 
 		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 */
 		if (RxLen < 0x40) {
 			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) {
@@ -1061,15 +1074,18 @@ dm9000_rx(struct net_device *dev)
 		if (rxhdr.RxStatus & 0xbf) {
 			GoodPacket = false;
 			if (rxhdr.RxStatus & 0x01) {
-				dev_dbg(db->dev, "fifo error\n");
+				if (netif_msg_rx_err(db))
+					dev_dbg(db->dev, "fifo error\n");
 				db->stats.rx_fifo_errors++;
 			}
 			if (rxhdr.RxStatus & 0x02) {
-				dev_dbg(db->dev, "crc error\n");
+				if (netif_msg_rx_err(db))
+					dev_dbg(db->dev, "crc error\n");
 				db->stats.rx_crc_errors++;
 			}
 			if (rxhdr.RxStatus & 0x80) {
-				dev_dbg(db->dev, "length error\n");
+				if (netif_msg_rx_err(db))
+					dev_dbg(db->dev, "length error\n");
 				db->stats.rx_length_errors++;
 			}
 		}

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

  parent reply	other threads:[~2007-11-19 21:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19 20:39 [patch 00/22] DM9000 updates for 2.6.25 Ben Dooks
2007-11-19 20:39 ` [patch 01/22] NET: DM9000 use dev_xxx() instead of printk for output Ben Dooks
2007-11-24  1:35   ` Jeff Garzik
2007-11-19 20:39 ` [patch 02/22] NET: DM9000 update debugging macros to use debug level Ben Dooks
2007-11-24  1:36   ` Jeff Garzik
2007-11-19 20:39 ` [patch 03/22] NET: DM9000: Pass IRQ flags via platform data Ben Dooks
2007-11-24  1:36   ` Jeff Garzik
2007-11-19 20:39 ` [patch 04/22] NET: DM9000: Add initial ethtool support Ben Dooks
2007-11-24  1:38   ` Jeff Garzik
2007-11-19 20:39 ` [patch 05/22] NET: DM9000: Do not sleep with spinlock and IRQs held Ben Dooks
2007-11-24  1:38   ` Jeff Garzik
2007-11-19 20:39 ` [patch 06/22] NET: DM9000: Use kthread to probe MII status when device open Ben Dooks
2007-11-20  7:46   ` Christoph Hellwig
2007-11-20 10:13     ` Ben Dooks
2007-11-24  1:38   ` Jeff Garzik
2007-12-07 18:33     ` Ben Dooks
2007-11-19 20:39 ` [patch 07/22] NET: DM9000: Use msleep() instead of udelay() Ben Dooks
2007-11-24  1:39   ` Jeff Garzik
2007-12-07 15:42     ` Ben Dooks
2007-11-19 20:39 ` [patch 08/22] NET: DM9000: Remove barely used SROM array read Ben Dooks
2007-11-19 20:39 ` [patch 09/22] NET: DM9000: Add mutex to protect access Ben Dooks
2007-11-19 20:39 ` [patch 10/22] NET: DM9000: Add ethtool support for reading and writing EEPROM Ben Dooks
2007-11-19 20:39 ` [patch 11/22] NET: DM9000: Add ethtool control of msg_enable value Ben Dooks
2007-11-19 20:39 ` [patch 12/22] NET: DM9000: Remove EEPROM initialisation code Ben Dooks
2007-11-19 20:39 ` [patch 13/22] NET: DM9000: Ensure spinlock held whilst accessing EEPROM registers Ben Dooks
2007-11-19 20:39 ` [patch 14/22] NET: DM9000: Remove unnecessary changelog in header comment Ben Dooks
2007-11-24  1:41   ` Jeff Garzik
2007-11-19 20:39 ` Ben Dooks [this message]
2007-11-24  1:42   ` [patch 15/22] NET: DM9000: Use netif_msg to enable debugging options Jeff Garzik
2007-11-19 20:39 ` [patch 16/22] NET: DM9000: Fix delays used by EEPROM read and write Ben Dooks
2007-11-19 20:39 ` [patch 17/22] NET: DM9000: Remove cal_CRC() and use ether_crc_le instead Ben Dooks
2007-11-19 20:39 ` [patch 18/22] NET: DM9000: Remove redudant use of "& 0xff" Ben Dooks
2007-11-19 20:39 ` [patch 19/22] NET: DM9000: Add platform flag for no attached EEPROM Ben Dooks
2007-11-19 20:39 ` [patch 20/22] NET: DM9000: Add support for MII ioctl() calls Ben Dooks
2007-11-19 20:39 ` [patch 21/22] NET: DM9000: Update retry count whilst identifying chip Ben Dooks
2007-11-19 20:39 ` [patch 22/22] NET: DM9000: Show the MAC address source after printing MAC Ben Dooks
2007-11-24  1:43   ` Jeff Garzik
2007-12-07 18:30     ` Ben Dooks
2007-11-19 23:04 ` [patch 00/22] DM9000 updates for 2.6.25 Stephen Hemminger
2007-11-20 10:13   ` Ben Dooks
2007-11-20 17:33 ` Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071119204015.342133927@fluff.org \
    --to=ben-linux@fluff.org \
    --cc=netdev@vger.kernel.org \
    --cc=vince@simtec.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).