-/* $OpenBSD: am7990.c,v 1.49 2014/12/22 02:28:51 tedu Exp $ */
+/* $OpenBSD: am7990.c,v 1.50 2015/05/01 14:56:18 mpi Exp $ */
/* $NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $ */
/*-
am7990_rint(struct lance_softc *sc)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf *m;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
int bix;
int rp;
struct lermd rmd;
if (sc->sc_debug > 1)
am7990_recv_print(sc, sc->sc_last_rd);
#endif
- lance_read(sc, LE_RBUFADDR(sc, bix),
+ m = lance_read(sc, LE_RBUFADDR(sc, bix),
(int)rmd.rmd3 - 4);
+ if (m != NULL)
+ ml_enqueue(&ml, m);
}
rmd.rmd1_bits = LE_R1_OWN;
}
sc->sc_last_rd = bix;
+
+ if_input(ifp, &ml);
}
void
-/* $OpenBSD: am79900.c,v 1.3 2014/12/22 02:28:51 tedu Exp $ */
+/* $OpenBSD: am79900.c,v 1.4 2015/05/01 14:56:18 mpi Exp $ */
/* $NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $ */
/*-
am79900_rint(struct lance_softc *sc)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf *m;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
int bix;
int rp;
struct lermd rmd;
if (sc->sc_debug > 1)
am79900_recv_print(sc, sc->sc_last_rd);
#endif
- lance_read(sc, LE_RBUFADDR(sc, bix),
+ m = lance_read(sc, LE_RBUFADDR(sc, bix),
(rmd.rmd2 & 0xfff) - 4);
+ if (m != NULL)
+ ml_enqueue(&ml, m);
}
rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff);
}
sc->sc_last_rd = bix;
+
+ if_input(ifp, &ml);
}
void
-/* $OpenBSD: lance.c,v 1.5 2014/12/22 02:28:51 tedu Exp $ */
+/* $OpenBSD: lance.c,v 1.6 2015/05/01 14:56:18 mpi Exp $ */
/* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */
/*-
integrate struct mbuf *
lance_get(struct lance_softc *sc, int boff, int totlen)
{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m, *top, **mp;
int len, pad;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (NULL);
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
m->m_data += pad;
return (top);
}
-/*
- * Pass a packet to the higher levels.
- */
-void
+struct mbuf *
lance_read(struct lance_softc *sc, int boff, int len)
{
struct mbuf *m;
sc->sc_dev.dv_xnam, len);
#endif
ifp->if_ierrors++;
- return;
+ return (NULL);
}
/* Pull packet off interface. */
m = lance_get(sc, boff, len);
if (m == NULL) {
ifp->if_ierrors++;
- return;
+ return (NULL);
}
ifp->if_ipackets++;
if (ETHER_CMP(eh->ether_dhost, sc->sc_arpcom.ac_enaddr) &&
ETHER_CMP(eh->ether_dhost, bcast_enaddr)) {
m_freem(m);
- return;
+ return (NULL);
}
#endif
*/
if (!ETHER_CMP(eh->ether_shost, sc->sc_arpcom.ac_enaddr)) {
m_freem(m);
- return;
+ return (NULL);
}
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to BPF.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- /* Pass the packet up. */
- ether_input_mbuf(ifp, m);
+ return (m);
}
void
-/* $OpenBSD: lancevar.h,v 1.1 2013/09/24 20:10:58 miod Exp $ */
+/* $OpenBSD: lancevar.h,v 1.2 2015/05/01 14:56:18 mpi Exp $ */
/* $NetBSD: lancevar.h,v 1.15 2012/02/02 19:43:03 tls Exp $ */
/*-
void lance_reset(struct lance_softc *);
int lance_init(struct lance_softc *);
int lance_put(struct lance_softc *, int, struct mbuf *);
-void lance_read(struct lance_softc *, int, int);
+struct mbuf *lance_read(struct lance_softc *, int, int);
void lance_setladrf(struct arpcom *, uint16_t *);
/*