blob: a6afa3fd7e8a5d145481dec2983295e9dff41e88 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnsone1422fb2017-01-12 08:45:01 -08002 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/**
23 * DOC : wlan_hdd_scan.h
24 *
25 * WLAN Host Device Driver scan related implementation
26 *
27 */
28
29#if !defined(WLAN_HDD_SCAN_H)
30#define WLAN_HDD_SCAN_H
31
32#include "wlan_hdd_main.h"
Nachiket Kukadec34d4a32017-07-12 16:20:27 +053033#include "csr_inside_api.h"
Sandeep Puligillad0004212017-02-26 18:34:56 -080034#include <wlan_cfg80211_scan.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035
36#define MAX_PENDING_LOG 5
37
Kapil Gupta0ed58dc2016-04-22 15:35:26 +053038/* (30 Mins) */
39#define MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT (30 * 60 * 1000)
40
Arunk Khandavallia4563d22017-12-04 10:22:50 +053041/* HDD Scan inactivity timeout set to double
42 * of the CSR CMD Timeout.
Jeff Johnson50bc9d72017-10-03 11:58:26 -070043 */
Nachiket Kukadec34d4a32017-07-12 16:20:27 +053044#define HDD_SCAN_INACTIVITY_TIMEOUT \
Arunk Khandavallia4563d22017-12-04 10:22:50 +053045 (CSR_ACTIVE_SCAN_LIST_CMD_TIMEOUT * 2)
Nachiket Kukadec34d4a32017-07-12 16:20:27 +053046
Jeff Johnson24d267e2017-08-28 11:43:07 -070047int hdd_scan_context_init(struct hdd_context *hdd_ctx);
48void hdd_scan_context_destroy(struct hdd_context *hdd_ctx);
Prashanth Bhatta527fd752016-04-28 12:35:23 -070049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080051 struct cfg80211_scan_request *request);
52
53#ifdef FEATURE_WLAN_SCAN_PNO
54int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
55 struct net_device *dev,
56 struct cfg80211_sched_scan_request
57 *request);
58
Dustin Browndfc5ef62017-08-16 15:20:11 -070059#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownf27bce82016-11-03 12:52:27 -070060/**
61 * wlan_hdd_cfg80211_sched_scan_stop() - stop cfg80211 scheduled (PNO) scan
62 * @wiphy: Pointer to wiphy
63 * @dev: Pointer network device
64 *
65 * Note, this returns success if the driver is recovering or unloading to
66 * prevent race conditions between PLD initiating an unload and kernel
67 * initiating a scheduled scan stop via cfg80211. Unload is expected to stop
68 * any pending scheduled scans in this case.
69 *
70 * Return: 0 for success, non zero for failure
71 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
73 struct net_device *dev);
Dustin Browndfc5ef62017-08-16 15:20:11 -070074#else
75int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
76 struct net_device *dev,
77 uint64_t reqid);
78
79#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brownf27bce82016-11-03 12:52:27 -070080
81/**
82 * wlan_hdd_sched_scan_stop() - stop scheduled (PNO) scans
83 * @dev: Pointer network device
84 *
85 * Return: 0 for success, non zero for failure
86 */
87int wlan_hdd_sched_scan_stop(struct net_device *dev);
Abhishek Singhb20db962017-03-03 21:28:46 +053088#else
89static inline int wlan_hdd_sched_scan_stop(struct net_device *dev)
90{
91 return 0;
92}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080093#endif /* End of FEATURE_WLAN_SCAN_PNO */
94
95int wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,
96 struct wireless_dev *wdev, const void *data,
97 int data_len);
98
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053099/**
100 * wlan_hdd_vendor_abort_scan() - API to process vendor command for
101 * abort scan
102 * @wiphy: Pointer to wiphy
103 * @wdev: Pointer to net device
104 * @data : Pointer to the data
105 * @data_len : length of the data
106 *
107 * This is called from supplicant to abort scan
108 *
109 * Return: zero for success and non zero for failure.
110 */
111int wlan_hdd_vendor_abort_scan(
112 struct wiphy *wiphy, struct wireless_dev *wdev,
113 const void *data, int data_len);
114
Vidyullatha, Kanchanapally528789e2016-05-11 20:38:37 +0530115#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || \
Srinivas Girigowda682a16b2017-03-24 23:19:34 -0700116 defined(CFG80211_ABORT_SCAN)
Vidyullatha, Kanchanapally528789e2016-05-11 20:38:37 +0530117void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
118 struct wireless_dev *wdev);
119#endif
hqueaa33ee2017-05-04 17:56:35 +0800120
121/**
122 * wlan_hdd_cfg80211_scan_block_cb() - scan block work handler
123 * @work: Pointer to work
124 *
125 * This function is used to do scan block work handler
126 *
127 * Return: none
128 */
129void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130#endif /* end #if !defined(WLAN_HDD_SCAN_H) */
131