Commit e89c0550 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723au: rtw_do_join23a(): Don't start scanning if network isn't found



Don't start running network scans if trying to connect to a network
not in our cache. Let the 802.11 stack do it's job instead.

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72795e9d
Loading
Loading
Loading
Loading
+13 −72
Original line number Diff line number Diff line
@@ -24,17 +24,8 @@

int rtw_do_join23a(struct rtw_adapter *padapter)
{
	struct list_head *plist, *phead;
	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
	struct rtw_queue *queue = &pmlmepriv->scanned_queue;
	int ret = _SUCCESS;

	spin_lock_bh(&pmlmepriv->scanned_queue.lock);
	phead = get_list_head(queue);
	plist = phead->next;

	RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
		 ("%s: phead = %p; plist = %p\n\n\n", __func__, phead, plist));
	int ret;

	pmlmepriv->cur_network.join_res = -2;

@@ -42,40 +33,8 @@ int rtw_do_join23a(struct rtw_adapter *padapter)

	pmlmepriv->to_join = true;

	if (list_empty(&queue->queue)) {
		spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
		_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);

		/* when set_ssid/set_bssid for rtw_do_join23a(), but
		   scanning queue is empty */
		/* we try to issue sitesurvey firstly */

		if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false ||
		    padapter->mlmepriv.to_roaming > 0) {
			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
				 ("%s: site survey if scanned_queue is empty\n",
					 __func__));
			/*  submit site_survey23a_cmd */
			ret = rtw_sitesurvey_cmd23a(padapter,
						 &pmlmepriv->assoc_ssid, 1,
						 NULL, 0);
			if (ret != _SUCCESS) {
				pmlmepriv->to_join = false;
				RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
					 ("%s: site survey return error\n",
						 __func__));
			}
		} else {
			pmlmepriv->to_join = false;
			ret = _FAIL;
		}

		goto exit;
	} else {
		int select_ret;
		spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
		select_ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
		if (select_ret == _SUCCESS) {
	ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
	if (ret == _SUCCESS) {
		pmlmepriv->to_join = false;
	} else {
		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
@@ -87,30 +46,12 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
			/*  can't associate ; reset under-linking */
			_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);

				/* when set_ssid/set_bssid for rtw_do_join23a(),
				   but there are no desired bss in scanning
				   queue */
				/* we try to issue sitesurvey firstly */
				if (pmlmepriv->LinkDetectInfo.bBusyTraffic ==
				    false || padapter->mlmepriv.to_roaming > 0){
					/* DBG_8723A("rtw_do_join23a() when   no "
					   "desired bss in scanning queue\n");
					*/
					ret = rtw_sitesurvey_cmd23a(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
					if (ret != _SUCCESS) {
						pmlmepriv->to_join = false;
						RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("%s: site survey return error\n", __func__));
					}
				} else {
			ret = _FAIL;
			pmlmepriv->to_join = false;
		}
	}
		}
	}

exit:

	return ret;
}