summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/if_ar.c
diff options
context:
space:
mode:
authorjhay <jhay@FreeBSD.org>1996-10-28 19:40:01 +0000
committerjhay <jhay@FreeBSD.org>1996-10-28 19:40:01 +0000
commit8bb207082c2a8419851a3a4dba80c9c455bc25e5 (patch)
tree9c37b924c2031082856af7998495dc20aaa306ca /sys/i386/isa/if_ar.c
parentbb0c2ab1bacc96a65e57b2814db3674db1871c5e (diff)
downloadFreeBSD-src-8bb207082c2a8419851a3a4dba80c9c455bc25e5.zip
FreeBSD-src-8bb207082c2a8419851a3a4dba80c9c455bc25e5.tar.gz
Remove some unnecessary code in the interrupt handler.
Check that a received packet isn't longer than MCLBYTES. This will sometimes happen if a cable is plugged into or removed from a live system. Try to cater better for early receive interrupts.
Diffstat (limited to 'sys/i386/isa/if_ar.c')
-rw-r--r--sys/i386/isa/if_ar.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/sys/i386/isa/if_ar.c b/sys/i386/isa/if_ar.c
index c7d678a..acb6a50 100644
--- a/sys/i386/isa/if_ar.c
+++ b/sys/i386/isa/if_ar.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ar.c,v 1.9 1996/06/25 20:29:56 bde Exp $
+ * $Id: if_ar.c,v 1.10 1996/09/06 23:07:24 phk Exp $
*/
/*
@@ -145,7 +145,6 @@ struct ar_softc {
int scano;
int scachan;
-
};
static int arprobe(struct isa_device *id);
@@ -398,13 +397,6 @@ arintr(int unit)
isr1 = sca->isr1;
isr2 = sca->isr2;
- /*
- * Acknoledge all the interrupts pending.
- */
- sca->isr0 = isr0;
- sca->isr1 = isr1;
- sca->isr2 = isr2;
-
TRC(printf("arc%d: ARINTR isr0 %x, isr1 %x, isr2 %x\n",
unit,
isr0,
@@ -1294,7 +1286,7 @@ ar_get_packets(struct ar_softc *sc)
u_char rxstat;
while(ar_packet_avail(sc, &len, &rxstat)) {
- if((rxstat & SCA_DESC_ERRORS) == 0) {
+ if(((rxstat & SCA_DESC_ERRORS) == 0) && (len < MCLBYTES)) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if(m == NULL) {
/* eat packet if get mbuf fail!! */
@@ -1334,7 +1326,18 @@ ar_get_packets(struct ar_softc *sc)
sc->hc->sca->dmac[DMAC_RXCH(sc->scachan)].eda =
(u_short)((u_int)rxdesc & 0xffff);
} else {
- msci_channel *msci = &sc->hc->sca->msci[sc->scachan];
+ int tries = 5;
+
+ while((rxstat == 0xff) && --tries)
+ ar_packet_avail(sc, &len, &rxstat);
+
+ /*
+ * It look like we get an interrupt early
+ * sometimes and then the status is not
+ * filled in yet.
+ */
+ if(tries && (tries != 5))
+ continue;
ar_eat_packet(sc, 1);
@@ -1348,7 +1351,7 @@ ar_get_packets(struct ar_softc *sc)
sc->unit,
sc->scachan,
rxstat,
- msci->st3,
+ sc->hc->sca->msci[sc->scachan].st3,
sc->rxhind,
sc->hc->sca->dmac[
DMAC_RXCH(sc->scachan)].cda,
OpenPOWER on IntegriCloud