Subject: Re: port-i386/10141: fxp bug(?) on large PCs
To: None <dokas@cs.umn.edu>
From: John Hawkinson <jhawk@MIT.EDU>
List: netbsd-bugs
Date: 05/17/2000 16:23:29
| >Description:
| 	  I've got a Dell PowerEdge 2400 with a built in fxp ethernet adapter.
| 	  Starting with yesterday's -current (May 16), I've started getting lots
| 	  of the following messages:
| 
| 	    fxp0: dmasync timeout
| 
| 	  at a rate of about 1 per 15 seconds.

Interesting.

I added checks to the fxp driver (dev/ic/i82557.c) to avoid some places
where it had the potential to hang forever:

----------------------------
revision 1.26
date: 2000/05/12 03:35:57;  author: jhawk;  state: Exp;  lines: +26 -7
Catch some potentially infinite loops in while() loops if the chip happens
to "go insane" and never complete some operations (dmasync, etc.).
----------------------------

It appears that in some cases those timeouts may be too short.

It would be good to know which of the timeouts is causing the problem,
and what a better value for it might be. Perhaps the attached patch,
for instance.

Could you also try frobbing the timeout count before the loop,
for instance:

  1373          i = 10000;
  1374          do {
  1375                  FXP_CDCONFIGSYNC(sc,
  1376                      BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  1377          } while ((cbp->cb_status & FXP_CB_STATUS_C) == 0 && --i);
  1378          if (i == 0) {
  1379                  printf("%s: dmasync timeout\n", sc->sc_dev.dv_xname);
  1380                  return ETIMEDOUT;

change the initialization of i to 100,000 and see if that improves things?

Thanks.

--jhawk

*** sys/dev/ic/i82557.c	Wed May 17 16:19:13 2000
--- sys/dev/ic/i82557.c	Wed May 17 16:16:42 2000
***************
*** 1376,1382 ****
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((cbp->cb_status & FXP_CB_STATUS_C) == 0 && --i);
  	if (i == 0) {
! 		printf("%s: dmasync timeout\n", sc->sc_dev.dv_xname);
  		return ETIMEDOUT;
  	}
  
--- 1376,1382 ----
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((cbp->cb_status & FXP_CB_STATUS_C) == 0 && --i);
  	if (i == 0) {
! 		printf("%s: 1dmasync timeout\n", sc->sc_dev.dv_xname);
  		return ETIMEDOUT;
  	}
  
***************
*** 1406,1412 ****
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((cb_ias->cb_status & FXP_CB_STATUS_C) == 0 && --i);
  	if (i == 0) {
! 		printf("%s: dmasync timeout\n", sc->sc_dev.dv_xname);
  		return ETIMEDOUT;
  	}
  	/*
--- 1406,1412 ----
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((cb_ias->cb_status & FXP_CB_STATUS_C) == 0 && --i);
  	if (i == 0) {
! 		printf("%s: 2dmasync timeout\n", sc->sc_dev.dv_xname);
  		return ETIMEDOUT;
  	}
  	/*
***************
*** 1865,1871 ****
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((mcsp->cb_status & FXP_CB_STATUS_C) == 0 && --count);
  	if (count == 0) {
! 		printf("%s: dmasync timeout\n", sc->sc_dev.dv_xname);
  		return;
  	}
  }
--- 1865,1871 ----
  		    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
  	} while ((mcsp->cb_status & FXP_CB_STATUS_C) == 0 && --count);
  	if (count == 0) {
! 		printf("%s: 3dmasync timeout\n", sc->sc_dev.dv_xname);
  		return;
  	}
  }