View | Details | Raw Unified | Return to bug 208632
Collapse All | Expand All

(-)sys/dev/urtwn/if_urtwn.c (+47 lines)
Lines 208-213 Link Here
208
                    const uint8_t [IEEE80211_ADDR_LEN],
208
                    const uint8_t [IEEE80211_ADDR_LEN],
209
                    const uint8_t [IEEE80211_ADDR_LEN]);
209
                    const uint8_t [IEEE80211_ADDR_LEN]);
210
static void		urtwn_vap_delete(struct ieee80211vap *);
210
static void		urtwn_vap_delete(struct ieee80211vap *);
211
static void		urtwn_vap_clear_tx(struct urtwn_softc *,
212
			    struct ieee80211vap *);
213
static void		urtwn_vap_clear_tx_queue(struct urtwn_softc *,
214
			    urtwn_datahead *, struct ieee80211vap *);
211
static struct mbuf *	urtwn_rx_copy_to_mbuf(struct urtwn_softc *,
215
static struct mbuf *	urtwn_rx_copy_to_mbuf(struct urtwn_softc *,
212
			    struct r92c_rx_stat *, int);
216
			    struct r92c_rx_stat *, int);
213
static struct mbuf *	urtwn_report_intr(struct usb_xfer *,
217
static struct mbuf *	urtwn_report_intr(struct usb_xfer *,
Lines 824-831 Link Here
824
	struct urtwn_softc *sc = ic->ic_softc;
828
	struct urtwn_softc *sc = ic->ic_softc;
825
	struct urtwn_vap *uvp = URTWN_VAP(vap);
829
	struct urtwn_vap *uvp = URTWN_VAP(vap);
826
830
831
	/* Guarantee that nothing will go through this vap. */
832
	ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
833
	ieee80211_draintask(ic, &vap->iv_nstate_task);
834
835
	URTWN_LOCK(sc);
827
	if (uvp->bcn_mbuf != NULL)
836
	if (uvp->bcn_mbuf != NULL)
828
		m_freem(uvp->bcn_mbuf);
837
		m_freem(uvp->bcn_mbuf);
838
	/* Cancel any unfinished Tx. */
839
	urtwn_vap_clear_tx(sc, vap);
840
	URTWN_UNLOCK(sc);
829
	if (vap->iv_opmode == IEEE80211_M_IBSS)
841
	if (vap->iv_opmode == IEEE80211_M_IBSS)
830
		ieee80211_draintask(ic, &uvp->tsf_task_adhoc);
842
		ieee80211_draintask(ic, &uvp->tsf_task_adhoc);
831
	if (URTWN_CHIP_HAS_RATECTL(sc))
843
	if (URTWN_CHIP_HAS_RATECTL(sc))
Lines 834-839 Link Here
834
	free(uvp, M_80211_VAP);
846
	free(uvp, M_80211_VAP);
835
}
847
}
836
848
849
static void
850
urtwn_vap_clear_tx(struct urtwn_softc *sc, struct ieee80211vap *vap)
851
{
852
853
	URTWN_ASSERT_LOCKED(sc);
854
855
	urtwn_vap_clear_tx_queue(sc, &sc->sc_tx_active, vap);
856
	urtwn_vap_clear_tx_queue(sc, &sc->sc_tx_pending, vap);
857
}
858
859
static void
860
urtwn_vap_clear_tx_queue(struct urtwn_softc *sc, urtwn_datahead *head,
861
    struct ieee80211vap *vap)
862
{
863
	struct urtwn_data *dp, *tmp;
864
865
	STAILQ_FOREACH_SAFE(dp, head, next, tmp) {
866
		if (dp->ni != NULL) {
867
			if (dp->ni->ni_vap == vap) {
868
				ieee80211_free_node(dp->ni);
869
				dp->ni = NULL;
870
871
				if (dp->m != NULL) {
872
					m_freem(dp->m);
873
					dp->m = NULL;
874
				}
875
876
				STAILQ_REMOVE(head, dp, urtwn_data, next);
877
				STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, dp,
878
				    next);
879
			}
880
		}
881
	}
882
}
883
837
static struct mbuf *
884
static struct mbuf *
838
urtwn_rx_copy_to_mbuf(struct urtwn_softc *sc, struct r92c_rx_stat *stat,
885
urtwn_rx_copy_to_mbuf(struct urtwn_softc *sc, struct r92c_rx_stat *stat,
839
    int totlen)
886
    int totlen)

Return to bug 208632