Tx-timeout patch
Frank Morton
fmorton@base2inc.com
Mon Feb 8 18:47:35 1999
Will this be in the 0.08 release?
----- Original Message -----
From: Michel Mueller <sirius@krypton.imp.com>
To: <yellowfin@cesdis1.gsfc.nasa.gov>
Cc: <becker@tidalwave.net>
Sent: Monday, February 08, 1999 5:15 PM
Subject: Tx-timeout patch
>
>Here is a patch for the Tx-timeout problem.
>
>The timeout accured because the Tx-PDMA engine was restarted even if it
>was still running (the Docuementation does not say what happens if you
>do so). So I changed the following line in hamachi_start_xmit to take care
>of the actual state of the TxPDMA engine and the timeout errors are gone.
>I also put the Tx-Intrrupt-patch from Peter Monta in this patch.
>
>
>I had a look at the new driver from Eric Kasten and I think there is a
>problem with the tx_full flag.
>In Eric's driver, the tx_full flag is only cleared when hamachi_start_xmit
>is called. But hamachi_start_xmit should not be called by the kernel when
>tx_full is set. So the Driver stalls as soon as the Tx-queue is full.
>Tx_full must be cleared from within the interrupt driver,
>or am I overlooking something ?
>
>I hope this patch helps making the driver more Stable.
>
> Michel Mueller
>
>
>old: writew(0x0001, dev->base_addr + TxCmd);
>new: status=readw(dev->base_addr + TxStatus);
> if( !( status & 0x0001) || (status & 0x0002))
> writew(1, dev->base_addr + TxCmd);
>
>
>
>
>
>
>
----------------------------------------------------------------------------
----
>--- hamachi.c.orig Mon Feb 8 22:53:05 1999
>+++ hamachi.c Mon Feb 8 22:52:45 1999
>@@ -18,7 +18,7 @@
> */
>
> static const char *version =
>-"hamachi.c:v0.07 8/17/98 Written by Donald Becker\n"
>+"hamachi.c:v0.09 02/08/99 Written by Donald Becker\n"
> " http://www.tidalwave.net/~becker/hamachi.html\n";
>
> /* A few user-configurable values. */
>@@ -198,7 +198,16 @@
>
> IVc. Errata
>
>-None noted. */
>+None noted.
>+
>+V. Changes
>+
>+0.09: Michel Mueller
>+fixed the TxDMA Interrupt: patch by Peter Monta
>+fixed the Tx-timeout problem (TxCmd and RxCmd need only to be set when
idle or
>+stopped)
>+
>+*/
>
>
> /* A few values that may be tweaked. */
>@@ -805,6 +814,7 @@
> {
> struct hamachi_private *hmp = (struct hamachi_private *)dev->priv;
> unsigned entry;
>+ int status;
>
> /* Block a timer-based transmit from overlapping. This could better be
> done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
>@@ -826,15 +836,17 @@
> hmp->tx_ring[entry].addr = virt_to_bus(skb->data);
> hmp->tx_ring[entry].length = skb->len;
> if (entry >= TX_RING_SIZE-1) /* Wrap ring */
>- hmp->tx_ring[entry].status = DescOwn|DescEndPacket|DescEndRing;
>+ hmp->tx_ring[entry].status = DescOwn|DescEndPacket|DescEndRing|DescIntr;
> else
>- hmp->tx_ring[entry].status = DescOwn|DescEndPacket;
>+ hmp->tx_ring[entry].status = DescOwn|DescEndPacket|DescIntr;
> hmp->cur_tx++;
>
> /* Non-x86 Todo: explicitly flush cache lines here. */
>
>- /* Wake the potentially-idle transmit channel. */
>- writew(1, dev->base_addr + TxCmd);
>+ /* Wake the transmit channel if idle or stopped. */
>+ status=readw(dev->base_addr + TxStatus);
>+ if( !(status & 0x0001) || (status & 0x0002))
>+ writew(1, dev->base_addr + TxCmd);
>
> if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 1)
> clear_bit(0, (void*)&dev->tbusy); /* Typical path */
>@@ -942,7 +954,7 @@
> {
> struct hamachi_private *hmp = (struct hamachi_private *)dev->priv;
> int entry = hmp->cur_rx % RX_RING_SIZE;
>- int boguscnt = 20;
>+ int boguscnt = max_interrupt_work;
>
> if (hamachi_debug > 4) {
> printk(KERN_DEBUG " In hamachi_rx(), entry %d status %4.4x.\n",
>@@ -1059,7 +1071,8 @@
> }
>
> /* Restart Rx engine if stopped. */
>- writew(1, dev->base_addr + RxCmd);
>+ if( readw(dev->base_addr + RxStatus) & 0x0002)
>+ writew(1, dev->base_addr + RxCmd);
> return 0;
> }
>
>@@ -1188,7 +1201,7 @@
> /* We should lock this segment of code for SMP eventually, although
> the vulnerability window is very small and statistics are
> non-critical. */
>- hmp->stats.tx_packets = readl(ioaddr + 0x000);
>+ /* hmp->stats.tx_packets = readl(ioaddr + 0x000); */
> #if LINUX_VERSION_CODE >= 0x20119
> hmp->stats.rx_bytes = readl(ioaddr + 0x330); /* Total Uni+Brd+Multi */
> hmp->stats.tx_bytes = readl(ioaddr + 0x3B0); /* Total Uni+Brd+Multi */
>
| To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
| body of the mail, include only the text:
| unsubscribe this-list-name youraddress@wherever.org
| You will be unsubscribed as speedily as possible.