ref: b37cb97ce0034a9562fc045a49539a4769031c08
parent: 008d5a4c2cdc87991a029dff190f56d438ef73d0
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jun 9 03:21:36 EDT 2014
ether79c970: fix mistake fix bug introduced by amd64 support: forgot to update ring index i on receive. surprisingly this was working until there where more than one packet to process. sorry. ilock the controller while processing rings. this should be fixed and use kprocs instead.
--- a/sys/src/9/pc/ether79c970.c
+++ b/sys/src/9/pc/ether79c970.c
@@ -404,6 +404,7 @@
* until a descriptor is encountered still owned by the chip.
*/
if(csr0 & Rint){+ ilock(ctlr);
i = ctlr->rdrx;
dre = &ctlr->rdr[i];
while(!(dre->md1 & Own)){@@ -435,9 +436,10 @@
dre->md2 = 0;
dre->md1 = Own|(-Rbsize & 0xFFFF);
- ctlr->rdrx = NEXT(ctlr->rdrx, Nrdre);
- dre = &ctlr->rdr[ctlr->rdrx];
+ i = ctlr->rdrx = NEXT(ctlr->rdrx, Nrdre);
+ dre = &ctlr->rdr[i];
}
+ iunlock(ctlr);
}
/*
@@ -444,7 +446,7 @@
* Transmitter interrupt: wakeup anyone waiting for a free descriptor.
*/
if(csr0 & Tint){- lock(ctlr);
+ ilock(ctlr);
while(ctlr->ntq){i = ctlr->tdri;
dre = &ctlr->tdr[i];
@@ -474,7 +476,7 @@
ctlr->tdri = NEXT(ctlr->tdri, Ntdre);
}
txstart(ether);
- unlock(ctlr);
+ iunlock(ctlr);
}
goto intrloop;
}
--
⑨