qcacmn: Make an API for simultaneous scan check
Currently, the decision to allow/reject simultaneous scans is in wlan_cfg80211_scan() API. The same check is needed for remain_on_channel scan request also. Create an API and make it public to facilitate the same. Change-Id: I0f563e4ab7b27eefb3fdee7aef61bf8bedb76802 CRs-Fixed: 3625840
This commit is contained in:

committed by
Rahul Choudhary

parent
ccbe42985c
commit
6278e3dbbc
@@ -428,4 +428,15 @@ void wlan_cfg80211_scan_done(struct net_device *netdev,
|
|||||||
*/
|
*/
|
||||||
enum scan_priority convert_nl_scan_priority_to_internal(
|
enum scan_priority convert_nl_scan_priority_to_internal(
|
||||||
enum qca_wlan_vendor_scan_priority nl_scan_priority);
|
enum qca_wlan_vendor_scan_priority nl_scan_priority);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wlan_is_scan_allowed() - Allow/reject scan if any scan is running
|
||||||
|
* @vdev: vdev on which current scan issued
|
||||||
|
*
|
||||||
|
* Check if any other scan is in queue and decide whether to allow or reject
|
||||||
|
* current scan based on simultaneous_scan feature support
|
||||||
|
*
|
||||||
|
* Return: True if current scan can be allowed
|
||||||
|
*/
|
||||||
|
bool wlan_is_scan_allowed(struct wlan_objmgr_vdev *vdev);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1441,6 +1441,42 @@ enum scan_priority convert_nl_scan_priority_to_internal(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wlan_is_scan_allowed(struct wlan_objmgr_vdev *vdev)
|
||||||
|
{
|
||||||
|
struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
|
||||||
|
struct pdev_osif_priv *osif_priv;
|
||||||
|
struct wlan_objmgr_psoc *psoc;
|
||||||
|
enum QDF_OPMODE opmode = wlan_vdev_mlme_get_opmode(vdev);
|
||||||
|
|
||||||
|
psoc = wlan_pdev_get_psoc(pdev);
|
||||||
|
if (!psoc) {
|
||||||
|
osif_err("Invalid psoc object");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
osif_priv = wlan_pdev_get_ospriv(pdev);
|
||||||
|
if (!osif_priv) {
|
||||||
|
osif_err("Invalid osif priv object");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* For a non-SAP vdevs, if a scan is already going on i.e the scan queue
|
||||||
|
* is not empty, and the simultaneous scan is disabled, dont allow 2nd
|
||||||
|
* scan.
|
||||||
|
*/
|
||||||
|
qdf_mutex_acquire(&osif_priv->osif_scan->scan_req_q_lock);
|
||||||
|
if (!wlan_cfg80211_allow_simultaneous_scan(psoc) &&
|
||||||
|
!qdf_list_empty(&osif_priv->osif_scan->scan_req_q) &&
|
||||||
|
opmode != QDF_SAP_MODE) {
|
||||||
|
qdf_mutex_release(&osif_priv->osif_scan->scan_req_q_lock);
|
||||||
|
osif_err_rl("Simultaneous scan disabled, reject scan");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
qdf_mutex_release(&osif_priv->osif_scan->scan_req_q_lock);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
|
int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
|
||||||
struct cfg80211_scan_request *request,
|
struct cfg80211_scan_request *request,
|
||||||
struct scan_params *params)
|
struct scan_params *params)
|
||||||
@@ -1472,28 +1508,15 @@ int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
|
|||||||
osif_debug("%s(vdev%d): mode %d", request->wdev->netdev->name,
|
osif_debug("%s(vdev%d): mode %d", request->wdev->netdev->name,
|
||||||
wlan_vdev_get_id(vdev), opmode);
|
wlan_vdev_get_id(vdev), opmode);
|
||||||
|
|
||||||
/* Get NL global context from objmgr*/
|
if (!wlan_is_scan_allowed(vdev))
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
osif_priv = wlan_pdev_get_ospriv(pdev);
|
osif_priv = wlan_pdev_get_ospriv(pdev);
|
||||||
if (!osif_priv) {
|
if (!osif_priv) {
|
||||||
osif_err("Invalid osif priv object");
|
osif_err("Invalid osif priv object");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* For a non-SAP vdevs, if a scan is already going on i.e the scan queue
|
|
||||||
* is not empty, and the simultaneous scan is disabled, dont allow 2nd
|
|
||||||
* scan.
|
|
||||||
*/
|
|
||||||
qdf_mutex_acquire(&osif_priv->osif_scan->scan_req_q_lock);
|
|
||||||
if (!wlan_cfg80211_allow_simultaneous_scan(psoc) &&
|
|
||||||
!qdf_list_empty(&osif_priv->osif_scan->scan_req_q) &&
|
|
||||||
opmode != QDF_SAP_MODE) {
|
|
||||||
qdf_mutex_release(&osif_priv->osif_scan->scan_req_q_lock);
|
|
||||||
osif_err("Simultaneous scan disabled, reject scan");
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
qdf_mutex_release(&osif_priv->osif_scan->scan_req_q_lock);
|
|
||||||
|
|
||||||
req = qdf_mem_malloc(sizeof(*req));
|
req = qdf_mem_malloc(sizeof(*req));
|
||||||
if (!req)
|
if (!req)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Reference in New Issue
Block a user