Exemplo n.º 1
0
/* 
 * Tear down vap state and reclaim the ifnet.
 * The driver is assumed to have prepared for
 * this; e.g. by turning off interrupts for the
 * underlying device.
 */
void
ieee80211_vap_detach(struct ieee80211vap *vap)
{
	struct ieee80211com *ic = vap->iv_ic;
	struct ifnet *ifp = vap->iv_ifp;

	IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s parent %s\n",
	    __func__, ieee80211_opmode_name[vap->iv_opmode],
	    ic->ic_ifp->if_xname);

	/* NB: bpfdetach is called by ether_ifdetach and claims all taps */
	ether_ifdetach(ifp);

	ieee80211_stop(vap);

	/*
	 * Flush any deferred vap tasks.
	 */
	ieee80211_draintask(ic, &vap->iv_nstate_task);
	ieee80211_draintask(ic, &vap->iv_swbmiss_task);

	/* XXX band-aid until ifnet handles this for us */
	taskqueue_drain(taskqueue_swi, &ifp->if_linktask);

	IEEE80211_LOCK(ic);
	KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
	TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
	ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
#ifdef IEEE80211_SUPPORT_SUPERG
	ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
#endif
	ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
	ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
	ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
	ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
	/* NB: this handles the bpfdetach done below */
	ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
	ieee80211_syncifflag_locked(ic, IFF_PROMISC);
	ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);
	IEEE80211_UNLOCK(ic);

	ifmedia_removeall(&vap->iv_media);

	ieee80211_radiotap_vdetach(vap);
	ieee80211_regdomain_vdetach(vap);
	ieee80211_scan_vdetach(vap);
#ifdef IEEE80211_SUPPORT_SUPERG
	ieee80211_superg_vdetach(vap);
#endif
	ieee80211_ht_vdetach(vap);
	/* NB: must be before ieee80211_node_vdetach */
	ieee80211_proto_vdetach(vap);
	ieee80211_crypto_vdetach(vap);
	ieee80211_power_vdetach(vap);
	ieee80211_node_vdetach(vap);
	ieee80211_sysctl_vdetach(vap);

	if_free(ifp);
}
Exemplo n.º 2
0
int
wlan_vap_delete(wlan_if_t vaphandle)
{
    struct ieee80211vap *vap = vaphandle;
    struct ieee80211com *ic = vap->iv_ic;

    IEEE80211_DPRINTF_IC(ic, IEEE80211_VERBOSE_LOUD,IEEE80211_MSG_DEBUG,
                         "%s : enter. vaphandle=0x%x\n", 
             __func__, 
             vaphandle
             );

    ieee80211_vap_pause_vdetach(ic,vap);

    IEEE80211_COMM_LOCK(ic);
#ifdef MAGPIE_HIF_GMAC
    if (ic->ic_chanchange_cnt)
        ic->ic_chanchange_cnt -= ic->ic_chanchange_tbtt;
#endif    
    if (ieee80211_vap_deleted_is_clear(vap)) /* if not deleted then it is on the list */
    {
        TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
        if (TAILQ_EMPTY(&ic->ic_vaps))      /* reset to supported mode */
            ic->ic_opmode = IEEE80211_M_STA;
        ieee80211_vap_deleted_set(vap); /* mark it as deleted */
        IEEE80211_COMM_UNLOCK(ic);

        /*
         * In case iv_bss was not stopped or is in scanning.
         * TBD: BSS should have been stopped now. We can save the time for stop bss again.
         */
        wlan_mlme_stop_bss(vap,
                           WLAN_MLME_STOP_BSS_F_SEND_DEAUTH        | 
                           WLAN_MLME_STOP_BSS_F_CLEAR_ASSOC_STATE  |
                           WLAN_MLME_STOP_BSS_F_WAIT_RX_DONE       |
                           WLAN_MLME_STOP_BSS_F_NO_RESET);

        ieee80211_sta_leave(vap->iv_bss);
        ieee80211_node_vdetach(vap);
    } else {
        IEEE80211_COMM_UNLOCK(ic);
    }

    IEEE80211_DPRINTF_IC(ic, IEEE80211_VERBOSE_LOUD,IEEE80211_MSG_DEBUG,
                         "%s : exit. vaphandle=0x%x\n", 
             __func__, 
             vaphandle
             );
    return 0;
}
Exemplo n.º 3
0
/* End: gengzj added end */
int
wlan_vap_delete(wlan_if_t vaphandle)
{
    struct ieee80211vap *vap = vaphandle;
    struct ieee80211com *ic = vap->iv_ic;

    IEEE80211_DPRINTF_IC(ic, IEEE80211_VERBOSE_LOUD,IEEE80211_MSG_DEBUG,
                         "%s : enter. vaphandle=0x%x\n",
                         __func__,
                         vaphandle
                        );

    ieee80211_vap_pause_vdetach(ic,vap);

    IEEE80211_COMM_LOCK(ic);
    /* Begin: gengzj added for wifipos 2013-11-26 */
    /*AUTELAN-Added-begin:Added by pengdecai for wifi scan locate function*/
#if 0
    if((NULL != vap->iv_scan_locate) && \
            (NULL != vap->iv_scan_locate->sl_sock))
    {
        //	printk("driver:fun %s  vap->iv_scan_locate->sl_sock= %p\n",__func__, vap->iv_scan_locate->sl_sock);
        vap->iv_locate = 0;
        if(NULL != vap->iv_scan_locate->sl_sock) {
            OS_SOCKET_RELEASE(vap->iv_scan_locate->sl_sock);
        }
        //free scan locate struct
        OS_FREE(vap->iv_scan_locate);
        vap->iv_scan_locate = NULL;
    }
#endif
    /*AUTELAN-Added-end:Added by pengdecai for wifi scan locate function*/
    /* End: gengzj added end */

#ifdef MAGPIE_HIF_GMAC
    if (ic->ic_chanchange_cnt)
        ic->ic_chanchange_cnt -= ic->ic_chanchange_tbtt;
#endif
    if (ieee80211_vap_deleted_is_clear(vap)) /* if not deleted then it is on the list */
    {
        TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
        if (TAILQ_EMPTY(&ic->ic_vaps))      /* reset to supported mode */
            ic->ic_opmode = IEEE80211_M_STA;
        ieee80211_vap_deleted_set(vap); /* mark it as deleted */
        IEEE80211_COMM_UNLOCK(ic);

        /*
         * In case iv_bss was not stopped or is in scanning.
         * TBD: BSS should have been stopped now. We can save the time for stop bss again.
         */
        wlan_mlme_stop_bss(vap,
                           WLAN_MLME_STOP_BSS_F_SEND_DEAUTH        |
                           WLAN_MLME_STOP_BSS_F_CLEAR_ASSOC_STATE  |
                           WLAN_MLME_STOP_BSS_F_WAIT_RX_DONE       |
                           WLAN_MLME_STOP_BSS_F_NO_RESET);

        /*zhaoyang1 transplant from 717*/
        /*suzhaoyu add for customer online-traffic limit*/
        OS_FREE_TIMER(&vap->online_traffic_timer);
        /*suzhaoyu addend*/
        /*zhaoyang1 transplant end*/
        ieee80211_sta_leave(vap->iv_bss);
        ieee80211_node_vdetach(vap);
    } else {
        IEEE80211_COMM_UNLOCK(ic);
    }

    IEEE80211_DPRINTF_IC(ic, IEEE80211_VERBOSE_LOUD,IEEE80211_MSG_DEBUG,
                         "%s : exit. vaphandle=0x%x\n",
                         __func__,
                         vaphandle
                        );
    return 0;
}