qcacld-3.0: Refactor WLAN_FEATURE_LPSS
Currently in HDD the WLAN_FEATURE_LPSS code is distributed amongst
multiple source files. In order to be more aligned with established
practices refactor most of the feature code into a feature-specific
file .
Change-Id: I7c743f32fd1455fc253a00d69bfc9abb7f6743da
CRs-Fixed: 1018553
diff --git a/Kbuild b/Kbuild
index cf509b1..694715a 100644
--- a/Kbuild
+++ b/Kbuild
@@ -349,6 +349,10 @@
$(HDD_SRC_DIR)/wlan_hdd_wowl.o
+ifeq ($(CONFIG_WLAN_FEATURE_LPSS),y)
+HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_lpass.o
+endif
+
ifeq ($(CONFIG_WLAN_LRO), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_lro.o
endif
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index c4df74a..0bbc37a 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1527,32 +1527,6 @@
struct qdf_mac_addr macAddrSTA, int width);
#endif
-#ifdef WLAN_FEATURE_LPSS
-void wlan_hdd_send_status_pkg(hdd_adapter_t *pAdapter,
- hdd_station_ctx_t *pHddStaCtx,
- uint8_t is_on, uint8_t is_connected);
-void wlan_hdd_send_version_pkg(uint32_t fw_version,
- uint32_t chip_id, const char *chip_name);
-void wlan_hdd_send_all_scan_intf_info(hdd_context_t *pHddCtx);
-#else
-static inline void wlan_hdd_send_status_pkg(hdd_adapter_t *pAdapter,
- hdd_station_ctx_t *pHddStaCtx,
- uint8_t is_on, uint8_t is_connected)
-{
- return;
-}
-
-static inline void wlan_hdd_send_version_pkg(uint32_t fw_version, uint32_t
- chip_id, const char *chip_name)
-{
- return;
-}
-
-static inline void wlan_hdd_send_all_scan_intf_info(hdd_context_t *pHddCtx)
-{
- return;
-}
-#endif
void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len);
#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index f0bd3a3..94a347d 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -50,6 +50,7 @@
#include "sme_api.h"
#include "wlan_hdd_hostapd.h"
#include <wlan_hdd_ipa.h>
+#include "wlan_hdd_lpass.h"
#include <cds_sched.h>
#include "cds_concurrency.h"
#include "sme_power_save_api.h"
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 00a3520..74a13be 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -88,7 +88,7 @@
#include "wlan_hdd_subnet_detect.h"
#include <wlan_hdd_regulatory.h>
-
+#include "wlan_hdd_lpass.h"
#define g_mode_rates_size (12)
#define a_mode_rates_size (8)
@@ -7056,9 +7056,7 @@
/* Set bitmask based on updated value */
cds_set_concurrency_mode(pAdapter->device_mode);
-#ifdef WLAN_FEATURE_LPSS
wlan_hdd_send_all_scan_intf_info(pHddCtx);
-#endif
EXIT();
return 0;
diff --git a/core/hdd/src/wlan_hdd_lpass.c b/core/hdd/src/wlan_hdd_lpass.c
new file mode 100644
index 0000000..600882b
--- /dev/null
+++ b/core/hdd/src/wlan_hdd_lpass.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+/**
+ * DOC: wlan_hdd_lpass.c
+ *
+ * WLAN Host Device Driver LPASS feature implementation
+ *
+ */
+
+/* Include Files */
+#include "wlan_hdd_main.h"
+#include "wlan_hdd_lpass.h"
+#include <cds_utils.h>
+#include "qwlan_version.h"
+
+static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
+ hdd_adapter_t *adapter,
+ hdd_station_ctx_t *pHddStaCtx,
+ uint8_t is_on, uint8_t is_connected)
+{
+ hdd_context_t *hdd_ctx = NULL;
+ uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN;
+
+ if (!data) {
+ hddLog(LOGE, FL("invalid data pointer"));
+ return -EINVAL;
+ }
+ if (!adapter) {
+ if (is_on) {
+ /* no active interface */
+ data->lpss_support = 0;
+ data->is_on = is_on;
+ return 0;
+ }
+ hddLog(LOGE, FL("invalid adapter pointer"));
+ return -EINVAL;
+ }
+
+ hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+ if (hdd_ctx->lpss_support && hdd_ctx->config->enable_lpass_support)
+ data->lpss_support = 1;
+ else
+ data->lpss_support = 0;
+ data->numChannels = WLAN_SVC_MAX_NUM_CHAN;
+ sme_get_cfg_valid_channels(hdd_ctx->hHal, data->channel_list,
+ &data->numChannels);
+ sme_get_country_code(hdd_ctx->hHal, data->country_code, &buflen);
+ data->is_on = is_on;
+ data->vdev_id = adapter->sessionId;
+ data->vdev_mode = adapter->device_mode;
+ if (pHddStaCtx) {
+ data->is_connected = is_connected;
+ data->rssi = adapter->rssi;
+ data->freq =
+ cds_chan_to_freq(pHddStaCtx->conn_info.operationChannel);
+ if (WLAN_SVC_MAX_SSID_LEN >=
+ pHddStaCtx->conn_info.SSID.SSID.length) {
+ data->ssid_len = pHddStaCtx->conn_info.SSID.SSID.length;
+ memcpy(data->ssid,
+ pHddStaCtx->conn_info.SSID.SSID.ssId,
+ pHddStaCtx->conn_info.SSID.SSID.length);
+ }
+ if (QDF_MAC_ADDR_SIZE >=
+ sizeof(pHddStaCtx->conn_info.bssId))
+ memcpy(data->bssid, pHddStaCtx->conn_info.bssId.bytes,
+ QDF_MAC_ADDR_SIZE);
+ }
+ return 0;
+}
+
+static int wlan_hdd_gen_wlan_version_pack(struct wlan_version_data *data,
+ uint32_t fw_version,
+ uint32_t chip_id,
+ const char *chip_name)
+{
+ if (!data) {
+ hddLog(LOGE, FL("invalid data pointer"));
+ return -EINVAL;
+ }
+
+ data->chip_id = chip_id;
+ strlcpy(data->chip_name, chip_name, WLAN_SVC_MAX_STR_LEN);
+ if (strncmp(chip_name, "Unknown", 7))
+ strlcpy(data->chip_from, "Qualcomm", WLAN_SVC_MAX_STR_LEN);
+ else
+ strlcpy(data->chip_from, "Unknown", WLAN_SVC_MAX_STR_LEN);
+ strlcpy(data->host_version, QWLAN_VERSIONSTR, WLAN_SVC_MAX_STR_LEN);
+ scnprintf(data->fw_version, WLAN_SVC_MAX_STR_LEN, "%d.%d.%d.%d",
+ (fw_version & 0xf0000000) >> 28,
+ (fw_version & 0xf000000) >> 24,
+ (fw_version & 0xf00000) >> 20, (fw_version & 0x7fff));
+ return 0;
+}
+
+void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
+ hdd_station_ctx_t *pHddStaCtx,
+ uint8_t is_on, uint8_t is_connected)
+{
+ int ret = 0;
+ struct wlan_status_data data;
+
+ if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
+ return;
+
+ memset(&data, 0, sizeof(struct wlan_status_data));
+ if (is_on)
+ ret = wlan_hdd_gen_wlan_status_pack(&data, adapter, pHddStaCtx,
+ is_on, is_connected);
+ if (!ret)
+ wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_STATUS_IND,
+ &data,
+ sizeof(struct wlan_status_data));
+}
+
+void wlan_hdd_send_version_pkg(uint32_t fw_version,
+ uint32_t chip_id, const char *chip_name)
+{
+ int ret = 0;
+ struct wlan_version_data data;
+
+ if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
+ return;
+
+ memset(&data, 0, sizeof(struct wlan_version_data));
+ ret =
+ wlan_hdd_gen_wlan_version_pack(&data, fw_version, chip_id,
+ chip_name);
+ if (!ret)
+ wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_VERSION_IND,
+ &data,
+ sizeof(struct wlan_version_data));
+}
+
+void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx)
+{
+ hdd_adapter_t *pDataAdapter = NULL;
+ hdd_adapter_list_node_t *adapterNode = NULL, *pNext = NULL;
+ bool scan_intf_found = false;
+ QDF_STATUS status;
+
+ if (!hdd_ctx) {
+ hddLog(QDF_TRACE_LEVEL_ERROR,
+ FL("NULL pointer for hdd_ctx"));
+ return;
+ }
+
+ status = hdd_get_front_adapter(hdd_ctx, &adapterNode);
+ while (NULL != adapterNode && QDF_STATUS_SUCCESS == status) {
+ pDataAdapter = adapterNode->pAdapter;
+ if (pDataAdapter) {
+ if (pDataAdapter->device_mode == QDF_STA_MODE
+ || pDataAdapter->device_mode == QDF_P2P_CLIENT_MODE
+ || pDataAdapter->device_mode ==
+ QDF_P2P_DEVICE_MODE) {
+ scan_intf_found = true;
+ wlan_hdd_send_status_pkg(pDataAdapter, NULL, 1,
+ 0);
+ }
+ }
+ status = hdd_get_next_adapter(hdd_ctx, adapterNode, &pNext);
+ adapterNode = pNext;
+ }
+
+ if (!scan_intf_found)
+ wlan_hdd_send_status_pkg(pDataAdapter, NULL, 1, 0);
+}
diff --git a/core/hdd/src/wlan_hdd_lpass.h b/core/hdd/src/wlan_hdd_lpass.h
new file mode 100644
index 0000000..23771b9
--- /dev/null
+++ b/core/hdd/src/wlan_hdd_lpass.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#if !defined(WLAN_HDD_LPASS_H)
+#define WLAN_HDD_LPASS_H
+
+#ifdef WLAN_FEATURE_LPSS
+void wlan_hdd_send_status_pkg(hdd_adapter_t *pAdapter,
+ hdd_station_ctx_t *pHddStaCtx,
+ uint8_t is_on, uint8_t is_connected);
+void wlan_hdd_send_version_pkg(uint32_t fw_version,
+ uint32_t chip_id, const char *chip_name);
+void wlan_hdd_send_all_scan_intf_info(hdd_context_t *pHddCtx);
+#else
+static inline void wlan_hdd_send_status_pkg(hdd_adapter_t *pAdapter,
+ hdd_station_ctx_t *pHddStaCtx,
+ uint8_t is_on, uint8_t is_connected)
+{
+ return;
+}
+
+static inline void wlan_hdd_send_version_pkg(uint32_t fw_version, uint32_t
+ chip_id, const char *chip_name)
+{
+ return;
+}
+
+static inline void wlan_hdd_send_all_scan_intf_info(hdd_context_t *pHddCtx)
+{
+ return;
+}
+#endif
+
+#endif /* WLAN_HDD_LPASS_H */
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 59031a3..2873998 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -103,6 +103,7 @@
#include "bmi.h"
#include <wlan_hdd_regulatory.h>
#include "ol_rx_fwd.h"
+#include "wlan_hdd_lpass.h"
#ifdef MODULE
#define WLAN_MODULE_NAME module_name(THIS_MODULE)
@@ -6847,86 +6848,6 @@
return sme_is_sta_p2p_client_connected(hdd_ctx->hHal);
}
-#ifdef WLAN_FEATURE_LPSS
-int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
- hdd_adapter_t *adapter,
- hdd_station_ctx_t *pHddStaCtx,
- uint8_t is_on, uint8_t is_connected)
-{
- hdd_context_t *hdd_ctx = NULL;
- uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN;
-
- if (!data) {
- hddLog(LOGE, FL("invalid data pointer"));
- return -EINVAL;
- }
- if (!adapter) {
- if (is_on) {
- /* no active interface */
- data->lpss_support = 0;
- data->is_on = is_on;
- return 0;
- }
- hddLog(LOGE, FL("invalid adapter pointer"));
- return -EINVAL;
- }
-
- hdd_ctx = WLAN_HDD_GET_CTX(adapter);
- if (hdd_ctx->lpss_support && hdd_ctx->config->enable_lpass_support)
- data->lpss_support = 1;
- else
- data->lpss_support = 0;
- data->numChannels = WLAN_SVC_MAX_NUM_CHAN;
- sme_get_cfg_valid_channels(hdd_ctx->hHal, data->channel_list,
- &data->numChannels);
- sme_get_country_code(hdd_ctx->hHal, data->country_code, &buflen);
- data->is_on = is_on;
- data->vdev_id = adapter->sessionId;
- data->vdev_mode = adapter->device_mode;
- if (pHddStaCtx) {
- data->is_connected = is_connected;
- data->rssi = adapter->rssi;
- data->freq =
- cds_chan_to_freq(pHddStaCtx->conn_info.operationChannel);
- if (WLAN_SVC_MAX_SSID_LEN >=
- pHddStaCtx->conn_info.SSID.SSID.length) {
- data->ssid_len = pHddStaCtx->conn_info.SSID.SSID.length;
- memcpy(data->ssid,
- pHddStaCtx->conn_info.SSID.SSID.ssId,
- pHddStaCtx->conn_info.SSID.SSID.length);
- }
- if (QDF_MAC_ADDR_SIZE >=
- sizeof(pHddStaCtx->conn_info.bssId))
- memcpy(data->bssid, pHddStaCtx->conn_info.bssId.bytes,
- QDF_MAC_ADDR_SIZE);
- }
- return 0;
-}
-
-int wlan_hdd_gen_wlan_version_pack(struct wlan_version_data *data,
- uint32_t fw_version,
- uint32_t chip_id, const char *chip_name)
-{
- if (!data) {
- hddLog(LOGE, FL("invalid data pointer"));
- return -EINVAL;
- }
-
- data->chip_id = chip_id;
- strlcpy(data->chip_name, chip_name, WLAN_SVC_MAX_STR_LEN);
- if (strncmp(chip_name, "Unknown", 7))
- strlcpy(data->chip_from, "Qualcomm", WLAN_SVC_MAX_STR_LEN);
- else
- strlcpy(data->chip_from, "Unknown", WLAN_SVC_MAX_STR_LEN);
- strlcpy(data->host_version, QWLAN_VERSIONSTR, WLAN_SVC_MAX_STR_LEN);
- scnprintf(data->fw_version, WLAN_SVC_MAX_STR_LEN, "%d.%d.%d.%d",
- (fw_version & 0xf0000000) >> 28,
- (fw_version & 0xf000000) >> 24,
- (fw_version & 0xf00000) >> 20, (fw_version & 0x7fff));
- return 0;
-}
-#endif
-
/**
* wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
* @adapter: HDD adapter pointer
@@ -7097,81 +7018,6 @@
return;
}
-#ifdef WLAN_FEATURE_LPSS
-void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
- hdd_station_ctx_t *pHddStaCtx,
- uint8_t is_on, uint8_t is_connected)
-{
- int ret = 0;
- struct wlan_status_data data;
-
- if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
- return;
-
- memset(&data, 0, sizeof(struct wlan_status_data));
- if (is_on)
- ret = wlan_hdd_gen_wlan_status_pack(&data, adapter, pHddStaCtx,
- is_on, is_connected);
- if (!ret)
- wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_STATUS_IND,
- &data,
- sizeof(struct wlan_status_data));
-}
-
-void wlan_hdd_send_version_pkg(uint32_t fw_version,
- uint32_t chip_id, const char *chip_name)
-{
- int ret = 0;
- struct wlan_version_data data;
-
- if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
- return;
-
- memset(&data, 0, sizeof(struct wlan_version_data));
- ret =
- wlan_hdd_gen_wlan_version_pack(&data, fw_version, chip_id,
- chip_name);
- if (!ret)
- wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_VERSION_IND,
- &data,
- sizeof(struct wlan_version_data));
-}
-
-void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx)
-{
- hdd_adapter_t *pDataAdapter = NULL;
- hdd_adapter_list_node_t *adapterNode = NULL, *pNext = NULL;
- bool scan_intf_found = false;
- QDF_STATUS status;
-
- if (!hdd_ctx) {
- hddLog(QDF_TRACE_LEVEL_ERROR,
- FL("NULL pointer for hdd_ctx"));
- return;
- }
-
- status = hdd_get_front_adapter(hdd_ctx, &adapterNode);
- while (NULL != adapterNode && QDF_STATUS_SUCCESS == status) {
- pDataAdapter = adapterNode->pAdapter;
- if (pDataAdapter) {
- if (pDataAdapter->device_mode == QDF_STA_MODE
- || pDataAdapter->device_mode == QDF_P2P_CLIENT_MODE
- || pDataAdapter->device_mode ==
- QDF_P2P_DEVICE_MODE) {
- scan_intf_found = true;
- wlan_hdd_send_status_pkg(pDataAdapter, NULL, 1,
- 0);
- }
- }
- status = hdd_get_next_adapter(hdd_ctx, adapterNode, &pNext);
- adapterNode = pNext;
- }
-
- if (!scan_intf_found)
- wlan_hdd_send_status_pkg(pDataAdapter, NULL, 1, 0);
-}
-#endif
-
#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
void wlan_hdd_auto_shutdown_cb(void)
{
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index dc7c45d..faa99c1 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -65,6 +65,7 @@
#include <wlan_hdd_cfg80211.h>
#include <net/addrconf.h>
#include <wlan_hdd_ipa.h>
+#include <wlan_hdd_lpass.h>
#include <wma_types.h>
#include "hif.h"
@@ -1326,9 +1327,7 @@
hddLog(QDF_TRACE_LEVEL_FATAL, "%s: WLAN driver shutting down!",
__func__);
-#ifdef WLAN_FEATURE_LPSS
wlan_hdd_send_status_pkg(NULL, NULL, 0, 0);
-#endif
/* If SSR never completes, then do kernel panic. */
hdd_ssr_timer_init();
@@ -1660,12 +1659,10 @@
sme_set_rssi_threshold_breached_cb(pHddCtx->hHal, hdd_rssi_threshold_breached);
-#ifdef WLAN_FEATURE_LPSS
wlan_hdd_send_all_scan_intf_info(pHddCtx);
wlan_hdd_send_version_pkg(pHddCtx->target_fw_version,
pHddCtx->target_hw_version,
pHddCtx->target_hw_name);
-#endif
qdf_status = wlansap_global_init();
if (QDF_IS_STATUS_ERROR(qdf_status))
goto err_cds_disable;
diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c
index 89c0791..24677fd 100644
--- a/core/hdd/src/wlan_hdd_stats.c
+++ b/core/hdd/src/wlan_hdd_stats.c
@@ -30,6 +30,7 @@
#include "sme_api.h"
#include "cds_sched.h"
#include "wlan_hdd_trace.h"
+#include "wlan_hdd_lpass.h"
#ifdef WLAN_FEATURE_LINK_LAYER_STATS