diff options
author | <jgarzik@pretzel.yyz.us> | 2005-06-04 17:15:04 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-04 17:15:04 -0400 |
commit | 1a9505996dd0c12a2e56d2c6af00846e75a3850d (patch) | |
tree | 311e431cad5a6acd09442d92fed36c1bd4d0c54c /drivers/net/smc91x.c | |
parent | bdb7a3427be1e31327df0543cc397bf3c994b039 (diff) | |
parent | ea9375607f8b312cf4389d68909330ed32a622ef (diff) |
Automatic merge of /spare/repo/netdev-2.6 branch smc91x
Diffstat (limited to 'drivers/net/smc91x.c')
-rw-r--r-- | drivers/net/smc91x.c | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 5e561ba44333..fd80048f7f7a 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -129,7 +129,7 @@ MODULE_PARM_DESC(nowait, "set to 1 for no wait state"); | |||
129 | /* | 129 | /* |
130 | * Transmit timeout, default 5 seconds. | 130 | * Transmit timeout, default 5 seconds. |
131 | */ | 131 | */ |
132 | static int watchdog = 5000; | 132 | static int watchdog = 1000; |
133 | module_param(watchdog, int, 0400); | 133 | module_param(watchdog, int, 0400); |
134 | MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds"); | 134 | MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds"); |
135 | 135 | ||
@@ -660,15 +660,14 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
660 | SMC_outw(((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr, DATA_REG); | 660 | SMC_outw(((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr, DATA_REG); |
661 | 661 | ||
662 | /* | 662 | /* |
663 | * If THROTTLE_TX_PKTS is set, we look at the TX_EMPTY flag | 663 | * If THROTTLE_TX_PKTS is set, we stop the queue here. This will |
664 | * before queueing this packet for TX, and if it's clear then | 664 | * have the effect of having at most one packet queued for TX |
665 | * we stop the queue here. This will have the effect of | 665 | * in the chip's memory at all time. |
666 | * having at most 2 packets queued for TX in the chip's memory | 666 | * |
667 | * at all time. If THROTTLE_TX_PKTS is not set then the queue | 667 | * If THROTTLE_TX_PKTS is not set then the queue is stopped only |
668 | * is stopped only when memory allocation (MC_ALLOC) does not | 668 | * when memory allocation (MC_ALLOC) does not succeed right away. |
669 | * succeed right away. | ||
670 | */ | 669 | */ |
671 | if (THROTTLE_TX_PKTS && !(SMC_GET_INT() & IM_TX_EMPTY_INT)) | 670 | if (THROTTLE_TX_PKTS) |
672 | netif_stop_queue(dev); | 671 | netif_stop_queue(dev); |
673 | 672 | ||
674 | /* queue the packet for TX */ | 673 | /* queue the packet for TX */ |
@@ -792,17 +791,20 @@ static void smc_tx(struct net_device *dev) | |||
792 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", | 791 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", |
793 | dev->name, tx_status, packet_no); | 792 | dev->name, tx_status, packet_no); |
794 | 793 | ||
795 | if (!(tx_status & TS_SUCCESS)) | 794 | if (!(tx_status & ES_TX_SUC)) |
796 | lp->stats.tx_errors++; | 795 | lp->stats.tx_errors++; |
797 | if (tx_status & TS_LOSTCAR) | 796 | |
797 | if (tx_status & ES_LOSTCARR) | ||
798 | lp->stats.tx_carrier_errors++; | 798 | lp->stats.tx_carrier_errors++; |
799 | 799 | ||
800 | if (tx_status & TS_LATCOL) { | 800 | if (tx_status & (ES_LATCOL | ES_16COL)) { |
801 | PRINTK("%s: late collision occurred on last xmit\n", dev->name); | 801 | PRINTK("%s: %s occurred on last xmit\n", dev->name, |
802 | (tx_status & ES_LATCOL) ? | ||
803 | "late collision" : "too many collisions"); | ||
802 | lp->stats.tx_window_errors++; | 804 | lp->stats.tx_window_errors++; |
803 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { | 805 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { |
804 | printk(KERN_INFO "%s: unexpectedly large numbers of " | 806 | printk(KERN_INFO "%s: unexpectedly large number of " |
805 | "late collisions. Please check duplex " | 807 | "bad collisions. Please check duplex " |
806 | "setting.\n", dev->name); | 808 | "setting.\n", dev->name); |
807 | } | 809 | } |
808 | } | 810 | } |
@@ -1236,7 +1238,7 @@ static void smc_10bt_check_media(struct net_device *dev, int init) | |||
1236 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; | 1238 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; |
1237 | 1239 | ||
1238 | SMC_SELECT_BANK(0); | 1240 | SMC_SELECT_BANK(0); |
1239 | new_carrier = SMC_inw(ioaddr, EPH_STATUS_REG) & ES_LINK_OK ? 1 : 0; | 1241 | new_carrier = (SMC_GET_EPH_STATUS() & ES_LINK_OK) ? 1 : 0; |
1240 | SMC_SELECT_BANK(2); | 1242 | SMC_SELECT_BANK(2); |
1241 | 1243 | ||
1242 | if (init || (old_carrier != new_carrier)) { | 1244 | if (init || (old_carrier != new_carrier)) { |
@@ -1308,15 +1310,16 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1308 | if (!status) | 1310 | if (!status) |
1309 | break; | 1311 | break; |
1310 | 1312 | ||
1311 | if (status & IM_RCV_INT) { | 1313 | if (status & IM_TX_INT) { |
1312 | DBG(3, "%s: RX irq\n", dev->name); | 1314 | /* do this before RX as it will free memory quickly */ |
1313 | smc_rcv(dev); | ||
1314 | } else if (status & IM_TX_INT) { | ||
1315 | DBG(3, "%s: TX int\n", dev->name); | 1315 | DBG(3, "%s: TX int\n", dev->name); |
1316 | smc_tx(dev); | 1316 | smc_tx(dev); |
1317 | SMC_ACK_INT(IM_TX_INT); | 1317 | SMC_ACK_INT(IM_TX_INT); |
1318 | if (THROTTLE_TX_PKTS) | 1318 | if (THROTTLE_TX_PKTS) |
1319 | netif_wake_queue(dev); | 1319 | netif_wake_queue(dev); |
1320 | } else if (status & IM_RCV_INT) { | ||
1321 | DBG(3, "%s: RX irq\n", dev->name); | ||
1322 | smc_rcv(dev); | ||
1320 | } else if (status & IM_ALLOC_INT) { | 1323 | } else if (status & IM_ALLOC_INT) { |
1321 | DBG(3, "%s: Allocation irq\n", dev->name); | 1324 | DBG(3, "%s: Allocation irq\n", dev->name); |
1322 | tasklet_hi_schedule(&lp->tx_task); | 1325 | tasklet_hi_schedule(&lp->tx_task); |
@@ -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); |
@@ -1863,7 +1871,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr) | |||
1863 | SMC_SELECT_BANK(1); | 1871 | SMC_SELECT_BANK(1); |
1864 | val = SMC_GET_BASE(); | 1872 | val = SMC_GET_BASE(); |
1865 | val = ((val & 0x1F00) >> 3) << SMC_IO_SHIFT; | 1873 | val = ((val & 0x1F00) >> 3) << SMC_IO_SHIFT; |
1866 | if (((unsigned long)ioaddr & ((PAGE_SIZE-1)<<SMC_IO_SHIFT)) != val) { /*XXX: WTF? */ | 1874 | if (((unsigned int)ioaddr & (0x3e0 << SMC_IO_SHIFT)) != val) { |
1867 | printk("%s: IOADDR %p doesn't match configuration (%x).\n", | 1875 | printk("%s: IOADDR %p doesn't match configuration (%x).\n", |
1868 | CARDNAME, ioaddr, val); | 1876 | CARDNAME, ioaddr, val); |
1869 | } | 1877 | } |