예제 #1
0
VOID
kalP2PIndicateChannelExpired (
    IN P_GLUE_INFO_T prGlueInfo,
    IN UINT_64 u8SeqNum,
    IN UINT_32 u4ChannelNum,
    IN ENUM_BAND_T eBand,
    IN ENUM_CHNL_EXT_T eSco
    )
{

    P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL;
    struct ieee80211_channel *prIEEE80211ChnlStruct = (struct ieee80211_channel *)NULL;
    enum nl80211_channel_type eChnlType = NL80211_CHAN_NO_HT;
    RF_CHANNEL_INFO_T rRfChannelInfo;

    do {
        if (prGlueInfo == NULL) {
            ASSERT(FALSE);
            break;
        }

        prGlueP2pInfo = prGlueInfo->prP2PInfo;

        if (prGlueP2pInfo == NULL) {
            ASSERT(FALSE);
            break;
        }


        DBGLOG(P2P, TRACE, ("kalP2PIndicateChannelExpired\n"));

        rRfChannelInfo.eBand = eBand;
        rRfChannelInfo.ucChannelNum = u4ChannelNum;

        prIEEE80211ChnlStruct = kalP2pFuncGetChannelEntry(prGlueP2pInfo, &rRfChannelInfo);


        kalP2pFuncGetChannelType(eSco, &eChnlType);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)  
        cfg80211_remain_on_channel_expired(&prGlueP2pInfo->wdev, //struct wireless_dev,
                        u8SeqNum,
                        prIEEE80211ChnlStruct,
                        GFP_KERNEL);  
#else
        cfg80211_remain_on_channel_expired(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
                        u8SeqNum,
                        prIEEE80211ChnlStruct,
                        eChnlType,
                        GFP_KERNEL);
#endif
    } while (FALSE);

} /* kalP2PIndicateChannelExpired */
예제 #2
0
파일: p2p.c 프로젝트: ReneNyffenegger/linux
void wil_p2p_listen_expired(struct work_struct *work)
{
	struct wil_p2p_info *p2p = container_of(work,
			struct wil_p2p_info, discovery_expired_work);
	struct wil6210_priv *wil = container_of(p2p,
			struct wil6210_priv, p2p);
	u8 started;

	wil_dbg_misc(wil, "p2p_listen_expired\n");

	mutex_lock(&wil->mutex);
	started = wil_p2p_stop_discovery(wil);
	mutex_unlock(&wil->mutex);

	if (started) {
		mutex_lock(&wil->p2p_wdev_mutex);
		cfg80211_remain_on_channel_expired(wil->radio_wdev,
						   p2p->cookie,
						   &p2p->listen_chan,
						   GFP_KERNEL);
		wil->radio_wdev = wil->wdev;
		mutex_unlock(&wil->p2p_wdev_mutex);
	}

}
예제 #3
0
파일: p2p.c 프로젝트: ReneNyffenegger/linux
int wil_p2p_cancel_listen(struct wil6210_priv *wil, u64 cookie)
{
	struct wil_p2p_info *p2p = &wil->p2p;
	u8 started;

	mutex_lock(&wil->mutex);

	if (cookie != p2p->cookie) {
		wil_info(wil, "Cookie mismatch: 0x%016llx vs. 0x%016llx\n",
			 p2p->cookie, cookie);
		mutex_unlock(&wil->mutex);
		return -ENOENT;
	}

	started = wil_p2p_stop_discovery(wil);

	mutex_unlock(&wil->mutex);

	if (!started) {
		wil_err(wil, "listen not started\n");
		return -ENOENT;
	}

	mutex_lock(&wil->p2p_wdev_mutex);
	cfg80211_remain_on_channel_expired(wil->radio_wdev,
					   p2p->cookie,
					   &p2p->listen_chan,
					   GFP_KERNEL);
	wil->radio_wdev = wil->wdev;
	mutex_unlock(&wil->p2p_wdev_mutex);
	return 0;
}
예제 #4
0
eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
                                                eHalStatus status )
{
    hdd_adapter_t *pAdapter = (hdd_adapter_t*) pCtx;
    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;

    if( pRemainChanCtx == NULL )
    {
       hddLog( LOGW,
          "%s: No Rem on channel pending for which Rsp is received", __func__);
       return eHAL_STATUS_SUCCESS;
    }

    hddLog( LOG1, "Received remain on channel rsp");

    cfgState->remain_on_chan_ctx = NULL;

    if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
    {
        if( cfgState->buf )
        {
           hddLog( LOGP, 
                   "%s: We need to receive yet an ack from one of tx packet",
                   __func__);
        }
        cfg80211_remain_on_channel_expired( pRemainChanCtx->dev,
                              pRemainChanCtx->cookie,
                              &pRemainChanCtx->chan,
                              pRemainChanCtx->chan_type, GFP_KERNEL );
    }

    vos_mem_free( pRemainChanCtx );

    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
       )
    {
        tANI_U8 sessionId = pAdapter->sessionId;
        sme_DeregisterMgmtFrame(
                   hHal, sessionId,
                   (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
                    NULL, 0 );
    }
    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
            )
    {
        WLANSAP_DeRegisterMgmtFrame(
                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
                (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
                NULL, 0 );
    }

    complete(&pAdapter->cancel_rem_on_chan_var);
    return eHAL_STATUS_SUCCESS;
}
예제 #5
0
VOID
kalP2PIndicateChannelExpired (
    IN P_GLUE_INFO_T prGlueInfo,
    IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo
    )
{

    P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL;
    struct ieee80211_channel *prIEEE80211ChnlStruct = (struct ieee80211_channel *)NULL;
    enum nl80211_channel_type eChnlType = NL80211_CHAN_NO_HT;
    RF_CHANNEL_INFO_T rRfChannelInfo;

    do {
        if ((prGlueInfo == NULL) || (prChnlReqInfo == NULL)) {

            ASSERT(FALSE);
            break;
        }

        prGlueP2pInfo = prGlueInfo->prP2PInfo;

        if (prGlueP2pInfo == NULL) {
            ASSERT(FALSE);
            break;
        }


        DBGLOG(P2P, TRACE, ("kalP2PIndicateChannelExpired\n"));

        rRfChannelInfo.eBand = prChnlReqInfo->eBand;
        rRfChannelInfo.ucChannelNum = prChnlReqInfo->ucReqChnlNum;

        prIEEE80211ChnlStruct = kalP2pFuncGetChannelEntry(prGlueP2pInfo, &rRfChannelInfo);


        kalP2pFuncGetChannelType(prChnlReqInfo->eChnlSco,
                                    &eChnlType);


        cfg80211_remain_on_channel_expired(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
                        prChnlReqInfo->u8Cookie,
                        prIEEE80211ChnlStruct,
                        eChnlType,
                        GFP_KERNEL);

    } while (FALSE);

} /* kalP2PIndicateChannelExpired */
예제 #6
0
/*
 * This function handles events generated by firmware.
 *
 * This is a generic function and handles all events.
 *
 * Event specific routines are called by this function based
 * upon the generated event cause.
 *
 * For the following events, the function just forwards them to upper
 * layers, optionally recording the change -
 *      - EVENT_LINK_SENSED
 *      - EVENT_MIC_ERR_UNICAST
 *      - EVENT_MIC_ERR_MULTICAST
 *      - EVENT_PORT_RELEASE
 *      - EVENT_RSSI_LOW
 *      - EVENT_SNR_LOW
 *      - EVENT_MAX_FAIL
 *      - EVENT_RSSI_HIGH
 *      - EVENT_SNR_HIGH
 *      - EVENT_DATA_RSSI_LOW
 *      - EVENT_DATA_SNR_LOW
 *      - EVENT_DATA_RSSI_HIGH
 *      - EVENT_DATA_SNR_HIGH
 *      - EVENT_LINK_QUALITY
 *      - EVENT_PRE_BEACON_LOST
 *      - EVENT_IBSS_COALESCED
 *      - EVENT_IBSS_STA_CONNECT
 *      - EVENT_IBSS_STA_DISCONNECT
 *      - EVENT_WEP_ICV_ERR
 *      - EVENT_BW_CHANGE
 *      - EVENT_HOSTWAKE_STAIE
  *
 * For the following events, no action is taken -
 *      - EVENT_MIB_CHANGED
 *      - EVENT_INIT_DONE
 *      - EVENT_DUMMY_HOST_WAKEUP_SIGNAL
 *
 * Rest of the supported events requires driver handling -
 *      - EVENT_DEAUTHENTICATED
 *      - EVENT_DISASSOCIATED
 *      - EVENT_LINK_LOST
 *      - EVENT_PS_SLEEP
 *      - EVENT_PS_AWAKE
 *      - EVENT_DEEP_SLEEP_AWAKE
 *      - EVENT_HS_ACT_REQ
 *      - EVENT_ADHOC_BCN_LOST
 *      - EVENT_BG_SCAN_REPORT
 *      - EVENT_WMM_STATUS_CHANGE
 *      - EVENT_ADDBA
 *      - EVENT_DELBA
 *      - EVENT_BA_STREAM_TIEMOUT
 *      - EVENT_AMSDU_AGGR_CTRL
 *      - EVENT_FW_DUMP_INFO
 */
int mwifiex_process_sta_event(struct mwifiex_private *priv)
{
	struct mwifiex_adapter *adapter = priv->adapter;
	int ret = 0, i;
	u32 eventcause = adapter->event_cause;
	u16 ctrl, reason_code;
	u8 ibss_sta_addr[ETH_ALEN];
	struct mwifiex_sta_node *sta_ptr;

	switch (eventcause) {
	case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
		mwifiex_dbg(adapter, ERROR,
			    "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n");
		break;
	case EVENT_LINK_SENSED:
		mwifiex_dbg(adapter, EVENT, "event: LINK_SENSED\n");
		if (!netif_carrier_ok(priv->netdev))
			netif_carrier_on(priv->netdev);
		mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
		break;

	case EVENT_DEAUTHENTICATED:
		mwifiex_dbg(adapter, EVENT, "event: Deauthenticated\n");
		if (priv->wps.session_enable) {
			mwifiex_dbg(adapter, INFO,
				    "info: receive deauth event in wps session\n");
			break;
		}
		adapter->dbg.num_event_deauth++;
		if (priv->media_connected) {
			reason_code =
				get_unaligned_le16(adapter->event_body);
			mwifiex_reset_connect_state(priv, reason_code, true);
		}
		break;

	case EVENT_DISASSOCIATED:
		mwifiex_dbg(adapter, EVENT, "event: Disassociated\n");
		if (priv->wps.session_enable) {
			mwifiex_dbg(adapter, INFO,
				    "info: receive disassoc event in wps session\n");
			break;
		}
		adapter->dbg.num_event_disassoc++;
		if (priv->media_connected) {
			reason_code =
				get_unaligned_le16(adapter->event_body);
			mwifiex_reset_connect_state(priv, reason_code, true);
		}
		break;

	case EVENT_LINK_LOST:
		mwifiex_dbg(adapter, EVENT, "event: Link lost\n");
		adapter->dbg.num_event_link_lost++;
		if (priv->media_connected) {
			reason_code =
				get_unaligned_le16(adapter->event_body);
			mwifiex_reset_connect_state(priv, reason_code, true);
		}
		break;

	case EVENT_PS_SLEEP:
		mwifiex_dbg(adapter, EVENT, "info: EVENT: SLEEP\n");

		adapter->ps_state = PS_STATE_PRE_SLEEP;

		mwifiex_check_ps_cond(adapter);
		break;

	case EVENT_PS_AWAKE:
		mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n");
		if (!adapter->pps_uapsd_mode &&
		    (priv->port_open ||
		     (priv->bss_mode == NL80211_IFTYPE_ADHOC)) &&
		    priv->media_connected && adapter->sleep_period.period) {
			adapter->pps_uapsd_mode = true;
			mwifiex_dbg(adapter, EVENT,
				    "event: PPS/UAPSD mode activated\n");
		}
		adapter->tx_lock_flag = false;
		if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
			if (mwifiex_check_last_packet_indication(priv)) {
				if (adapter->data_sent ||
				    (adapter->if_ops.is_port_ready &&
				     !adapter->if_ops.is_port_ready(priv))) {
					adapter->ps_state = PS_STATE_AWAKE;
					adapter->pm_wakeup_card_req = false;
					adapter->pm_wakeup_fw_try = false;
					del_timer(&adapter->wakeup_timer);
					break;
				}
				if (!mwifiex_send_null_packet
					(priv,
					 MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
					 MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET))
						adapter->ps_state =
							PS_STATE_SLEEP;
					return 0;
			}
		}
		adapter->ps_state = PS_STATE_AWAKE;
		adapter->pm_wakeup_card_req = false;
		adapter->pm_wakeup_fw_try = false;
		del_timer(&adapter->wakeup_timer);

		break;

	case EVENT_DEEP_SLEEP_AWAKE:
		adapter->if_ops.wakeup_complete(adapter);
		mwifiex_dbg(adapter, EVENT, "event: DS_AWAKE\n");
		if (adapter->is_deep_sleep)
			adapter->is_deep_sleep = false;
		break;

	case EVENT_HS_ACT_REQ:
		mwifiex_dbg(adapter, EVENT, "event: HS_ACT_REQ\n");
		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH,
				       0, 0, NULL, false);
		break;

	case EVENT_MIC_ERR_UNICAST:
		mwifiex_dbg(adapter, EVENT, "event: UNICAST MIC ERROR\n");
		cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
					     NL80211_KEYTYPE_PAIRWISE,
					     -1, NULL, GFP_KERNEL);
		break;

	case EVENT_MIC_ERR_MULTICAST:
		mwifiex_dbg(adapter, EVENT, "event: MULTICAST MIC ERROR\n");
		cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
					     NL80211_KEYTYPE_GROUP,
					     -1, NULL, GFP_KERNEL);
		break;
	case EVENT_MIB_CHANGED:
	case EVENT_INIT_DONE:
		break;

	case EVENT_ADHOC_BCN_LOST:
		mwifiex_dbg(adapter, EVENT, "event: ADHOC_BCN_LOST\n");
		priv->adhoc_is_link_sensed = false;
		mwifiex_clean_txrx(priv);
		mwifiex_stop_net_dev_queue(priv->netdev, adapter);
		if (netif_carrier_ok(priv->netdev))
			netif_carrier_off(priv->netdev);
		break;

	case EVENT_BG_SCAN_REPORT:
		mwifiex_dbg(adapter, EVENT, "event: BGS_REPORT\n");
		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY,
				       HostCmd_ACT_GEN_GET, 0, NULL, false);
		break;

	case EVENT_BG_SCAN_STOPPED:
		dev_dbg(adapter->dev, "event: BGS_STOPPED\n");
		cfg80211_sched_scan_stopped(priv->wdev.wiphy, 0);
		if (priv->sched_scanning)
			priv->sched_scanning = false;
		break;

	case EVENT_PORT_RELEASE:
		mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
		priv->port_open = true;
		break;

	case EVENT_EXT_SCAN_REPORT:
		mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n");
		/* We intend to skip this event during suspend, but handle
		 * it in interface disabled case
		 */
		if (adapter->ext_scan && (!priv->scan_aborting ||
					  !netif_running(priv->netdev)))
			ret = mwifiex_handle_event_ext_scan_report(priv,
						adapter->event_skb->data);

		break;

	case EVENT_WMM_STATUS_CHANGE:
		mwifiex_dbg(adapter, EVENT, "event: WMM status changed\n");
		ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS,
				       0, 0, NULL, false);
		break;

	case EVENT_RSSI_LOW:
		cfg80211_cqm_rssi_notify(priv->netdev,
					 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
					 0, GFP_KERNEL);
		mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
				 HostCmd_ACT_GEN_GET, 0, NULL, false);
		priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
		mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_LOW\n");
		break;
	case EVENT_SNR_LOW:
		mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_LOW\n");
		break;
	case EVENT_MAX_FAIL:
		mwifiex_dbg(adapter, EVENT, "event: MAX_FAIL\n");
		break;
	case EVENT_RSSI_HIGH:
		cfg80211_cqm_rssi_notify(priv->netdev,
					 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
					 0, GFP_KERNEL);
		mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
				 HostCmd_ACT_GEN_GET, 0, NULL, false);
		priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
		mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_HIGH\n");
		break;
	case EVENT_SNR_HIGH:
		mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_HIGH\n");
		break;
	case EVENT_DATA_RSSI_LOW:
		mwifiex_dbg(adapter, EVENT, "event: Data RSSI_LOW\n");
		break;
	case EVENT_DATA_SNR_LOW:
		mwifiex_dbg(adapter, EVENT, "event: Data SNR_LOW\n");
		break;
	case EVENT_DATA_RSSI_HIGH:
		mwifiex_dbg(adapter, EVENT, "event: Data RSSI_HIGH\n");
		break;
	case EVENT_DATA_SNR_HIGH:
		mwifiex_dbg(adapter, EVENT, "event: Data SNR_HIGH\n");
		break;
	case EVENT_LINK_QUALITY:
		mwifiex_dbg(adapter, EVENT, "event: Link Quality\n");
		break;
	case EVENT_PRE_BEACON_LOST:
		mwifiex_dbg(adapter, EVENT, "event: Pre-Beacon Lost\n");
		break;
	case EVENT_IBSS_COALESCED:
		mwifiex_dbg(adapter, EVENT, "event: IBSS_COALESCED\n");
		ret = mwifiex_send_cmd(priv,
				HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
				HostCmd_ACT_GEN_GET, 0, NULL, false);
		break;
	case EVENT_IBSS_STA_CONNECT:
		ether_addr_copy(ibss_sta_addr, adapter->event_body + 2);
		mwifiex_dbg(adapter, EVENT, "event: IBSS_STA_CONNECT %pM\n",
			    ibss_sta_addr);
		sta_ptr = mwifiex_add_sta_entry(priv, ibss_sta_addr);
		if (sta_ptr && adapter->adhoc_11n_enabled) {
			mwifiex_check_ibss_peer_capabilties(priv, sta_ptr,
							    adapter->event_skb);
			if (sta_ptr->is_11n_enabled)
				for (i = 0; i < MAX_NUM_TID; i++)
					sta_ptr->ampdu_sta[i] =
					priv->aggr_prio_tbl[i].ampdu_user;
			else
				for (i = 0; i < MAX_NUM_TID; i++)
					sta_ptr->ampdu_sta[i] =
						BA_STREAM_NOT_ALLOWED;
			memset(sta_ptr->rx_seq, 0xff, sizeof(sta_ptr->rx_seq));
		}

		break;
	case EVENT_IBSS_STA_DISCONNECT:
		ether_addr_copy(ibss_sta_addr, adapter->event_body + 2);
		mwifiex_dbg(adapter, EVENT, "event: IBSS_STA_DISCONNECT %pM\n",
			    ibss_sta_addr);
		sta_ptr = mwifiex_get_sta_entry(priv, ibss_sta_addr);
		if (sta_ptr && sta_ptr->is_11n_enabled) {
			mwifiex_11n_del_rx_reorder_tbl_by_ta(priv,
							     ibss_sta_addr);
			mwifiex_del_tx_ba_stream_tbl_by_ra(priv, ibss_sta_addr);
		}
		mwifiex_wmm_del_peer_ra_list(priv, ibss_sta_addr);
		mwifiex_del_sta_entry(priv, ibss_sta_addr);
		break;
	case EVENT_ADDBA:
		mwifiex_dbg(adapter, EVENT, "event: ADDBA Request\n");
		mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP,
				 HostCmd_ACT_GEN_SET, 0,
				 adapter->event_body, false);
		break;
	case EVENT_DELBA:
		mwifiex_dbg(adapter, EVENT, "event: DELBA Request\n");
		mwifiex_11n_delete_ba_stream(priv, adapter->event_body);
		break;
	case EVENT_BA_STREAM_TIEMOUT:
		mwifiex_dbg(adapter, EVENT, "event:  BA Stream timeout\n");
		mwifiex_11n_ba_stream_timeout(priv,
					      (struct host_cmd_ds_11n_batimeout
					       *)
					      adapter->event_body);
		break;
	case EVENT_AMSDU_AGGR_CTRL:
		ctrl = get_unaligned_le16(adapter->event_body);
		mwifiex_dbg(adapter, EVENT,
			    "event: AMSDU_AGGR_CTRL %d\n", ctrl);

		adapter->tx_buf_size =
				min_t(u16, adapter->curr_tx_buf_size, ctrl);
		mwifiex_dbg(adapter, EVENT, "event: tx_buf_size %d\n",
			    adapter->tx_buf_size);
		break;

	case EVENT_WEP_ICV_ERR:
		mwifiex_dbg(adapter, EVENT, "event: WEP ICV error\n");
		break;

	case EVENT_BW_CHANGE:
		mwifiex_dbg(adapter, EVENT, "event: BW Change\n");
		break;

	case EVENT_HOSTWAKE_STAIE:
		mwifiex_dbg(adapter, EVENT,
			    "event: HOSTWAKE_STAIE %d\n", eventcause);
		break;

	case EVENT_REMAIN_ON_CHAN_EXPIRED:
		mwifiex_dbg(adapter, EVENT,
			    "event: Remain on channel expired\n");
		cfg80211_remain_on_channel_expired(&priv->wdev,
						   priv->roc_cfg.cookie,
						   &priv->roc_cfg.chan,
						   GFP_ATOMIC);

		memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));

		break;

	case EVENT_CHANNEL_SWITCH_ANN:
		mwifiex_dbg(adapter, EVENT, "event: Channel Switch Announcement\n");
		priv->csa_expire_time =
				jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME);
		priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel;
		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
			HostCmd_ACT_GEN_SET, 0,
			priv->curr_bss_params.bss_descriptor.mac_address,
			false);
		break;

	case EVENT_TDLS_GENERIC_EVENT:
		ret = mwifiex_parse_tdls_event(priv, adapter->event_skb);
		break;

	case EVENT_TX_DATA_PAUSE:
		mwifiex_dbg(adapter, EVENT, "event: TX DATA PAUSE\n");
		mwifiex_process_tx_pause_event(priv, adapter->event_skb);
		break;

	case EVENT_MULTI_CHAN_INFO:
		mwifiex_dbg(adapter, EVENT, "event: multi-chan info\n");
		mwifiex_process_multi_chan_event(priv, adapter->event_skb);
		break;

	case EVENT_TX_STATUS_REPORT:
		mwifiex_dbg(adapter, EVENT, "event: TX_STATUS Report\n");
		mwifiex_parse_tx_status_event(priv, adapter->event_body);
		break;

	case EVENT_CHANNEL_REPORT_RDY:
		mwifiex_dbg(adapter, EVENT, "event: Channel Report\n");
		ret = mwifiex_11h_handle_chanrpt_ready(priv,
						       adapter->event_skb);
		break;
	case EVENT_RADAR_DETECTED:
		mwifiex_dbg(adapter, EVENT, "event: Radar detected\n");
		ret = mwifiex_11h_handle_radar_detected(priv,
							adapter->event_skb);
		break;
	case EVENT_BT_COEX_WLAN_PARA_CHANGE:
		dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n");
		mwifiex_bt_coex_wlan_param_update_event(priv,
							adapter->event_skb);
		break;
	case EVENT_RXBA_SYNC:
		dev_dbg(adapter->dev, "EVENT: RXBA_SYNC\n");
		mwifiex_11n_rxba_sync_event(priv, adapter->event_body,
					    adapter->event_skb->len -
					    sizeof(eventcause));
		break;
	case EVENT_FW_DUMP_INFO:
		mwifiex_dbg(adapter, EVENT, "event: firmware debug info\n");
		mwifiex_fw_dump_info_event(priv, adapter->event_skb);
		break;
	/* Debugging event; not used, but let's not print an ERROR for it. */
	case EVENT_UNKNOWN_DEBUG:
		mwifiex_dbg(adapter, EVENT, "event: debug\n");
		break;
	default:
		mwifiex_dbg(adapter, ERROR, "event: unknown event id: %#x\n",
			    eventcause);
		break;
	}

	return ret;
}
예제 #7
0
파일: p2p.c 프로젝트: ReneNyffenegger/linux
void wil_p2p_search_expired(struct work_struct *work)
{
	struct wil_p2p_info *p2p = container_of(work,
			struct wil_p2p_info, discovery_expired_work);
	struct wil6210_priv *wil = container_of(p2p,
			struct wil6210_priv, p2p);
	u8 started;

	wil_dbg_misc(wil, "p2p_search_expired\n");

	mutex_lock(&wil->mutex);
	started = wil_p2p_stop_discovery(wil);
	mutex_unlock(&wil->mutex);

	if (started) {
		struct cfg80211_scan_info info = {
			.aborted = false,
		};

		mutex_lock(&wil->p2p_wdev_mutex);
		if (wil->scan_request) {
			cfg80211_scan_done(wil->scan_request, &info);
			wil->scan_request = NULL;
			wil->radio_wdev = wil->wdev;
		}
		mutex_unlock(&wil->p2p_wdev_mutex);
	}
}

void wil_p2p_delayed_listen_work(struct work_struct *work)
{
	struct wil_p2p_info *p2p = container_of(work,
			struct wil_p2p_info, delayed_listen_work);
	struct wil6210_priv *wil = container_of(p2p,
			struct wil6210_priv, p2p);
	int rc;

	mutex_lock(&wil->mutex);

	wil_dbg_misc(wil, "Checking delayed p2p listen\n");
	if (!p2p->discovery_started || !p2p->pending_listen_wdev)
		goto out;

	mutex_lock(&wil->p2p_wdev_mutex);
	if (wil->scan_request) {
		/* another scan started, wait again... */
		mutex_unlock(&wil->p2p_wdev_mutex);
		goto out;
	}
	mutex_unlock(&wil->p2p_wdev_mutex);

	rc = wil_p2p_start_listen(wil);

	mutex_lock(&wil->p2p_wdev_mutex);
	if (rc) {
		cfg80211_remain_on_channel_expired(p2p->pending_listen_wdev,
						   p2p->cookie,
						   &p2p->listen_chan,
						   GFP_KERNEL);
		wil->radio_wdev = wil->wdev;
	} else {
		cfg80211_ready_on_channel(p2p->pending_listen_wdev, p2p->cookie,
					  &p2p->listen_chan,
					  p2p->listen_duration, GFP_KERNEL);
		wil->radio_wdev = p2p->pending_listen_wdev;
	}
	p2p->pending_listen_wdev = NULL;
	mutex_unlock(&wil->p2p_wdev_mutex);

out:
	mutex_unlock(&wil->mutex);
}

void wil_p2p_stop_radio_operations(struct wil6210_priv *wil)
{
	struct wil_p2p_info *p2p = &wil->p2p;
	struct cfg80211_scan_info info = {
		.aborted = true,
	};

	lockdep_assert_held(&wil->mutex);
	lockdep_assert_held(&wil->p2p_wdev_mutex);

	if (wil->radio_wdev != wil->p2p_wdev)
		goto out;

	if (!p2p->discovery_started) {
		/* Regular scan on the p2p device */
		if (wil->scan_request &&
		    wil->scan_request->wdev == wil->p2p_wdev)
			wil_abort_scan(wil, true);
		goto out;
	}

	/* Search or listen on p2p device */
	mutex_unlock(&wil->p2p_wdev_mutex);
	wil_p2p_stop_discovery(wil);
	mutex_lock(&wil->p2p_wdev_mutex);

	if (wil->scan_request) {
		/* search */
		cfg80211_scan_done(wil->scan_request, &info);
		wil->scan_request = NULL;
	} else {
		/* listen */
		cfg80211_remain_on_channel_expired(wil->radio_wdev,
						   p2p->cookie,
						   &p2p->listen_chan,
						   GFP_KERNEL);
	}

out:
	wil->radio_wdev = wil->wdev;
}
예제 #8
0
/*
 * This function handles events generated by firmware.
 *
 * This is a generic function and handles all events.
 *
 * Event specific routines are called by this function based
 * upon the generated event cause.
 *
 * For the following events, the function just forwards them to upper
 * layers, optionally recording the change -
 *      - EVENT_LINK_SENSED
 *      - EVENT_MIC_ERR_UNICAST
 *      - EVENT_MIC_ERR_MULTICAST
 *      - EVENT_PORT_RELEASE
 *      - EVENT_RSSI_LOW
 *      - EVENT_SNR_LOW
 *      - EVENT_MAX_FAIL
 *      - EVENT_RSSI_HIGH
 *      - EVENT_SNR_HIGH
 *      - EVENT_DATA_RSSI_LOW
 *      - EVENT_DATA_SNR_LOW
 *      - EVENT_DATA_RSSI_HIGH
 *      - EVENT_DATA_SNR_HIGH
 *      - EVENT_LINK_QUALITY
 *      - EVENT_PRE_BEACON_LOST
 *      - EVENT_IBSS_COALESCED
 *      - EVENT_WEP_ICV_ERR
 *      - EVENT_BW_CHANGE
 *      - EVENT_HOSTWAKE_STAIE
  *
 * For the following events, no action is taken -
 *      - EVENT_MIB_CHANGED
 *      - EVENT_INIT_DONE
 *      - EVENT_DUMMY_HOST_WAKEUP_SIGNAL
 *
 * Rest of the supported events requires driver handling -
 *      - EVENT_DEAUTHENTICATED
 *      - EVENT_DISASSOCIATED
 *      - EVENT_LINK_LOST
 *      - EVENT_PS_SLEEP
 *      - EVENT_PS_AWAKE
 *      - EVENT_DEEP_SLEEP_AWAKE
 *      - EVENT_HS_ACT_REQ
 *      - EVENT_ADHOC_BCN_LOST
 *      - EVENT_BG_SCAN_REPORT
 *      - EVENT_WMM_STATUS_CHANGE
 *      - EVENT_ADDBA
 *      - EVENT_DELBA
 *      - EVENT_BA_STREAM_TIEMOUT
 *      - EVENT_AMSDU_AGGR_CTRL
 */
int mwifiex_process_sta_event(struct mwifiex_private *priv)
{
    struct mwifiex_adapter *adapter = priv->adapter;
    int ret = 0;
    u32 eventcause = adapter->event_cause;
    u16 ctrl, reason_code;

    switch (eventcause) {
    case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
        dev_err(adapter->dev,
                "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n");
        break;
    case EVENT_LINK_SENSED:
        dev_dbg(adapter->dev, "event: LINK_SENSED\n");
        if (!netif_carrier_ok(priv->netdev))
            netif_carrier_on(priv->netdev);
        mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
        break;

    case EVENT_DEAUTHENTICATED:
        dev_dbg(adapter->dev, "event: Deauthenticated\n");
        if (priv->wps.session_enable) {
            dev_dbg(adapter->dev,
                    "info: receive deauth event in wps session\n");
            break;
        }
        adapter->dbg.num_event_deauth++;
        if (priv->media_connected) {
            reason_code =
                le16_to_cpu(*(__le16 *)adapter->event_body);
            mwifiex_reset_connect_state(priv, reason_code);
        }
        break;

    case EVENT_DISASSOCIATED:
        dev_dbg(adapter->dev, "event: Disassociated\n");
        if (priv->wps.session_enable) {
            dev_dbg(adapter->dev,
                    "info: receive disassoc event in wps session\n");
            break;
        }
        adapter->dbg.num_event_disassoc++;
        if (priv->media_connected) {
            reason_code =
                le16_to_cpu(*(__le16 *)adapter->event_body);
            mwifiex_reset_connect_state(priv, reason_code);
        }
        break;

    case EVENT_LINK_LOST:
        dev_dbg(adapter->dev, "event: Link lost\n");
        adapter->dbg.num_event_link_lost++;
        if (priv->media_connected) {
            reason_code =
                le16_to_cpu(*(__le16 *)adapter->event_body);
            mwifiex_reset_connect_state(priv, reason_code);
        }
        break;

    case EVENT_PS_SLEEP:
        dev_dbg(adapter->dev, "info: EVENT: SLEEP\n");

        adapter->ps_state = PS_STATE_PRE_SLEEP;

        mwifiex_check_ps_cond(adapter);
        break;

    case EVENT_PS_AWAKE:
        dev_dbg(adapter->dev, "info: EVENT: AWAKE\n");
        if (!adapter->pps_uapsd_mode &&
                priv->media_connected && adapter->sleep_period.period) {
            adapter->pps_uapsd_mode = true;
            dev_dbg(adapter->dev,
                    "event: PPS/UAPSD mode activated\n");
        }
        adapter->tx_lock_flag = false;
        if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
            if (mwifiex_check_last_packet_indication(priv)) {
                if (adapter->data_sent) {
                    adapter->ps_state = PS_STATE_AWAKE;
                    adapter->pm_wakeup_card_req = false;
                    adapter->pm_wakeup_fw_try = false;
                    break;
                }
                if (!mwifiex_send_null_packet
                        (priv,
                         MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
                         MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET))
                    adapter->ps_state =
                        PS_STATE_SLEEP;
                return 0;
            }
        }
        adapter->ps_state = PS_STATE_AWAKE;
        adapter->pm_wakeup_card_req = false;
        adapter->pm_wakeup_fw_try = false;

        break;

    case EVENT_DEEP_SLEEP_AWAKE:
        adapter->if_ops.wakeup_complete(adapter);
        dev_dbg(adapter->dev, "event: DS_AWAKE\n");
        if (adapter->is_deep_sleep)
            adapter->is_deep_sleep = false;
        break;

    case EVENT_HS_ACT_REQ:
        dev_dbg(adapter->dev, "event: HS_ACT_REQ\n");
        ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH,
                               0, 0, NULL, false);
        break;

    case EVENT_MIC_ERR_UNICAST:
        dev_dbg(adapter->dev, "event: UNICAST MIC ERROR\n");
        cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
                                     NL80211_KEYTYPE_PAIRWISE,
                                     -1, NULL, GFP_KERNEL);
        break;

    case EVENT_MIC_ERR_MULTICAST:
        dev_dbg(adapter->dev, "event: MULTICAST MIC ERROR\n");
        cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
                                     NL80211_KEYTYPE_GROUP,
                                     -1, NULL, GFP_KERNEL);
        break;
    case EVENT_MIB_CHANGED:
    case EVENT_INIT_DONE:
        break;

    case EVENT_ADHOC_BCN_LOST:
        dev_dbg(adapter->dev, "event: ADHOC_BCN_LOST\n");
        priv->adhoc_is_link_sensed = false;
        mwifiex_clean_txrx(priv);
        mwifiex_stop_net_dev_queue(priv->netdev, adapter);
        if (netif_carrier_ok(priv->netdev))
            netif_carrier_off(priv->netdev);
        break;

    case EVENT_BG_SCAN_REPORT:
        dev_dbg(adapter->dev, "event: BGS_REPORT\n");
        ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY,
                               HostCmd_ACT_GEN_GET, 0, NULL, false);
        break;

    case EVENT_PORT_RELEASE:
        dev_dbg(adapter->dev, "event: PORT RELEASE\n");
        break;

    case EVENT_EXT_SCAN_REPORT:
        dev_dbg(adapter->dev, "event: EXT_SCAN Report\n");
        if (adapter->ext_scan)
            ret = mwifiex_handle_event_ext_scan_report(priv,
                    adapter->event_skb->data);

        break;

    case EVENT_WMM_STATUS_CHANGE:
        dev_dbg(adapter->dev, "event: WMM status changed\n");
        ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS,
                               0, 0, NULL, false);
        break;

    case EVENT_RSSI_LOW:
        cfg80211_cqm_rssi_notify(priv->netdev,
                                 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
                                 GFP_KERNEL);
        mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
                         HostCmd_ACT_GEN_GET, 0, NULL, false);
        priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
        dev_dbg(adapter->dev, "event: Beacon RSSI_LOW\n");
        break;
    case EVENT_SNR_LOW:
        dev_dbg(adapter->dev, "event: Beacon SNR_LOW\n");
        break;
    case EVENT_MAX_FAIL:
        dev_dbg(adapter->dev, "event: MAX_FAIL\n");
        break;
    case EVENT_RSSI_HIGH:
        cfg80211_cqm_rssi_notify(priv->netdev,
                                 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
                                 GFP_KERNEL);
        mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
                         HostCmd_ACT_GEN_GET, 0, NULL, false);
        priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
        dev_dbg(adapter->dev, "event: Beacon RSSI_HIGH\n");
        break;
    case EVENT_SNR_HIGH:
        dev_dbg(adapter->dev, "event: Beacon SNR_HIGH\n");
        break;
    case EVENT_DATA_RSSI_LOW:
        dev_dbg(adapter->dev, "event: Data RSSI_LOW\n");
        break;
    case EVENT_DATA_SNR_LOW:
        dev_dbg(adapter->dev, "event: Data SNR_LOW\n");
        break;
    case EVENT_DATA_RSSI_HIGH:
        dev_dbg(adapter->dev, "event: Data RSSI_HIGH\n");
        break;
    case EVENT_DATA_SNR_HIGH:
        dev_dbg(adapter->dev, "event: Data SNR_HIGH\n");
        break;
    case EVENT_LINK_QUALITY:
        dev_dbg(adapter->dev, "event: Link Quality\n");
        break;
    case EVENT_PRE_BEACON_LOST:
        dev_dbg(adapter->dev, "event: Pre-Beacon Lost\n");
        break;
    case EVENT_IBSS_COALESCED:
        dev_dbg(adapter->dev, "event: IBSS_COALESCED\n");
        ret = mwifiex_send_cmd(priv,
                               HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
                               HostCmd_ACT_GEN_GET, 0, NULL, false);
        break;
    case EVENT_ADDBA:
        dev_dbg(adapter->dev, "event: ADDBA Request\n");
        mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP,
                         HostCmd_ACT_GEN_SET, 0,
                         adapter->event_body, false);
        break;
    case EVENT_DELBA:
        dev_dbg(adapter->dev, "event: DELBA Request\n");
        mwifiex_11n_delete_ba_stream(priv, adapter->event_body);
        break;
    case EVENT_BA_STREAM_TIEMOUT:
        dev_dbg(adapter->dev, "event:  BA Stream timeout\n");
        mwifiex_11n_ba_stream_timeout(priv,
                                      (struct host_cmd_ds_11n_batimeout
                                       *)
                                      adapter->event_body);
        break;
    case EVENT_AMSDU_AGGR_CTRL:
        ctrl = le16_to_cpu(*(__le16 *)adapter->event_body);
        dev_dbg(adapter->dev, "event: AMSDU_AGGR_CTRL %d\n", ctrl);

        adapter->tx_buf_size =
            min_t(u16, adapter->curr_tx_buf_size, ctrl);
        dev_dbg(adapter->dev, "event: tx_buf_size %d\n",
                adapter->tx_buf_size);
        break;

    case EVENT_WEP_ICV_ERR:
        dev_dbg(adapter->dev, "event: WEP ICV error\n");
        break;

    case EVENT_BW_CHANGE:
        dev_dbg(adapter->dev, "event: BW Change\n");
        break;

    case EVENT_HOSTWAKE_STAIE:
        dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause);
        break;

    case EVENT_REMAIN_ON_CHAN_EXPIRED:
        dev_dbg(adapter->dev, "event: Remain on channel expired\n");
        cfg80211_remain_on_channel_expired(priv->wdev,
                                           priv->roc_cfg.cookie,
                                           &priv->roc_cfg.chan,
                                           GFP_ATOMIC);

        memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));

        break;

    case EVENT_CHANNEL_SWITCH_ANN:
        dev_dbg(adapter->dev, "event: Channel Switch Announcement\n");
        priv->csa_expire_time =
            jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME);
        priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel;
        ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
                               HostCmd_ACT_GEN_SET, 0,
                               priv->curr_bss_params.bss_descriptor.mac_address,
                               false);
        break;

    case EVENT_TDLS_GENERIC_EVENT:
        ret = mwifiex_parse_tdls_event(priv, adapter->event_skb);
        break;

    default:
        dev_dbg(adapter->dev, "event: unknown event id: %#x\n",
                eventcause);
        break;
    }

    return ret;
}
예제 #9
0
/**
 *  @brief This function removes an virtual interface.
 *
 *  @param wiphy    A pointer to the wiphy structure
 *  @param dev      A pointer to the net_device structure
 *
 *  @return         0 -- success, otherwise fail
 */
int
woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev)
{
	int ret = 0;
	int i = 0;
	moal_private *priv = NULL;
	moal_private *vir_priv = NULL;
	moal_private *remain_priv = NULL;
	moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy);
	unsigned long flags;

	priv = (moal_private *)woal_get_priv_bss_type(handle,
						      MLAN_BSS_TYPE_WIFIDIRECT);
	if (!priv)
		return ret;
	for (i = 0; i < priv->phandle->priv_num; i++) {
		vir_priv = priv->phandle->priv[i];
		if (vir_priv) {
			if (vir_priv->netdev == dev) {
				PRINTM(MMSG,
				       "Del virtual interface %s, index=%d\n",
				       dev->name, i);
				break;
			}
		}
	}
	if (vir_priv && vir_priv->netdev == dev) {
		woal_stop_queue(dev);
		netif_carrier_off(dev);
		netif_device_detach(dev);
		if (handle->is_remain_timer_set) {
			woal_cancel_timer(&handle->remain_timer);
			woal_remain_timer_func(handle);
		}
		spin_lock_irqsave(&vir_priv->tx_stat_lock, flags);
		if (vir_priv->last_tx_buf && vir_priv->last_tx_cookie) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) || defined(COMPAT_WIRELESS)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)
			cfg80211_mgmt_tx_status(vir_priv->netdev,
						vir_priv->last_tx_cookie,
						vir_priv->last_tx_buf,
						vir_priv->last_tx_buf_len, true,
						GFP_ATOMIC);
#else
			cfg80211_mgmt_tx_status(vir_priv->wdev,
						vir_priv->last_tx_cookie,
						vir_priv->last_tx_buf,
						vir_priv->last_tx_buf_len, true,
						GFP_ATOMIC);
#endif
#endif
			kfree(vir_priv->last_tx_buf);
			vir_priv->last_tx_buf = NULL;
			vir_priv->last_tx_cookie = 0;
		}
		spin_unlock_irqrestore(&vir_priv->tx_stat_lock, flags);

		/* cancel previous remain on channel to avoid firmware hang */
		if (priv->phandle->remain_on_channel) {
			t_u8 channel_status;
			remain_priv =
				priv->phandle->priv[priv->phandle->
						    remain_bss_index];
			if (remain_priv) {
				if (woal_cfg80211_remain_on_channel_cfg
				    (remain_priv, MOAL_IOCTL_WAIT, MTRUE,
				     &channel_status, NULL, 0, 0))
					PRINTM(MERROR,
					       "del_virt_if: Fail to cancel remain on channel\n");

				if (priv->phandle->cookie) {
					cfg80211_remain_on_channel_expired(
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)
										  remain_priv->
										  netdev,
#else
										  remain_priv->
										  wdev,
#endif
										  priv->
										  phandle->
										  cookie,
										  &priv->
										  phandle->
										  chan,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
										  priv->
										  phandle->
										  channel_type,
#endif
										  GFP_ATOMIC);
					priv->phandle->cookie = 0;
				}
				priv->phandle->remain_on_channel = MFALSE;
			}
		}

		woal_clear_all_mgmt_ies(vir_priv, MOAL_IOCTL_WAIT);
		woal_cfg80211_deinit_p2p(vir_priv);
		woal_bss_remove(vir_priv);
#ifdef CONFIG_PROC_FS
#ifdef PROC_DEBUG
		/* Remove proc debug */
		woal_debug_remove(vir_priv);
#endif /* PROC_DEBUG */
		woal_proc_remove(vir_priv);
#endif /* CONFIG_PROC_FS */
		/* Last reference is our one */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
		PRINTM(MINFO, "refcnt = %d\n", atomic_read(&dev->refcnt));
#else
		PRINTM(MINFO, "refcnt = %d\n", netdev_refcnt_read(dev));
#endif
		PRINTM(MINFO, "netdev_finish_unregister: %s\n", dev->name);
		/* Clear the priv in handle */
		vir_priv->phandle->priv[vir_priv->bss_index] = NULL;
		priv->phandle->priv_num--;
		if (dev->reg_state == NETREG_REGISTERED)
			unregister_netdevice(dev);
	}
	return ret;
}