[PATCH 5/5] 2.4.27-pre3 pcnet32 remove timer and complexity.
From: Don Fry <hidden>
Date: 2004-05-21 20:59:04
This removes the timer I recently added, and the 'ltint' interrupt mitigation from the 79C971 and 79C972. It did not improve performance, added complexity, and was a bad idea in hind sight.
--- linux-2.4.27-pre3/drivers/net/size.pcnet32.c Fri May 21 12:37:14 2004
+++ linux-2.4.27-pre3/drivers/net/pcnet32.c Fri May 21 12:37:18 2004@@ -22,8 +22,8 @@ *************************************************************************/ #define DRV_NAME "pcnet32" -#define DRV_VERSION "1.29" -#define DRV_RELDATE "04.06.2004" +#define DRV_VERSION "1.30" +#define DRV_RELDATE "05.18.2004" #define PFX DRV_NAME ": " static const char *version =
@@ -239,6 +239,8 @@ * identification code (blink led's) and register dump. * Don Fry added timer for 971/972 so skbufs don't remain on tx ring * forever. + * v1.30 18 May 2004 Don Fry removed timer and Last Transmit Interrupt + * (ltint) as they added complexity and didn't give good throughput. */
@@ -343,7 +345,6 @@ char tx_full; int options; int shared_irq:1, /* shared irq possible */ - ltint:1, /* enable TxDone-intr inhibitor */ dxsuflo:1, /* disable transmit stop on uflo */ mii:1; /* mii port available */ struct net_device *next;
@@ -998,7 +999,7 @@ struct pcnet32_private *lp; dma_addr_t lp_dma_addr; int i, media; - int fdx, mii, fset, dxsuflo, ltint; + int fdx, mii, fset, dxsuflo; int chip_version; char *chipname; struct net_device *dev;
@@ -1030,7 +1031,7 @@ } /* initialize variables */ - fdx = mii = fset = dxsuflo = ltint = 0; + fdx = mii = fset = dxsuflo = 0; chip_version = (chip_version >> 12) & 0xffff; switch (chip_version) {
@@ -1050,7 +1051,6 @@ case 0x2623: chipname = "PCnet/FAST 79C971"; /* PCI */ fdx = 1; mii = 1; fset = 1; - ltint = 1; break; case 0x2624: chipname = "PCnet/FAST+ 79C972"; /* PCI */
@@ -1103,14 +1103,6 @@ a->write_bcr(ioaddr, 18, (a->read_bcr(ioaddr, 18) | 0x0860)); a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); dxsuflo = 1; - ltint = 1; - } - - if (ltint) { - /* Enable timer to prevent skbuffs from remaining on the tx ring - * forever if no other tx being done. Set timer period to about - * 122 ms */ - a->write_bcr(ioaddr, 31, 0x253b); } dev = alloc_etherdev(0);
@@ -1217,7 +1209,6 @@ lp->mii_if.phy_id_mask = 0x1f; lp->mii_if.reg_num_mask = 0x1f; lp->dxsuflo = dxsuflo; - lp->ltint = ltint; lp->mii = mii; lp->msg_enable = pcnet32_debug; if ((cards_found >= MAX_UNITS) || (options[cards_found] > sizeof(options_mapping)))
@@ -1436,12 +1427,6 @@ } #endif - if (lp->ltint) { /* Enable TxDone-intr inhibitor */ - val = lp->a.read_csr (ioaddr, 5); - val |= (1<<14); - lp->a.write_csr (ioaddr, 5, val); - } - lp->init_block.mode = le16_to_cpu((lp->options & PCNET32_PORT_PORTSEL) << 7); pcnet32_load_multicast(dev);
@@ -1459,11 +1444,6 @@ lp->a.write_csr (ioaddr, 4, 0x0915); lp->a.write_csr (ioaddr, 0, 0x0001); - if (lp->ltint) { - /* start the software timer */ - lp->a.write_csr(ioaddr, 7, 0x0400); /* set STINTE */ - } - netif_start_queue(dev); /* If we have mii, print the link status and start the watchdog */
@@ -1676,19 +1656,6 @@ * interrupt when that option is available to us. */ status = 0x8300; - entry = (lp->cur_tx - lp->dirty_tx) & TX_RING_MOD_MASK; - if ((lp->ltint) && - ((entry == TX_RING_SIZE/3) || - (entry == (TX_RING_SIZE*2)/3) || - (entry >= TX_RING_SIZE-2))) - { - /* Enable Successful-TxDone interrupt if we have - * 1/3, 2/3 or nearly all of, our ring buffer Tx'd - * but not yet cleaned up. Thus, most of the time, - * we will not enable Successful-TxDone interrupts. - */ - status = 0x9300; - } /* Fill in a Tx ring entry */
@@ -1732,7 +1699,7 @@ struct net_device *dev = dev_id; struct pcnet32_private *lp; unsigned long ioaddr; - u16 csr0, csr7, rap; + u16 csr0,rap; int boguscnt = max_interrupt_work; int must_restart;
@@ -1749,19 +1716,13 @@ spin_lock(&lp->lock); rap = lp->a.read_rap(ioaddr); - csr0 = lp->a.read_csr (ioaddr, 0); - csr7 = lp->ltint ? lp->a.read_csr(ioaddr, 7) : 0; - - while ((csr0 & 0x8600 || csr7 & 0x0800) && --boguscnt >= 0) { + while ((csr0 = lp->a.read_csr (ioaddr, 0)) & 0x8600 && --boguscnt >= 0) { if (csr0 == 0xffff) { break; /* PCMCIA remove happened */ } /* Acknowledge all of the current interrupt sources ASAP. */ lp->a.write_csr (ioaddr, 0, csr0 & ~0x004f); - if (csr7 & 0x0800) - lp->a.write_csr(ioaddr, 7, csr7); - must_restart = 0; if (netif_msg_intr(lp))
@@ -1771,7 +1732,7 @@ if (csr0 & 0x0400) /* Rx interrupt */ pcnet32_rx(dev); - if (csr0 & 0x0200 || csr7 & 0x0800) { /* Tx-done or Timer interrupt */ + if (csr0 & 0x0200) { /* Tx-done interrupt */ unsigned int dirty_tx = lp->dirty_tx; int delta;
@@ -1878,9 +1839,6 @@ lp->a.write_csr (ioaddr, 0, 0x0004); pcnet32_restart(dev, 0x0002); } - - csr0 = lp->a.read_csr (ioaddr, 0); - csr7 = lp->ltint ? lp->a.read_csr(ioaddr, 7) : 0; } /* Clear any other interrupt, and set interrupt enable. */
@@ -2025,10 +1983,6 @@ /* We stop the PCNET32 here -- it occasionally polls memory if we don't. */ lp->a.write_csr (ioaddr, 0, 0x0004); - if (lp->ltint) { /* Disable timer interrupts */ - lp->a.write_csr(ioaddr, 7, 0x0000); - } - /* * Switch back to 16bit mode to avoid problems with dumb * DOS packet driver after a warm reboot
--
Don Fry
brazilnut@us.ibm.com