summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/if_eg.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1995-04-12 07:50:44 +0000
committerphk <phk@FreeBSD.org>1995-04-12 07:50:44 +0000
commitbe7d63258b0184cd268692029ca64b7895500043 (patch)
treea04c0f5d1b525e1f556efef440fb5268ae30fba5 /sys/i386/isa/if_eg.c
parentb915c765f333f4d8a4e0e6d28bb266cedd01f867 (diff)
downloadFreeBSD-src-be7d63258b0184cd268692029ca64b7895500043.zip
FreeBSD-src-be7d63258b0184cd268692029ca64b7895500043.tar.gz
Improve the if_eg driver a bit in style. It's still by far the worst driver
we have :-/
Diffstat (limited to 'sys/i386/isa/if_eg.c')
-rw-r--r--sys/i386/isa/if_eg.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/sys/i386/isa/if_eg.c b/sys/i386/isa/if_eg.c
index a568941..bde3400 100644
--- a/sys/i386/isa/if_eg.c
+++ b/sys/i386/isa/if_eg.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id$
+ * $Id: if_eg.c,v 1.1 1995/04/08 09:39:34 phk Exp $
*/
/* To do:
@@ -146,7 +146,6 @@ static void egrecv(struct eg_softc *);
static void egstart(struct ifnet *);
static void egreset(int);
static inline void egread __P((struct eg_softc *, caddr_t, int));
-static struct mbuf *egget __P((caddr_t, int, struct ifnet *));
static void egstop __P((struct eg_softc *));
/*
@@ -419,7 +418,6 @@ egattach (struct isa_device *id)
/* Now we can attach the interface. */
if_attach(ifp);
- ether_ifattach(ifp);
/* device attach does transition from UNCONFIGURED to IDLE state */
sc->kdc.kdc_state = DC_IDLE;
@@ -656,9 +654,9 @@ egread(sc, buf, len)
/* Pull packet off interface. */
ifp = &sc->sc_arpcom.ac_if;
- m = egget(buf, len, ifp);
+ m = m_devget(buf,len,0,ifp,0);
if (m == 0) {
- dprintf(("eg#: egget returned 0\n"));
+ dprintf(("eg#: m_devget returned 0\n"));
sc->sc_arpcom.ac_if.if_ierrors++;
return;
}
@@ -697,54 +695,6 @@ egread(sc, buf, len)
ether_input(ifp, eh, m);
}
-/*
- * convert buf into mbufs
- */
-static struct mbuf *
-egget(buf, totlen, ifp)
- caddr_t buf;
- int totlen;
- struct ifnet *ifp;
-{
- struct mbuf *top, **mp, *m;
- int len;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- dprintf(("eg#: MGETHDR returns 0\n"));
- return 0;
- }
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- len = MHLEN;
- top = 0;
- mp = &top;
-
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- dprintf(("eg#: MGET returns 0\n"));
- return 0;
- }
- len = MLEN;
- }
- if (totlen >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- len = MCLBYTES;
- }
- m->m_len = len = min(totlen, len);
- bcopy((caddr_t)buf, mtod(m, caddr_t), len);
- buf += len;
- totlen -= len;
- *mp = m;
- mp = &m->m_next;
- }
-
- return top;
-}
static int
egioctl(ifp, command, data)
OpenPOWER on IntegriCloud