From 88579b1e2870864a5ed9e3b0340a9fa311420b5a Mon Sep 17 00:00:00 2001 From: harti Date: Wed, 22 Jun 2005 06:44:24 +0000 Subject: Free the struct ifnet when detaching is complete. Also add BPF stuff. Approved by: re --- sys/dev/fatm/if_fatm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'sys/dev/fatm') diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c index bb9a34d..4842db4 100644 --- a/sys/dev/fatm/if_fatm.c +++ b/sys/dev/fatm/if_fatm.c @@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef ENABLE_BPF +#include +#endif #ifdef INET #include #include @@ -1550,6 +1553,13 @@ fatm_intr_drain_rx(struct fatm_softc *sc) if (vc == NULL) { m_freem(m0); } else { +#ifdef ENABLE_BPF + if (!(vc->param.flags & ATMIO_FLAG_NG) && + vc->param.aal == ATMIO_AAL_5 && + (vc->param.flags & ATM_PH_LLCSNAP)) + BPF_MTAP(sc->ifp, m0); +#endif + ATM_PH_FLAGS(&aph) = vc->param.flags; ATM_PH_VPI(&aph) = vpi; ATM_PH_SETVCI(&aph, vci); @@ -1964,6 +1974,13 @@ fatm_tx(struct fatm_softc *sc, struct mbuf *m, struct card_vcc *vc, u_int mlen) m->m_data += sizeof(struct atm_pseudohdr); m->m_len -= sizeof(struct atm_pseudohdr); +#ifdef ENABLE_BPF + if (!(vc->param.flags & ATMIO_FLAG_NG) && + vc->param.aal == ATMIO_AAL_5 && + (vc->param.flags & ATM_PH_LLCSNAP)) + BPF_MTAP(sc->ifp, m); +#endif + /* map the mbuf */ error = bus_dmamap_load_mbuf(sc->tx_tag, q->map, m, fatm_tpd_load, tpd, BUS_DMA_NOWAIT); @@ -2621,6 +2638,8 @@ fatm_detach(device_t dev) mtx_destroy(&sc->mtx); + if_free(sc->ifp); + return (0); } @@ -3036,6 +3055,10 @@ fatm_attach(device_t dev) atm_ifattach(ifp); ifp->if_snd.ifq_maxlen = 512; +#ifdef ENABLE_BPF + bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); +#endif + error = bus_setup_intr(dev, sc->irqres, INTR_TYPE_NET, fatm_intr, sc, &sc->ih); if (error) { -- cgit v1.1