qcacmn: Add console logging for bss found during scan

Add logic to log number of bss found in dmesg during scan.

Change-Id: Idfa5c548c509f2f0669fd635eb4cae16b23f3990
CRs-Fixed: 2759312
This commit is contained in:
Alan Chen
2020-08-20 15:03:38 -07:00
committed by snandini
parent 3b654ef914
commit 321ed86cde
2 changed files with 62 additions and 10 deletions

View File

@@ -123,6 +123,7 @@ enum scan_source {
* @scan_id: scan identifier used across host layers which is generated at WMI
* @source: scan request originator (NL/Vendor scan)
* @dev: net device (same as what is in scan_request)
* @scan_start_timestamp: scan start time
*
* Scan request linked list element
*/
@@ -132,6 +133,7 @@ struct scan_req {
uint32_t scan_id;
uint8_t source;
struct net_device *dev;
qdf_time_t scan_start_timestamp;
};
/**

View File

@@ -684,6 +684,7 @@ wlan_schedule_scan_start_request(struct wlan_objmgr_pdev *pdev,
scan_req->source = source;
scan_req->scan_id = scan_start_req->scan_req.scan_id;
scan_req->dev = req->wdev->netdev;
scan_req->scan_start_timestamp = qdf_get_time_of_the_day_ms();
qdf_mutex_acquire(&osif_scan->scan_req_q_lock);
if (qdf_list_size(&osif_scan->scan_req_q) < WLAN_MAX_SCAN_COUNT) {
@@ -725,7 +726,8 @@ wlan_schedule_scan_start_request(struct wlan_objmgr_pdev *pdev,
static QDF_STATUS wlan_scan_request_dequeue(
struct wlan_objmgr_pdev *pdev,
uint32_t scan_id, struct cfg80211_scan_request **req,
uint8_t *source, struct net_device **dev)
uint8_t *source, struct net_device **dev,
qdf_time_t *scan_start_timestamp)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct scan_req *scan_req;
@@ -769,6 +771,8 @@ static QDF_STATUS wlan_scan_request_dequeue(
*req = scan_req->scan_request;
*source = scan_req->source;
*dev = scan_req->dev;
*scan_start_timestamp =
scan_req->scan_start_timestamp;
qdf_mem_free(scan_req);
qdf_mutex_release(&scan_priv->scan_req_q_lock);
osif_debug("removed Scan id: %d, req = %pK, pending scans %d",
@@ -966,6 +970,36 @@ void wlan_scan_release_wake_lock(struct wlan_objmgr_psoc *psoc,
}
#endif
static
uint32_t wlan_scan_get_bss_count_for_scan(struct wlan_objmgr_pdev *pdev,
qdf_time_t scan_start_ts)
{
struct scan_filter *filter;
qdf_list_t *list = NULL;
uint32_t count = 0;
if (!scan_start_ts)
return count;
filter = qdf_mem_malloc(sizeof(*filter));
if (!filter)
return count;
filter->ignore_auth_enc_type = true;
filter->age_threshold = qdf_get_time_of_the_day_ms() - scan_start_ts;
list = ucfg_scan_get_result(pdev, filter);
qdf_mem_free(filter);
if (list) {
count = qdf_list_size(list);
ucfg_scan_purge_results(list);
}
return count;
}
/**
* wlan_cfg80211_scan_done_callback() - scan done callback function called after
* scan is finished
@@ -982,28 +1016,35 @@ static void wlan_cfg80211_scan_done_callback(
{
struct cfg80211_scan_request *req = NULL;
bool success = false;
uint32_t scan_id = event->scan_id;
uint32_t scan_id;
uint8_t source = NL_SCAN;
struct wlan_objmgr_pdev *pdev;
struct pdev_osif_priv *osif_priv;
struct net_device *netdev = NULL;
QDF_STATUS status;
qdf_time_t scan_start_timestamp = 0;
uint32_t unique_bss_count = 0;
if (!event) {
osif_nofl_err("Invalid scan event received");
return;
}
scan_id = event->scan_id;
qdf_mtrace(QDF_MODULE_ID_SCAN, QDF_MODULE_ID_OS_IF, event->type,
event->vdev_id, event->scan_id);
event->vdev_id, scan_id);
if (event->type == SCAN_EVENT_TYPE_STARTED)
osif_nofl_info("scan start scan id %d", scan_id);
if (!util_is_scan_completed(event, &success))
return;
osif_debug("vdev %d, scan id %d type %s(%d) reason %s(%d)",
event->vdev_id, scan_id,
util_scan_get_ev_type_name(event->type), event->type,
util_scan_get_ev_reason_name(event->reason),
event->reason);
pdev = wlan_vdev_get_pdev(vdev);
status = wlan_scan_request_dequeue(
pdev, scan_id, &req, &source, &netdev);
pdev, scan_id, &req, &source, &netdev,
&scan_start_timestamp);
if (QDF_IS_STATUS_ERROR(status)) {
osif_err("Dequeue of scan request failed ID: %d", scan_id);
goto allow_suspend;
@@ -1034,6 +1075,14 @@ static void wlan_cfg80211_scan_done_callback(
wlan_vendor_scan_callback(req, !success);
wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
unique_bss_count = wlan_scan_get_bss_count_for_scan(pdev,
scan_start_timestamp);
osif_nofl_info("vdev %d, scan id %d type %s(%d) reason %s(%d) scan found %d bss",
event->vdev_id, scan_id,
util_scan_get_ev_type_name(event->type), event->type,
util_scan_get_ev_reason_name(event->reason),
event->reason, unique_bss_count);
allow_suspend:
osif_priv = wlan_pdev_get_ospriv(pdev);
if (qdf_list_empty(&osif_priv->osif_scan->scan_req_q)) {
@@ -1056,6 +1105,7 @@ allow_suspend:
&osif_priv->osif_scan->scan_wake_lock,
SCAN_WAKE_LOCK_CONNECT_DURATION);
}
}
QDF_STATUS wlan_scan_runtime_pm_init(struct wlan_objmgr_pdev *pdev)