amd64/73360: sk0: watchdog timeout

John-Mark Gurney gurney_j at resnet.uoregon.edu
Sun Oct 31 16:57:38 PST 2004


Wolfgang S. Rupprecht wrote this message on Sun, Oct 31, 2004 at 14:17 -0800:
> 
> simsong at acm.org (Simson L. Garfinkel) writes:
> > sk0: watchdog timeout
> > 
> > I wanted you to know that the problem hasn't gone away.      
> 
> Looks like some sk hardware needs to have the tx prodded continually.
> 
> This solved my tx problem under openbsd/amd64 (grabbed from a netbsd
> fix).  Maybe the freebsd drivers need something similar too?
> 
> --- if_sk.c	14 Oct 2004 15:27:39 -0000	1.47
> +++ if_sk.c	17 Oct 2004 04:30:39 -0000
> @@ -1949,8 +1946,11 @@ sk_txeof(struct sk_if_softc *sc_if)
>  		}
>  		sc_if->sk_cdata.sk_tx_cnt--;
>  		SK_INC(idx, SK_TX_RING_CNT);
> -		ifp->if_timer = 0;
>  	}
> +	if (sc_if->sk_cdata.sk_tx_cnt == 0)
> +		ifp->if_timer = 0;
> +	else /* nudge chip to keep tx ring moving */
> +		CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
>  
>  	sc_if->sk_cdata.sk_tx_cons = idx;

Hey, thanks for pointing this patch out...  I've slightly modified it
to better handle IFF_OACTIVE since it's possible to clear the flag when
it shouldn't be...

If people see this patch improve things, I'll commit it... I haven't
tested w/ my sk card yet though...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
-------------- next part --------------
Index: if_sk.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_sk.c,v
retrieving revision 1.86
diff -u -r1.86 if_sk.c
--- if_sk.c	20 Aug 2004 06:22:04 -0000	1.86
+++ if_sk.c	1 Nov 2004 00:54:20 -0000
@@ -1816,11 +1816,13 @@
 	}
 
 	/* Transmit */
-	sc_if->sk_cdata.sk_tx_prod = idx;
-	CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
+	if (idx != sc_if->sk_cdata.sk_tx_prod) {
+		sc_if->sk_cdata.sk_tx_prod = idx;
+		CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
 
-	/* Set a timeout in case the chip goes out to lunch. */
-	ifp->if_timer = 5;
+		/* Set a timeout in case the chip goes out to lunch. */
+		ifp->if_timer = 5;
+	}
 	SK_IF_UNLOCK(sc_if);
 
 	return;
@@ -1960,13 +1962,15 @@
 		}
 		sc_if->sk_cdata.sk_tx_cnt--;
 		SK_INC(idx, SK_TX_RING_CNT);
-		ifp->if_timer = 0;
 	}
 
-	sc_if->sk_cdata.sk_tx_cons = idx;
-
-	if (cur_tx != NULL)
+	if (sc_if->sk_cdata.sk_tx_cnt == 0) {
+		ifp->if_timer = 0;
 		ifp->if_flags &= ~IFF_OACTIVE;
+	} else /* nudge chip to keep tx ring moving */
+		CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
+
+	sc_if->sk_cdata.sk_tx_cons = idx;
 
 	return;
 }


More information about the freebsd-amd64 mailing list