diff options
author | Nicolas Pitre <nico@cam.org> | 2005-04-12 16:21:11 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-05-27 22:21:16 -0400 |
commit | 8de901150f3c58b019b2a3ce497d23ab662dbb8b (patch) | |
tree | 87f9bd69ab2b40cd51041a13022bfaa5755d516b /drivers | |
parent | eb1d6988130d5f2716ba1d53197caab0fdc31b94 (diff) |
[PATCH] smc91x: improve diagnostic info
... and remove duplicate status defines.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Index: linux-2.6/drivers/net/smc91x.c
===================================================================
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc91x.c | 30 | ||||
-rw-r--r-- | drivers/net/smc91x.h | 9 |
2 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 1e2b860dab23..a6c0628fdb21 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -792,17 +792,20 @@ static void smc_tx(struct net_device *dev) | |||
792 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", | 792 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", |
793 | dev->name, tx_status, packet_no); | 793 | dev->name, tx_status, packet_no); |
794 | 794 | ||
795 | if (!(tx_status & TS_SUCCESS)) | 795 | if (!(tx_status & ES_TX_SUC)) |
796 | lp->stats.tx_errors++; | 796 | lp->stats.tx_errors++; |
797 | if (tx_status & TS_LOSTCAR) | 797 | |
798 | if (tx_status & ES_LOSTCARR) | ||
798 | lp->stats.tx_carrier_errors++; | 799 | lp->stats.tx_carrier_errors++; |
799 | 800 | ||
800 | if (tx_status & TS_LATCOL) { | 801 | if (tx_status & (ES_LATCOL | ES_16COL)) { |
801 | PRINTK("%s: late collision occurred on last xmit\n", dev->name); | 802 | PRINTK("%s: %s occurred on last xmit\n", dev->name, |
803 | (tx_status & ES_LATCOL) ? | ||
804 | "late collision" : "too many collisions"); | ||
802 | lp->stats.tx_window_errors++; | 805 | lp->stats.tx_window_errors++; |
803 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { | 806 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { |
804 | printk(KERN_INFO "%s: unexpectedly large numbers of " | 807 | printk(KERN_INFO "%s: unexpectedly large number of " |
805 | "late collisions. Please check duplex " | 808 | "bad collisions. Please check duplex " |
806 | "setting.\n", dev->name); | 809 | "setting.\n", dev->name); |
807 | } | 810 | } |
808 | } | 811 | } |
@@ -1236,7 +1239,7 @@ static void smc_10bt_check_media(struct net_device *dev, int init) | |||
1236 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; | 1239 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; |
1237 | 1240 | ||
1238 | SMC_SELECT_BANK(0); | 1241 | SMC_SELECT_BANK(0); |
1239 | new_carrier = SMC_inw(ioaddr, EPH_STATUS_REG) & ES_LINK_OK ? 1 : 0; | 1242 | new_carrier = (SMC_GET_EPH_STATUS() & ES_LINK_OK) ? 1 : 0; |
1240 | SMC_SELECT_BANK(2); | 1243 | SMC_SELECT_BANK(2); |
1241 | 1244 | ||
1242 | if (init || (old_carrier != new_carrier)) { | 1245 | if (init || (old_carrier != new_carrier)) { |
@@ -1337,7 +1340,10 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1337 | /* multiple collisions */ | 1340 | /* multiple collisions */ |
1338 | lp->stats.collisions += card_stats & 0xF; | 1341 | lp->stats.collisions += card_stats & 0xF; |
1339 | } else if (status & IM_RX_OVRN_INT) { | 1342 | } else if (status & IM_RX_OVRN_INT) { |
1340 | DBG(1, "%s: RX overrun\n", dev->name); | 1343 | DBG(1, "%s: RX overrun (EPH_ST 0x%04x)\n", dev->name, |
1344 | ({ int eph_st; SMC_SELECT_BANK(0); | ||
1345 | eph_st = SMC_GET_EPH_STATUS(); | ||
1346 | SMC_SELECT_BANK(2); eph_st; }) ); | ||
1341 | SMC_ACK_INT(IM_RX_OVRN_INT); | 1347 | SMC_ACK_INT(IM_RX_OVRN_INT); |
1342 | lp->stats.rx_errors++; | 1348 | lp->stats.rx_errors++; |
1343 | lp->stats.rx_fifo_errors++; | 1349 | lp->stats.rx_fifo_errors++; |
@@ -1389,7 +1395,7 @@ static void smc_timeout(struct net_device *dev) | |||
1389 | { | 1395 | { |
1390 | struct smc_local *lp = netdev_priv(dev); | 1396 | struct smc_local *lp = netdev_priv(dev); |
1391 | void __iomem *ioaddr = lp->base; | 1397 | void __iomem *ioaddr = lp->base; |
1392 | int status, mask, meminfo, fifo; | 1398 | int status, mask, eph_st, meminfo, fifo; |
1393 | 1399 | ||
1394 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); | 1400 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); |
1395 | 1401 | ||
@@ -1398,11 +1404,13 @@ static void smc_timeout(struct net_device *dev) | |||
1398 | mask = SMC_GET_INT_MASK(); | 1404 | mask = SMC_GET_INT_MASK(); |
1399 | fifo = SMC_GET_FIFO(); | 1405 | fifo = SMC_GET_FIFO(); |
1400 | SMC_SELECT_BANK(0); | 1406 | SMC_SELECT_BANK(0); |
1407 | eph_st = SMC_GET_EPH_STATUS(); | ||
1401 | meminfo = SMC_GET_MIR(); | 1408 | meminfo = SMC_GET_MIR(); |
1402 | SMC_SELECT_BANK(2); | 1409 | SMC_SELECT_BANK(2); |
1403 | spin_unlock_irq(&lp->lock); | 1410 | spin_unlock_irq(&lp->lock); |
1404 | PRINTK( "%s: INT 0x%02x MASK 0x%02x MEM 0x%04x FIFO 0x%04x\n", | 1411 | PRINTK( "%s: TX timeout (INT 0x%02x INTMASK 0x%02x " |
1405 | dev->name, status, mask, meminfo, fifo ); | 1412 | "MEM 0x%04x FIFO 0x%04x EPH_ST 0x%04x)\n", |
1413 | dev->name, status, mask, meminfo, fifo, eph_st ); | ||
1406 | 1414 | ||
1407 | smc_reset(dev); | 1415 | smc_reset(dev); |
1408 | smc_enable(dev); | 1416 | smc_enable(dev); |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index c3bf0cf7cf93..946528e6b742 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -681,14 +681,6 @@ static const char * chip_ids[ 16 ] = { | |||
681 | 681 | ||
682 | 682 | ||
683 | /* | 683 | /* |
684 | . Transmit status bits | ||
685 | */ | ||
686 | #define TS_SUCCESS 0x0001 | ||
687 | #define TS_LOSTCAR 0x0400 | ||
688 | #define TS_LATCOL 0x0200 | ||
689 | #define TS_16COL 0x0010 | ||
690 | |||
691 | /* | ||
692 | . Receive status bits | 684 | . Receive status bits |
693 | */ | 685 | */ |
694 | #define RS_ALGNERR 0x8000 | 686 | #define RS_ALGNERR 0x8000 |
@@ -845,6 +837,7 @@ static const char * chip_ids[ 16 ] = { | |||
845 | #define SMC_GET_FIFO() SMC_inw( ioaddr, FIFO_REG ) | 837 | #define SMC_GET_FIFO() SMC_inw( ioaddr, FIFO_REG ) |
846 | #define SMC_GET_PTR() SMC_inw( ioaddr, PTR_REG ) | 838 | #define SMC_GET_PTR() SMC_inw( ioaddr, PTR_REG ) |
847 | #define SMC_SET_PTR(x) SMC_outw( x, ioaddr, PTR_REG ) | 839 | #define SMC_SET_PTR(x) SMC_outw( x, ioaddr, PTR_REG ) |
840 | #define SMC_GET_EPH_STATUS() SMC_inw( ioaddr, EPH_STATUS_REG ) | ||
848 | #define SMC_GET_RCR() SMC_inw( ioaddr, RCR_REG ) | 841 | #define SMC_GET_RCR() SMC_inw( ioaddr, RCR_REG ) |
849 | #define SMC_SET_RCR(x) SMC_outw( x, ioaddr, RCR_REG ) | 842 | #define SMC_SET_RCR(x) SMC_outw( x, ioaddr, RCR_REG ) |
850 | #define SMC_GET_REV() SMC_inw( ioaddr, REV_REG ) | 843 | #define SMC_GET_REV() SMC_inw( ioaddr, REV_REG ) |