summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreelakshmi Konamki <skonam@codeaurora.org>2017-03-10 19:13:00 +0530
committerSandeep Puligilla <spuligil@codeaurora.org>2017-03-10 14:57:00 -0800
commit233f97bba19e76962752984cd7c1f9b1e22ceaee (patch)
treea7b2d1f4d58f2e9f8caed3a2b1d3cea461e26f33
parent7a072a292bd21999a6d9d5406b4995fe93088086 (diff)
qcacld-3.0: Add support for PNO scan in connected state
qcacld-2.0 to qcacld-3.0 propagation Add changes to support PNO scan in connected state to find better Ap's based on rssi threshold, band and rssi preference. Change-Id: I17f1830c07821b577473fc2d8f50c0867572fe0c CRs-Fixed: 2012702
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c21
-rw-r--r--core/hdd/src/wlan_hdd_scan.c61
-rw-r--r--core/mac/inc/sir_api.h18
-rw-r--r--core/wma/src/wma_scan_roam.c5
4 files changed, 75 insertions, 30 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 06a73da5673c..bd441baf03b6 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -9171,6 +9171,26 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
},
};
+/**
+ * wlan_hdd_cfg80211_add_connected_pno_support() - Set connected PNO support
+ * @wiphy: Pointer to wireless phy
+ *
+ * This function is used to set connected PNO support to kernel
+ *
+ * Return: None
+ */
+#if defined(CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN)
+static void wlan_hdd_cfg80211_add_connected_pno_support(struct wiphy *wiphy)
+{
+ wiphy_ext_feature_set(wiphy,
+ NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI);
+}
+#else
+static void wlan_hdd_cfg80211_add_connected_pno_support(struct wiphy *wiphy)
+{
+}
+#endif
+
#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \
defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \
defined(FEATURE_WLAN_SCAN_PNO)
@@ -9371,6 +9391,7 @@ int wlan_hdd_cfg80211_init(struct device *dev,
#endif
hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg);
+ wlan_hdd_cfg80211_add_connected_pno_support(wiphy);
#if defined QCA_WIFI_FTM
if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) {
diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c
index 06a709d9f89d..9c38566e8283 100644
--- a/core/hdd/src/wlan_hdd_scan.c
+++ b/core/hdd/src/wlan_hdd_scan.c
@@ -2662,31 +2662,6 @@ hdd_sched_scan_callback(void *callbackContext,
hdd_debug("cfg80211 scan result database updated");
}
-/**
- * wlan_hdd_is_pno_allowed() - Check if PNO is allowed
- * @adapter: HDD Device Adapter
- *
- * The PNO Start request is coming from upper layers.
- * It is to be allowed only for Infra STA device type
- * and the link should be in a disconnected state.
- *
- * Return: Success if PNO is allowed, Failure otherwise.
- */
-static QDF_STATUS wlan_hdd_is_pno_allowed(hdd_adapter_t *adapter)
-{
- hdd_debug("dev_mode=%d, conn_state=%d, session ID=%d",
- adapter->device_mode,
- adapter->sessionCtx.station.conn_info.connState,
- adapter->sessionId);
- if ((adapter->device_mode == QDF_STA_MODE) &&
- (eConnectionState_NotConnected ==
- adapter->sessionCtx.station.conn_info.connState))
- return QDF_STATUS_SUCCESS;
- else
- return QDF_STATUS_E_FAILURE;
-
-}
-
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || \
defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \
defined(FEATURE_WLAN_SCAN_PNO)
@@ -2752,6 +2727,36 @@ static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req,
#endif
/**
+ * wlan_hdd_sched_scan_update_relative_rssi() - update CPNO params
+ * @pno_request: pointer to PNO scan request
+ * @request: Pointer to cfg80211 scheduled scan start request
+ *
+ * This function is used to update Connected PNO params sent by kernel
+ *
+ * Return: None
+ */
+#if defined(CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN)
+static inline void wlan_hdd_sched_scan_update_relative_rssi(
+ tpSirPNOScanReq pno_request,
+ struct cfg80211_sched_scan_request *request)
+{
+ pno_request->relative_rssi_set = request->relative_rssi_set;
+ pno_request->relative_rssi = request->relative_rssi;
+ if (NL80211_BAND_2GHZ == request->rssi_adjust.band)
+ pno_request->band_rssi_pref.band = SIR_BAND_2_4_GHZ;
+ else if (NL80211_BAND_5GHZ == request->rssi_adjust.band)
+ pno_request->band_rssi_pref.band = SIR_BAND_5_GHZ;
+ pno_request->band_rssi_pref.rssi = request->rssi_adjust.delta;
+}
+#else
+static inline void wlan_hdd_sched_scan_update_relative_rssi(
+ tpSirPNOScanReq pno_request,
+ struct cfg80211_sched_scan_request *request)
+{
+}
+#endif
+
+/**
* __wlan_hdd_cfg80211_sched_scan_start() - cfg80211 scheduled scan(pno) start
* @wiphy: Pointer to wiphy
* @dev: Pointer network device
@@ -2835,11 +2840,6 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
}
}
- if (QDF_STATUS_E_FAILURE == wlan_hdd_is_pno_allowed(pAdapter)) {
- hdd_err("pno is not allowed");
- return -ENOTSUPP;
- }
-
pPnoRequest = (tpSirPNOScanReq) qdf_mem_malloc(sizeof(tSirPNOScanReq));
if (NULL == pPnoRequest) {
hdd_err("qdf_mem_malloc failed");
@@ -2986,6 +2986,7 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
* shall be in slow_scan_period mode until next PNO Start.
*/
hdd_config_sched_scan_plan(pPnoRequest, request, pHddCtx);
+ wlan_hdd_sched_scan_update_relative_rssi(pPnoRequest, request);
hdd_debug("Base scan interval: %d sec PNOScanTimerRepeatValue: %d",
(pPnoRequest->fast_scan_period / 1000),
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 43769e809ccc..3607cd9a923d 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -2910,6 +2910,17 @@ typedef struct {
} tSirNetworkType;
/**
+ * struct connected_pno_band_rssi_pref - BSS preference based on band
+ * and RSSI
+ * @band: band preference
+ * @rssi_pref: RSSI preference
+ */
+struct connected_pno_band_rssi_pref {
+ tSirRFBand band;
+ int8_t rssi;
+};
+
+/**
* struct sSirPNOScanReq - PNO Scan request structure
* @enable: flag to enable or disable
* @modePNO: PNO Mode
@@ -2924,6 +2935,10 @@ typedef struct {
* @p24GProbeTemplate: 2.4G probe template
* @us5GProbeTemplateLen: 5G probe template length
* @p5GProbeTemplate: 5G probe template
+ * @relative_rssi_set: Flag to check whether realtive_rssi is set or not
+ * @relative_rssi: Relative rssi threshold, used for connected pno
+ * @band_rssi_pref: Band and RSSI preference that can be given to one BSS
+ * over the other BSS
*/
typedef struct sSirPNOScanReq {
uint8_t enable;
@@ -2953,6 +2968,9 @@ typedef struct sSirPNOScanReq {
bool enable_pno_scan_randomization;
uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
uint8_t mac_addr_mask[QDF_MAC_ADDR_SIZE];
+ bool relative_rssi_set;
+ int8_t relative_rssi;
+ struct connected_pno_band_rssi_pref band_rssi_pref;
} tSirPNOScanReq, *tpSirPNOScanReq;
/* Preferred Network Found Indication */
diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c
index a3d76ca281ee..22d957ab0a40 100644
--- a/core/wma/src/wma_scan_roam.c
+++ b/core/wma/src/wma_scan_roam.c
@@ -3124,6 +3124,11 @@ QDF_STATUS wma_pno_start(tp_wma_handle wma, tpSirPNOScanReq pno)
qdf_mem_copy(params->mac_addr_mask, pno->mac_addr_mask,
QDF_MAC_ADDR_SIZE);
+ params->relative_rssi_set = pno->relative_rssi_set;
+ params->relative_rssi = pno->relative_rssi;
+ params->band_rssi_pref.band = pno->band_rssi_pref.band;
+ params->band_rssi_pref.rssi = pno->band_rssi_pref.rssi;
+
status = wmi_unified_pno_start_cmd(wma->wmi_handle,
params, channel_list);
if (QDF_IS_STATUS_SUCCESS(status)) {