diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-02-21 11:08:49 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-02-21 11:08:49 +0000 |
commit | 166b2985f8179332668b8d953951b2104e0bc760 (patch) | |
tree | 5e0a668b2114e9711ae475e9086cbc5a16dcdbfa /sys/arch | |
parent | 642d2a88720ae533d337ec926445e35ce5816d1b (diff) |
Bring closer to the ISA version by dropping the use of a structure for
accessing fields in the shared mem, and fixing the packet length check.
Slight cleanup otherwise.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amiga/dev/if_ed.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/sys/arch/amiga/dev/if_ed.c b/sys/arch/amiga/dev/if_ed.c index 2e287ef3e2c..e918ba94219 100644 --- a/sys/arch/amiga/dev/if_ed.c +++ b/sys/arch/amiga/dev/if_ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ed.c,v 1.9 1997/01/16 09:24:40 niklas Exp $ */ +/* $OpenBSD: if_ed.c,v 1.10 1997/02/21 11:08:48 niklas Exp $ */ /* $NetBSD: if_ed.c,v 1.24 1996/12/23 09:10:16 veego Exp $ */ /* @@ -13,7 +13,7 @@ * the author responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with its use. * - * Currently supports the Hydra Systems ethernet card. + * Currently supports the Hydra Systems and ASDG ethernet cards. */ #include "bpfilter.h" @@ -108,7 +108,7 @@ void ed_stop __P((struct ed_softc *)); void ed_getmcaf __P((struct arpcom *, u_long *)); u_short ed_put __P((struct ed_softc *, struct mbuf *, caddr_t)); -#define inline /* XXX for debugging porpoises */ +#define inline /* XXX for debugging purposes */ void ed_get_packet __P((struct ed_softc *, caddr_t, u_short)); static inline void ed_rint __P((struct ed_softc *)); @@ -578,8 +578,9 @@ ed_rint(sc) { u_int8_t boundary, current; u_int16_t len; - u_int16_t count; u_int8_t nlen; + u_int8_t next_packet; /* pointer to next packet */ + u_int16_t count; /* bytes in packet (length + 4) */ u_int8_t packet_hdr[ED_RING_HDRSZ]; caddr_t packet_ptr; @@ -612,6 +613,7 @@ loop: * the NIC. */ bcopy(packet_ptr, packet_hdr, ED_RING_HDRSZ); + next_packet = packet_hdr[ED_RING_NEXT_PACKET]; len = count = packet_hdr[ED_RING_COUNT] + 256 * packet_hdr[ED_RING_COUNT + 1]; /* @@ -622,13 +624,11 @@ loop: * * NOTE: sc->next_packet is pointing at the current packet. */ - if (packet_hdr[ED_RING_NEXT_PACKET] >= sc->next_packet) - nlen = (packet_hdr[ED_RING_NEXT_PACKET] - - sc->next_packet); + if (next_packet >= sc->next_packet) + nlen = next_packet - sc->next_packet; else - nlen = ((packet_hdr[ED_RING_NEXT_PACKET] - - sc->rec_page_start) + (sc->rec_page_stop - - sc->next_packet)); + nlen = next_packet - sc->rec_page_start + + sc->rec_page_stop - sc->next_packet; --nlen; if ((len & ED_PAGE_MASK) + ED_RING_HDRSZ > ED_PAGE_SIZE) --nlen; @@ -653,13 +653,9 @@ loop: * important is that we have a length that will fit into one * mbuf cluster or less; the upper layer protocols can then * figure out the length from their own length field(s). - * - * MCLBYTES may be less than a valid packet len. Thus - * we use a constant that is large enough. */ - if (len <= 2048 && - packet_hdr[ED_RING_NEXT_PACKET] >= sc->rec_page_start && - packet_hdr[ED_RING_NEXT_PACKET] < sc->rec_page_stop) { + if (len <= MCLBYTES && next_packet >= sc->rec_page_start && + next_packet < sc->rec_page_stop) { /* Go get packet. */ ed_get_packet(sc, packet_ptr + ED_RING_HDRSZ, len - ED_RING_HDRSZ); @@ -675,7 +671,7 @@ loop: } /* Update next packet pointer. */ - sc->next_packet = packet_hdr[ED_RING_NEXT_PACKET]; + sc->next_packet = next_packet; /* * Update NIC boundary pointer - being careful to keep it one |