if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && ic->ic_opmode != IEEE80211_M_MONITOR) {
iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_buf *buf, int i,    struct iwi_frame *frame){	struct ieee80211com *ic = &sc->sc_ic;	struct ifnet *ifp = &ic->ic_if;	struct mbuf *m;	struct ieee80211_frame *wh;	struct ieee80211_node *ni;	int error;	DPRINTFN(5, ("RX!DATA!%u!%u!%u\n", letoh16(frame->len), frame->chan,	    frame->rssi_dbm));	bus_dmamap_sync(sc->sc_dmat, buf->map, sizeof (struct iwi_hdr),	    sizeof (struct iwi_frame) + letoh16(frame->len),	    BUS_DMASYNC_POSTREAD);	if (letoh16(frame->len) < sizeof (struct ieee80211_frame_min) ||	    letoh16(frame->len) > MCLBYTES) {		DPRINTF(("%s: bad frame length\n", sc->sc_dev.dv_xname));		ifp->if_ierrors++;		return;	}	bus_dmamap_unload(sc->sc_dmat, buf->map);	/* Finalize mbuf */	m = buf->m;	m->m_pkthdr.rcvif = ifp;	m->m_pkthdr.len = m->m_len = sizeof (struct iwi_hdr) +	    sizeof (struct iwi_frame) + letoh16(frame->len);	m_adj(m, sizeof (struct iwi_hdr) + sizeof (struct iwi_frame));	wh = mtod(m, struct ieee80211_frame *);	if (wh->i_fc[1] & IEEE80211_FC1_WEP) {		/*		 * Hardware decrypts the frame itself but leaves the WEP bit		 * set in the 802.11 header and don't remove the iv and crc		 * fields		 */		wh->i_fc[1] &= ~IEEE80211_FC1_WEP;		bcopy(wh, (char *)wh + IEEE80211_WEP_IVLEN +		    IEEE80211_WEP_KIDLEN, sizeof (struct ieee80211_frame));		m_adj(m, IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN);		m_adj(m, -IEEE80211_WEP_CRCLEN);		wh = mtod(m, struct ieee80211_frame *);	}#if NBPFILTER > 0	if (sc->sc_drvbpf != NULL) {		struct mbuf mb;		struct iwi_rx_radiotap_header *tap = &sc->sc_rxtap;		tap->wr_flags = 0;		tap->wr_rate = frame->rate;		tap->wr_chan_freq =		    htole16(ic->ic_channels[frame->chan].ic_freq);		tap->wr_chan_flags =		    htole16(ic->ic_channels[frame->chan].ic_flags);		tap->wr_antsignal = frame->signal;		tap->wr_antenna = frame->antenna;		M_DUP_PKTHDR(&mb, m);		mb.m_data = (caddr_t)tap;		mb.m_len = sc->sc_rxtap_len;		mb.m_next = m;		mb.m_pkthdr.len += mb.m_len;		bpf_mtap(sc->sc_drvbpf, &mb);	}#endif	ni = ieee80211_find_rxnode(ic, wh);	/* Send the frame to the upper layer */	ieee80211_input(ifp, m, ni, frame->rssi_dbm, 0);	ieee80211_release_node(ic, ni);	MGETHDR(buf->m, M_DONTWAIT, MT_DATA);	if (buf->m == NULL) {		printf("%s: could not allocate rx mbuf\n",		    sc->sc_dev.dv_xname);		return;	}	MCLGET(buf->m, M_DONTWAIT);	if (!(buf->m->m_flags & M_EXT)) {		printf("%s: could not allocate rx mbuf cluster\n",		    sc->sc_dev.dv_xname);		m_freem(buf->m);		buf->m = NULL;		return;	}	error = bus_dmamap_load(sc->sc_dmat, buf->map, mtod(buf->m, void *),	    MCLBYTES, NULL, BUS_DMA_NOWAIT);	if (error != 0) {		printf("%s: could not load rx buf DMA map\n",		    sc->sc_dev.dv_xname);		m_freem(buf->m);		buf->m = NULL;		return;	}	CSR_WRITE_4(sc, IWI_CSR_RX_BASE + i * 4, buf->map->dm_segs->ds_addr);}