/* * Pass a packet to the higher levels. */ void elread(struct el_softc *sc, int len) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mbuf *m; if (len <= sizeof(struct ether_header) || len > ETHER_MAX_LEN) { printf("%s: invalid packet size %d; dropping\n", device_xname(sc->sc_dev), len); ifp->if_ierrors++; return; } /* Pull packet off interface. */ m = elget(sc, len); if (m == 0) { ifp->if_ierrors++; return; } ifp->if_ipackets++; /* * Check if there's a BPF listener on this interface. * If so, hand off the raw packet to BPF. */ bpf_mtap(ifp, m); if_percpuq_enqueue(ifp->if_percpuq, m); }
/* Pass a packet up to the higher levels. */ static __inline void elread(struct el_softc *sc,caddr_t buf,int len) { struct mbuf *m; /* * Put packet into an mbuf chain */ m = elget(buf,len,&sc->arpcom.ac_if); if(m) sc->arpcom.ac_if.if_input(&sc->arpcom.ac_if, m); }
/* Pass a packet up to the higher levels. */ static inline void elread(struct el_softc *sc,caddr_t buf,int len) { register struct ether_header *eh; struct mbuf *m; eh = (struct ether_header *)buf; #if NBPFILTER > 0 /* * Check if there's a bpf filter listening on this interface. * If so, hand off the raw packet to bpf. */ if(sc->bpf) { bpf_tap(sc->bpf,buf,len+sizeof(struct ether_header)); /* * Note that the interface cannot be in promiscuous mode if * there are no bpf listeners. And if el are in promiscuous * mode, el have to check if this packet is really ours. * * This test does not support multicasts. */ if((sc->arpcom.ac_if.if_flags & IFF_PROMISC) && bcmp(eh->ether_dhost,sc->arpcom.ac_enaddr, sizeof(eh->ether_dhost)) != 0 && bcmp(eh->ether_dhost,etherbroadcastaddr, sizeof(eh->ether_dhost)) != 0) return; } #endif /* * Pull packet off interface. */ m = elget(buf,len,0,&sc->arpcom.ac_if); if(m == 0) return; ether_input(&sc->arpcom.ac_if,eh,m); }