qcacld-3.0: Dynamic Mode changes

Currently MCL driver loads/unloads when user tries to
Switch On/Off from GUI and load process is different
for the static and dynamic built driver.
With this feature, we shall have a uniform behavior for
static and dynamic driver,  where the driver will be
loaded once and unload never.
Mode switch for different modes is supported via sysfs entries.

Change-Id: Ica49dd289d7f1f0ad0c56af76bd7bcfeca433a2e
CRs-Fixed: 1049218
This commit is contained in:
Arun Khandavalli 2016-08-01 13:31:08 +05:30
parent 1496fcb9be
commit fae9294564
17 changed files with 1124 additions and 1508 deletions

View File

@ -539,6 +539,7 @@ void cds_sched_deinit_mqs(p_cds_sched_context pSchedContext);
void cds_sched_flush_mc_mqs(p_cds_sched_context pSchedContext);
void qdf_timer_module_init(void);
void qdf_timer_module_deinit(void);
void cds_ssr_protect_init(void);
void cds_ssr_protect(const char *caller_func);
void cds_ssr_unprotect(const char *caller_func);

View File

@ -198,13 +198,6 @@ QDF_STATUS cds_open(void)
return QDF_STATUS_E_FAILURE;
}
cds_cfg = cds_get_ini_config();
if (!cds_cfg) {
cds_err("Cds config is NULL");
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
/* Initialize the timer module */
qdf_timer_module_init();
@ -245,25 +238,27 @@ QDF_STATUS cds_open(void)
&(gp_cds_context->aMsgWrappers[iter]));
}
/* Now Open the CDS Scheduler */
qdf_status = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched,
sizeof(cds_sched_context));
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Failed to open CDS Scheduler", __func__);
QDF_ASSERT(0);
goto err_msg_queue;
}
pHddCtx = (hdd_context_t *) (gp_cds_context->pHDDContext);
if ((NULL == pHddCtx) || (NULL == pHddCtx->config)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Hdd Context is Null", __func__);
cds_err("Hdd Context is Null");
QDF_ASSERT(0);
goto err_sched_close;
goto err_msg_queue;
}
/* Now Open the CDS Scheduler */
if (pHddCtx->driver_status == DRIVER_MODULES_UNINITIALIZED) {
qdf_status = cds_sched_open(gp_cds_context,
&gp_cds_context->qdf_sched,
sizeof(cds_sched_context));
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Failed to open CDS Scheduler", __func__);
QDF_ASSERT(0);
goto err_msg_queue;
}
}
scn = cds_get_context(QDF_MODULE_ID_HIF);
@ -272,6 +267,17 @@ QDF_STATUS cds_open(void)
"%s: scn is null!", __func__);
goto err_sched_close;
}
hdd_update_config(pHddCtx);
cds_cfg = cds_get_ini_config();
if (!cds_cfg) {
cds_err("Cds config is NULL");
QDF_ASSERT(0);
goto err_sched_close;
}
hdd_enable_fastpath(pHddCtx->config, scn);
hdd_wlan_update_target_info(pHddCtx, scn);
ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
/* Initialize BMI and Download firmware */
qdf_status = bmi_download_firmware(ol_ctx);
@ -280,7 +286,6 @@ QDF_STATUS cds_open(void)
"BMI FIALED status:%d", qdf_status);
goto err_bmi_close;
}
htcInfo.pContext = ol_ctx;
htcInfo.TargetFailure = ol_target_failure;
htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge;
@ -338,6 +343,8 @@ QDF_STATUS cds_open(void)
/* UMA is supported in hardware for performing the
* frame translation 802.11 <-> 802.3
*/
cds_cfg->frame_xln_reqd = 1;
sirStatus =
mac_open(&(gp_cds_context->pMACContext),
gp_cds_context->pHDDContext, cds_cfg);
@ -454,8 +461,11 @@ QDF_STATUS cds_pre_enable(v_CONTEXT_t cds_context)
}
/* call Packetlog connect service */
htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn);
pktlog_htc_attach();
if (QDF_GLOBAL_FTM_MODE != cds_get_conparam() &&
QDF_GLOBAL_EPPING_MODE != cds_get_conparam()) {
htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn);
pktlog_htc_attach();
}
/* Reset wma wait event */
qdf_event_reset(&gp_cds_context->wmaCompleteEvent);
@ -653,18 +663,12 @@ err_wma_stop:
QDF_STATUS cds_disable(v_CONTEXT_t cds_context)
{
QDF_STATUS qdf_status;
/* wma_stop is called before the SYS so that the processing of target
* pending responses will not be handled during uninitialization of
* WLAN driver
*/
qdf_event_reset(&(gp_cds_context->wmaCompleteEvent));
void *handle;
qdf_status = wma_stop(cds_context, HAL_STOP_TYPE_RF_KILL);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to stop wma", __func__);
cds_err("Failed to stop wma");
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
wma_setneedshutdown(cds_context);
}
@ -672,15 +676,23 @@ QDF_STATUS cds_disable(v_CONTEXT_t cds_context)
hif_disable_isr(((cds_context_type *) cds_context)->pHIFContext);
hif_reset_soc(((cds_context_type *) cds_context)->pHIFContext);
/* SYS STOP will stop SME and MAC */
qdf_status = sys_stop(cds_context);
handle = cds_get_context(QDF_MODULE_ID_PE);
if (!handle) {
cds_err("Invalid PE context return!");
return QDF_STATUS_E_INVAL;
}
qdf_status = sme_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to stop SYS", __func__);
cds_err("Failed to stop SME: %d", qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
qdf_status = mac_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
return QDF_STATUS_SUCCESS;
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
cds_err("Failed to stop MAC");
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
return qdf_status;
}
/**
@ -762,10 +774,9 @@ QDF_STATUS cds_close(v_CONTEXT_t cds_context)
}
cds_deinit_log_completion();
gp_cds_context->pHDDContext = NULL;
cds_deinit_ini_config();
qdf_timer_module_deinit();
return QDF_STATUS_SUCCESS;
}

View File

@ -3918,6 +3918,13 @@ QDF_STATUS cds_deinit_policy_mgr(void)
cds_err("Invalid CDS Context");
return QDF_STATUS_E_FAILURE;
}
if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
(&cds_ctx->connection_update_done_evt))) {
cds_err("Failed to destroy connection_update_done_evt");
return QDF_STATUS_E_FAILURE;
}
if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(
&cds_ctx->qdf_conc_list_lock))) {
cds_err("Failed to destroy qdf_conc_list_lock");

View File

@ -1176,6 +1176,7 @@ QDF_STATUS cds_sched_close(void *p_cds_context)
cds_drop_rxpkt_by_staid(gp_cds_sched_context, WLAN_MAX_STA_COUNT);
cds_free_ol_rx_pkt_freeq(gp_cds_sched_context);
unregister_hotcpu_notifier(&cds_cpu_hotplug_notifier);
gp_cds_sched_context->cpu_hot_plug_notifier = NULL;
#endif
return QDF_STATUS_SUCCESS;
} /* cds_sched_close() */

View File

@ -247,6 +247,16 @@ typedef enum {
#define CFG_ROAM_PREFER_5GHZ_MAX (1)
#define CFG_ROAM_PREFER_5GHZ_DEFAULT (1)
/*
* Timer waiting for interface up from the upper layer. If
* this timer expires all the cds modules shall be closed.
* Time Units: ms
*/
#define CFG_INTERFACE_CHANGE_WAIT_NAME "gInterfaceChangeWait"
#define CFG_INTERFACE_CHANGE_WAIT_MIN (10)
#define CFG_INTERFACE_CHANGE_WAIT_MAX (10000)
#define CFG_INTERFACE_CHANGE_WAIT_DEFAULT (50)
/*
To enable, set gRoamIntraBand=1 (Roaming within band)
To disable, set gRoamIntraBand=0 (Roaming across band)
@ -4047,6 +4057,7 @@ struct hdd_config {
bool enable_nan_datapath;
uint8_t nan_datapath_ndi_channel;
#endif
uint32_t iface_change_wait_time;
};
#define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))

View File

@ -28,6 +28,8 @@
#ifndef __WLAN_HDD_DRIVER_OPS_H__
#define __WLAN_HDD_DRIVER_OPS_H__
#include "hif.h"
/**
* DOC: wlan_hdd_driver_ops.h
*
@ -37,4 +39,7 @@ int wlan_hdd_register_driver(void);
void wlan_hdd_unregister_driver(void);
int wlan_hdd_bus_suspend(pm_message_t state);
int wlan_hdd_bus_resume(void);
void hdd_hif_close(void *hif_ctx);
int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
enum qdf_bus_type bus_type, bool reinit);
#endif /* __WLAN_HDD_DRIVER_OPS_H__ */

View File

@ -55,15 +55,11 @@ struct wlan_hdd_ftm_status {
enum wlan_hdd_ftm_state ftm_state;
};
int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx);
int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx);
int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx);
void hdd_ftm_mc_process_msg(void *message);
#if defined(QCA_WIFI_FTM)
QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len);
int wlan_hdd_qcmbr_unified_ioctl(hdd_adapter_t *adapter, struct ifreq *ifr);
int hdd_ftm_start(hdd_context_t *hdd_ctx);
int hdd_ftm_stop(hdd_context_t *hdd_ctx);
#endif
#endif

View File

@ -1184,6 +1184,20 @@ struct hdd_bpf_context {
struct sir_bpf_get_offload capability_response;
};
/**
* enum driver_status: Driver Modules status
* @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
* @DRIVER_MODULES_OPENED: Driver CDS modules opened
* @DRIVER_MODULES_ENABLED: Driver CDS modules opened
* @DRIVER_MODULES_CLOSED: Driver CDS modules closed
*/
enum driver_modules_status {
DRIVER_MODULES_UNINITIALIZED,
DRIVER_MODULES_OPENED,
DRIVER_MODULES_ENABLED,
DRIVER_MODULES_CLOSED
};
/** Adapter structure definition */
struct hdd_context_s {
@ -1435,6 +1449,12 @@ struct hdd_context_s {
#ifdef WLAN_FEATURE_NAN_DATAPATH
bool nan_datapath_enabled;
#endif
/* Present state of driver cds modules */
enum driver_modules_status driver_status;
/* MC timer interface change */
qdf_mc_timer_t iface_change_timer;
/* Interface change lock */
struct mutex iface_change_lock;
};
/*---------------------------------------------------------------------------
@ -1539,7 +1559,7 @@ static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
int hdd_init(void);
void hdd_deinit(void);
int hdd_wlan_startup(struct device *dev, void *hif_sc);
int hdd_wlan_startup(struct device *dev);
void __hdd_wlan_exit(void);
int hdd_wlan_notify_modem_power_state(int state);
#ifdef QCA_HT_2040_COEX
@ -1746,6 +1766,21 @@ int hdd_register_cb(hdd_context_t *hdd_ctx);
void hdd_deregister_cb(hdd_context_t *hdd_ctx);
int hdd_start_station_adapter(hdd_adapter_t *adapter);
int hdd_start_ap_adapter(hdd_adapter_t *adapter);
int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
int hdd_set_fw_params(hdd_adapter_t *adapter);
int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
bool reinit);
int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown);
int hdd_start_adapter(hdd_adapter_t *adapter);
#ifdef WLAN_FEATURE_FASTPATH
void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
void *context);
#else
static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
void *context)
{
}
#endif
void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
#endif /* end #if !defined(WLAN_HDD_MAIN_H) */

View File

@ -88,8 +88,11 @@ static inline int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
{
return -ENOTSUPP;
}
static inline void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
struct fw_dump_rsp *dump_rsp)
struct fw_dump_rsp
*dump_rsp)
{
}
#endif

View File

@ -145,7 +145,7 @@ enum suspend_resume_state {
/* SSR shutdown & re-init functions */
QDF_STATUS hdd_wlan_shutdown(void);
QDF_STATUS hdd_wlan_re_init(void *hif_sc);
QDF_STATUS hdd_wlan_re_init(void);
void hdd_conf_mcastbcast_filter(hdd_context_t *pHddCtx, bool setfilter);
QDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable);

View File

@ -3981,8 +3981,14 @@ REG_TABLE_ENTRY g_registry_table[] = {
CFG_ADAPT_DWELL_WIFI_THRESH_DEFAULT,
CFG_ADAPT_DWELL_WIFI_THRESH_MIN,
CFG_ADAPT_DWELL_WIFI_THRESH_MAX),
};
REG_VARIABLE(CFG_INTERFACE_CHANGE_WAIT_NAME, WLAN_PARAM_Integer,
struct hdd_config, iface_change_wait_time,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK,
CFG_INTERFACE_CHANGE_WAIT_DEFAULT,
CFG_INTERFACE_CHANGE_WAIT_MIN,
CFG_INTERFACE_CHANGE_WAIT_MAX),
};
/**
* get_next_line() - find and locate the new line pointer
@ -5583,6 +5589,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
hdd_info("Name = [%s] Value = [%u]",
CFG_IDLE_TIME_NAME,
pHddCtx->config->idle_time_conc);
hdd_info("Name = [%s] Value = [%u]",
CFG_INTERFACE_CHANGE_WAIT_NAME,
pHddCtx->config->iface_change_wait_time);
hdd_info("Name = [%s] Value = [%u]",
CFG_ENABLE_EDCA_INI_NAME,

View File

@ -480,16 +480,6 @@ static const struct ieee80211_iface_limit
},
};
static struct ieee80211_iface_combination
wlan_hdd_mon_iface[] = {
{
.limits = wlan_hdd_mon_iface_limit,
.max_interfaces = 3,
.num_different_channels = 2,
.n_limits = ARRAY_SIZE(wlan_hdd_mon_iface_limit),
},
};
static struct ieee80211_iface_combination
wlan_hdd_iface_combination[] = {
/* STA */
@ -567,6 +557,13 @@ static struct ieee80211_iface_combination
.n_limits = ARRAY_SIZE(wlan_hdd_p2p_p2p_iface_limit),
.beacon_int_infra_match = true,
},
/* Monitor */
{
.limits = wlan_hdd_mon_iface_limit,
.max_interfaces = 3,
.num_different_channels = 2,
.n_limits = ARRAY_SIZE(wlan_hdd_mon_iface_limit),
},
};
static struct cfg80211_ops wlan_hdd_cfg80211_ops;
@ -6965,35 +6962,28 @@ int wlan_hdd_cfg80211_init(struct device *dev,
wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS;
if (cds_get_conparam() != QDF_GLOBAL_MONITOR_MODE) {
/* Supports STATION & AD-HOC modes right now */
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
| BIT(NL80211_IFTYPE_ADHOC)
| BIT(NL80211_IFTYPE_P2P_CLIENT)
| BIT(NL80211_IFTYPE_P2P_GO)
| BIT(NL80211_IFTYPE_AP);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
| BIT(NL80211_IFTYPE_ADHOC)
| BIT(NL80211_IFTYPE_P2P_CLIENT)
| BIT(NL80211_IFTYPE_P2P_GO)
| BIT(NL80211_IFTYPE_AP)
| BIT(NL80211_IFTYPE_MONITOR);
if (pCfg->advertiseConcurrentOperation) {
if (pCfg->enableMCC) {
int i;
if (pCfg->advertiseConcurrentOperation) {
if (pCfg->enableMCC) {
int i;
for (i = 0;
i < ARRAY_SIZE(wlan_hdd_iface_combination);
i++) {
if (!pCfg->allowMCCGODiffBI)
wlan_hdd_iface_combination[i].
beacon_int_infra_match = true;
}
for (i = 0;
i < ARRAY_SIZE(wlan_hdd_iface_combination);
i++) {
if (!pCfg->allowMCCGODiffBI)
wlan_hdd_iface_combination[i].
beacon_int_infra_match = true;
}
wiphy->n_iface_combinations =
ARRAY_SIZE(wlan_hdd_iface_combination);
wiphy->iface_combinations = wlan_hdd_iface_combination;
}
} else {
wiphy->interface_modes = BIT(NL80211_IFTYPE_MONITOR);
wiphy->n_iface_combinations =
ARRAY_SIZE(wlan_hdd_mon_iface);
wiphy->iface_combinations = wlan_hdd_mon_iface;
ARRAY_SIZE(wlan_hdd_iface_combination);
wiphy->iface_combinations = wlan_hdd_iface_combination;
}
/* Before registering we need to update the ht capabilitied based
@ -7648,6 +7638,12 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
hdd_notice("Device_mode = %d, IFTYPE = 0x%x",
pAdapter->device_mode, type);
status = hdd_wlan_start_modules(pHddCtx, pAdapter, false);
if (status) {
hdd_err("Failed to start modules");
return -EINVAL;
}
if (!cds_allow_concurrency(
wlan_hdd_convert_nl_iftype_to_hdd_type(type),
0, HW_MODE_20_MHZ)) {
@ -7687,15 +7683,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
if (vstatus != QDF_STATUS_SUCCESS)
return -EINVAL;
/*
* for ibss interface type flow control is not required
* so don't register tx flow control
*/
if (type != NL80211_IFTYPE_ADHOC)
hdd_register_tx_flow_control(pAdapter,
hdd_tx_resume_timer_expired_handler,
hdd_tx_resume_cb);
goto done;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
@ -7710,8 +7697,8 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
wlan_hdd_cancel_existing_remain_on_channel
(pAdapter);
}
hdd_stop_adapter(pHddCtx, pAdapter, true);
hdd_stop_adapter(pHddCtx, pAdapter, true);
/* De-init the adapter */
hdd_deinit_adapter(pHddCtx, pAdapter, true);
memset(&pAdapter->sessionCtx, 0,
@ -7744,16 +7731,10 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
hdd_set_ap_ops(pAdapter->dev);
vstatus = hdd_init_ap_mode(pAdapter);
if (vstatus != QDF_STATUS_SUCCESS) {
hdd_alert("Error initializing the ap mode");
if (hdd_start_adapter(pAdapter)) {
hdd_err("Error initializing the ap mode");
return -EINVAL;
}
hdd_register_tx_flow_control(pAdapter,
hdd_softap_tx_resume_timer_expired_handler,
hdd_softap_tx_resume_cb);
/* Interface type changed update in wiphy structure */
if (wdev) {
wdev->iftype = type;
@ -7780,13 +7761,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
if (status != QDF_STATUS_SUCCESS)
return status;
if ((NL80211_IFTYPE_P2P_CLIENT == type) ||
(NL80211_IFTYPE_STATION == type)) {
hdd_register_tx_flow_control(pAdapter,
hdd_tx_resume_timer_expired_handler,
hdd_tx_resume_cb);
}
goto done;
case NL80211_IFTYPE_AP:
@ -7794,10 +7768,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
wdev->iftype = type;
pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
QDF_SAP_MODE : QDF_P2P_GO_MODE;
hdd_register_tx_flow_control(pAdapter,
hdd_softap_tx_resume_timer_expired_handler,
hdd_softap_tx_resume_cb);
goto done;
default:

View File

@ -210,7 +210,7 @@ static enum qdf_bus_type to_bus_type(enum pld_bus_type bus_type)
*
* Return: 0 on success and errno on failure.
*/
static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
enum qdf_bus_type bus_type, bool reinit)
{
QDF_STATUS status;
@ -255,6 +255,8 @@ static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
}
}
hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled());
return 0;
err_hif_close:
@ -269,11 +271,13 @@ err_hif_close:
*
* Helper function to close HIF
*/
static void hdd_hif_close(void *hif_ctx)
void hdd_hif_close(void *hif_ctx)
{
if (hif_ctx == NULL)
return;
hif_disable_power_management(hif_ctx);
hif_disable(hif_ctx, HIF_DISABLE_TYPE_REMOVE);
hdd_napi_destroy(true);
@ -286,11 +290,13 @@ static void hdd_hif_close(void *hif_ctx)
* hdd_init_qdf_ctx() - API to initialize global QDF Device structure
* @dev: Device Pointer
* @bdev: Bus Device pointer
* @bus_type: Underlying bus type
* @bid: Bus id passed by platform driver
*
* Return: void
*/
void hdd_init_qdf_ctx(struct device *dev, void *bdev,
enum qdf_bus_type bus_type)
enum qdf_bus_type bus_type, const struct hif_bus_id *bid)
{
qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
@ -302,6 +308,7 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev,
qdf_dev->dev = dev;
qdf_dev->drv_hdl = bdev;
qdf_dev->bus_type = bus_type;
qdf_dev->bid = bid;
}
/**
@ -320,11 +327,7 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev,
static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
enum qdf_bus_type bus_type, bool reinit)
{
void *hif_ctx;
QDF_STATUS status;
int ret = 0;
qdf_device_t qdf_dev;
uint32_t mode = cds_get_conparam();
pr_info("%s: %sprobing driver v%s\n", WLAN_MODULE_NAME,
reinit ? "re-" : "", QWLAN_VERSIONSTR);
@ -349,42 +352,16 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
cds_set_load_in_progress(true);
}
if (QDF_IS_EPPING_ENABLED(mode)) {
status = epping_open();
if (status != QDF_STATUS_SUCCESS)
goto err_hdd_deinit;
}
hdd_init_qdf_ctx(dev, bdev, bus_type);
ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit);
if (ret)
goto err_epping_close;
hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
if (NULL == hif_ctx)
goto err_epping_close;
qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
status = ol_cds_init(qdf_dev, hif_ctx);
if (status != QDF_STATUS_SUCCESS) {
pr_err("%s No Memory to Create BMI Context\n", __func__);
goto err_hif_close;
}
hdd_init_qdf_ctx(dev, bdev, bus_type, (const struct hif_bus_id *)bid);
if (reinit)
ret = hdd_wlan_re_init(hif_ctx);
ret = hdd_wlan_re_init();
else
ret = hdd_wlan_startup(dev, hif_ctx);
ret = hdd_wlan_startup(dev);
if (ret)
goto err_bmi_close;
goto err_hdd_deinit;
hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled());
if (reinit) {
cds_set_recovery_in_progress(false);
@ -398,15 +375,12 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
return 0;
err_bmi_close:
ol_cds_free();
err_hif_close:
hdd_hif_close(hif_ctx);
err_epping_close:
if (QDF_IS_EPPING_ENABLED(mode))
epping_close();
err_hdd_deinit:
cds_set_load_in_progress(false);
if (reinit)
cds_set_recovery_in_progress(false);
else
cds_set_load_in_progress(false);
hdd_deinit();
out:
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
@ -431,6 +405,7 @@ static void wlan_hdd_remove(struct device *dev)
{
void *hif_ctx;
pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME,
QWLAN_VERSIONSTR);
@ -453,8 +428,6 @@ static void wlan_hdd_remove(struct device *dev)
if (NULL == hif_ctx)
return;
hif_disable_power_management(hif_ctx);
if (QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
epping_disable();
epping_close();
@ -462,8 +435,6 @@ static void wlan_hdd_remove(struct device *dev)
__hdd_wlan_exit();
}
ol_cds_free();
hdd_hif_close(hif_ctx);
hdd_deinit();
pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME);
@ -495,9 +466,6 @@ static void wlan_hdd_shutdown(void)
hif_disable_isr(hif_ctx);
hdd_wlan_shutdown();
}
ol_cds_free();
hdd_hif_close(hif_ctx);
}
/**
@ -549,7 +517,7 @@ void wlan_hdd_notify_handler(int state)
*/
static int __wlan_hdd_bus_suspend(pm_message_t state)
{
void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
void *hif_ctx;
int err = wlan_hdd_validate_context(hdd_ctx);
int status;
@ -564,6 +532,12 @@ static int __wlan_hdd_bus_suspend(pm_message_t state)
err = -EINVAL;
goto done;
}
if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
hdd_info("Driver Module closed return success");
return 0;
}
err = qdf_status_to_os_return(
ol_txrx_bus_suspend());
if (err)
@ -627,13 +601,18 @@ int wlan_hdd_bus_suspend(pm_message_t state)
*/
static int __wlan_hdd_bus_resume(void)
{
void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
void *hif_ctx;
int status = wlan_hdd_validate_context(hdd_ctx);
if (status)
return status;
if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
hdd_info("Driver Module closed return success");
return 0;
}
hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
if (NULL == hif_ctx)
return -EINVAL;
@ -682,7 +661,7 @@ int wlan_hdd_bus_resume(void)
*/
static int __wlan_hdd_runtime_suspend(struct device *dev)
{
void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
void *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
void *htc_ctx = cds_get_context(QDF_MODULE_ID_HTC);

View File

@ -111,32 +111,6 @@ static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len)
return QDF_STATUS_SUCCESS;
}
/**
* wlan_hdd_ftm_update_tgt_cfg() - Update target configuration
* @context: context registered with WMA
* @param: target configuration
*
* This function is registered with WMA via wma_open(), and is
* invoked via callback when target parameters are received
* from firmware.
*
* Return: None
*/
static void wlan_hdd_ftm_update_tgt_cfg(void *context, void *param)
{
hdd_context_t *hdd_ctx = (hdd_context_t *) context;
struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *)param;
if (!qdf_is_macaddr_zero(&cfg->hw_macaddr)) {
hdd_update_macaddr(hdd_ctx->config, cfg->hw_macaddr);
} else {
hddLog(QDF_TRACE_LEVEL_ERROR,
"%s: Invalid MAC passed from target, using MAC from ini file"
MAC_ADDRESS_STR, __func__,
MAC_ADDR_ARRAY(hdd_ctx->config->intfMacAddr[0].bytes));
}
}
#ifdef WLAN_FEATURE_LPSS
static inline void hdd_is_lpass_supported(struct cds_config_info *cds_cfg,
hdd_context_t *hdd_ctx)
@ -180,544 +154,6 @@ int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx)
return 0;
}
/**
* wlan_ftm_cds_open() - Open the CDS Module in FTM mode
* @p_cds_context: pointer to the global CDS context
* @hddContextSize: Size of the HDD context to allocate.
*
* The wlan_ftm_cds_open() function opens the QDF Scheduler
* Upon successful initialization:
* - All CDS submodules should have been initialized
* - The CDS scheduler should have opened
* - All the WLAN SW components should have been opened. This includes MAC.
*
* Returns:
* QDF_STATUS_SUCCESS - Scheduler was successfully initialized and
* is ready to be used.
* QDF_STATUS_E_RESOURCES - System resources (other than memory)
* are unavailable to initialize the scheduler
* QDF_STATUS_E_FAILURE - Failure to initialize the scheduler
*/
static QDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context,
uint32_t hddContextSize)
{
QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
int iter = 0;
tSirRetStatus sirStatus = eSIR_SUCCESS;
p_cds_contextType gp_cds_context = (p_cds_contextType) p_cds_context;
struct cds_config_info *cds_cfg;
#if defined(QCA_WIFI_FTM)
qdf_device_t qdf_ctx;
HTC_INIT_INFO htcInfo;
void *pHifContext = NULL;
void *pHtcContext = NULL;
struct ol_context *ol_ctx;
#endif
cds_context_type *cds_ctx;
hdd_context_t *hdd_ctx;
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: Opening CDS", __func__);
cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
if (!cds_ctx) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Trying to open CDS without a PreOpen", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
cds_cfg = cds_ctx->cds_cfg;
/* Initialize the probe event */
if (qdf_event_create(&gp_cds_context->ProbeEvent) != QDF_STATUS_SUCCESS) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Unable to init probeEvent", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
if (qdf_event_create(&(gp_cds_context->wmaCompleteEvent)) !=
QDF_STATUS_SUCCESS) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Unable to init wmaCompleteEvent", __func__);
QDF_ASSERT(0);
goto err_probe_event;
}
/* Initialize the free message queue */
vStatus = cds_mq_init(&gp_cds_context->freeVosMq);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to initialize CDS free message queue %d",
__func__, vStatus);
QDF_ASSERT(0);
goto err_wma_complete_event;
}
for (iter = 0; iter < CDS_CORE_MAX_MESSAGES; iter++) {
(gp_cds_context->aMsgWrappers[iter]).pVosMsg =
&(gp_cds_context->aMsgBuffers[iter]);
INIT_LIST_HEAD(&gp_cds_context->aMsgWrappers[iter].msgNode);
cds_mq_put(&gp_cds_context->freeVosMq,
&(gp_cds_context->aMsgWrappers[iter]));
}
/* Now Open the CDS Scheduler */
vStatus = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched,
sizeof(cds_sched_context));
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to open CDS Scheduler %d", __func__,
vStatus);
QDF_ASSERT(0);
goto err_msg_queue;
}
#if defined(QCA_WIFI_FTM)
/* Initialize BMI and Download firmware */
pHifContext = cds_get_context(QDF_MODULE_ID_HIF);
if (!pHifContext) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: failed to get HIF context", __func__);
goto err_sched_close;
}
ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
if (bmi_download_firmware(ol_ctx)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: BMI failed to download target", __func__);
goto err_bmi_close;
}
htcInfo.pContext = ol_ctx;
htcInfo.TargetFailure = ol_target_failure;
htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge;
qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
/* Create HTC */
gp_cds_context->htc_ctx =
htc_create(pHifContext, &htcInfo, qdf_ctx, hdd_get_conparam());
if (!gp_cds_context->htc_ctx) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Failed to Create HTC", __func__);
goto err_bmi_close;
}
if (bmi_done(ol_ctx)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Failed to complete BMI phase", __func__);
goto err_htc_close;
}
#endif /* QCA_WIFI_FTM */
hdd_ctx = (hdd_context_t *) (gp_cds_context->pHDDContext);
if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Hdd Context is Null", __func__);
QDF_ASSERT(0);
goto err_htc_close;
}
vStatus = wma_open(gp_cds_context,
wlan_hdd_ftm_update_tgt_cfg, NULL, cds_cfg);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to open WMA module %d", __func__,
vStatus);
QDF_ASSERT(0);
goto err_htc_close;
}
#if defined(QCA_WIFI_FTM)
hdd_update_config(hdd_ctx);
pHtcContext = cds_get_context(QDF_MODULE_ID_HTC);
if (!pHtcContext) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: failed to get HTC context", __func__);
goto err_wma_close;
}
if (htc_wait_target(pHtcContext)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: Failed to complete BMI phase", __func__);
goto err_wma_close;
}
#endif
/* Now proceed to open the MAC */
sirStatus =
mac_open(&(gp_cds_context->pMACContext),
gp_cds_context->pHDDContext, cds_cfg);
if (eSIR_SUCCESS != sirStatus) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to open MAC %d", __func__, sirStatus);
QDF_ASSERT(0);
goto err_wma_close;
}
#ifndef QCA_WIFI_FTM
/* Now proceed to open the SME */
vStatus = sme_open(gp_cds_context->pMACContext);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
/* Critical Error ... Cannot proceed further */
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to open SME %d", __func__, vStatus);
goto err_mac_close;
}
vStatus = sme_init_chan_list(gp_cds_context->pMACContext,
hdd_ctx->reg.alpha2, hdd_ctx->reg.cc_src);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to init sme channel list", __func__);
} else {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: CDS successfully Opened", __func__);
return QDF_STATUS_SUCCESS;
}
#else
return QDF_STATUS_SUCCESS;
#endif
#ifndef QCA_WIFI_FTM
err_mac_close:
#endif
mac_close(gp_cds_context->pMACContext);
err_wma_close:
wma_close(gp_cds_context);
err_htc_close:
#if defined(QCA_WIFI_FTM)
if (gp_cds_context->htc_ctx) {
htc_destroy(gp_cds_context->htc_ctx);
gp_cds_context->htc_ctx = NULL;
}
err_bmi_close:
bmi_cleanup(ol_ctx);
#endif /* QCA_WIFI_FTM */
err_sched_close:
cds_sched_close(gp_cds_context);
err_msg_queue:
cds_mq_deinit(&gp_cds_context->freeVosMq);
err_wma_complete_event:
qdf_event_destroy(&gp_cds_context->wmaCompleteEvent);
err_probe_event:
qdf_event_destroy(&gp_cds_context->ProbeEvent);
return QDF_STATUS_E_FAILURE;
} /* wlan_ftm_cds_open() */
/**
* wlan_ftm_cds_close() - Close the QDF Module in FTM mode
* @cds_context: context of cds
*
* The wlan_ftm_cds_close() function closes the QDF Module
*
* Return: QDF_STATUS_SUCCESS - successfully closed
*/
static QDF_STATUS wlan_ftm_cds_close(v_CONTEXT_t cds_context)
{
QDF_STATUS qdf_status;
p_cds_contextType gp_cds_context = (p_cds_contextType) cds_context;
#ifndef QCA_WIFI_FTM
qdf_status = sme_close(((p_cds_contextType) cds_context)->pMACContext);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to close SME %d", __func__, qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
#endif
qdf_status = mac_close(((p_cds_contextType) cds_context)->pMACContext);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to close MAC %d", __func__, qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
((p_cds_contextType) cds_context)->pMACContext = NULL;
qdf_status = wma_close(cds_context);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to close WMA %d", __func__, qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
#if defined(QCA_WIFI_FTM)
if (gp_cds_context->htc_ctx) {
htc_stop(gp_cds_context->htc_ctx);
htc_destroy(gp_cds_context->htc_ctx);
gp_cds_context->htc_ctx = NULL;
}
qdf_status = wma_wmi_service_close(cds_context);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to close wma_wmi_service", __func__);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
hif_disable_isr(gp_cds_context->pHIFContext);
#endif
cds_mq_deinit(&((p_cds_contextType) cds_context)->freeVosMq);
qdf_status = qdf_event_destroy(&gp_cds_context->ProbeEvent);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to destroy ProbeEvent %d", __func__,
qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
qdf_status = qdf_event_destroy(&gp_cds_context->wmaCompleteEvent);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to destroy wmaCompleteEvent %d", __func__,
qdf_status);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
return QDF_STATUS_SUCCESS;
}
/**
* cds_ftm_pre_start() - Pre-start CDS Module in FTM Mode
* @cds_context: The CDS context
*
* The cds_ftm_pre_start() function performs all pre-start activities
* in FTM mode.
*
* Return: QDF_STATUS_SUCCESS if pre-start was successful, an
* appropriate QDF_STATUS_E_** error code otherwise
*/
static QDF_STATUS cds_ftm_pre_start(v_CONTEXT_t cds_context)
{
QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
p_cds_contextType p_cds_context = (p_cds_contextType) cds_context;
#if defined(QCA_WIFI_FTM)
p_cds_contextType gp_cds_context =
cds_get_global_context();
#endif
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_INFO, "cds prestart");
if (NULL == p_cds_context->pWMAContext) {
QDF_ASSERT(0);
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"%s: WMA NULL context", __func__);
return QDF_STATUS_E_FAILURE;
}
/* Reset WMA wait event */
qdf_event_reset(&p_cds_context->wmaCompleteEvent);
/*call WMA pre start */
vStatus = wma_pre_start(p_cds_context);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"Failed to WMA prestart ");
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
/* Need to update time out of complete */
qdf_status = qdf_wait_single_event(&p_cds_context->wmaCompleteEvent,
HDD_FTM_WMA_PRE_START_TIMEOUT);
if (qdf_status != QDF_STATUS_SUCCESS) {
if (qdf_status == QDF_STATUS_E_TIMEOUT) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Timeout occurred before WMA complete",
__func__);
} else {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: wma_pre_start reporting other error",
__func__);
}
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
#if defined(QCA_WIFI_FTM)
vStatus = htc_start(gp_cds_context->htc_ctx);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_FATAL,
"Failed to Start HTC");
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
wma_wait_for_ready_event(gp_cds_context->pWMAContext);
#endif /* QCA_WIFI_FTM */
return QDF_STATUS_SUCCESS;
}
/**
* wlan_hdd_ftm_open() - Open HDD in FTM Mode
* @hdd_ctx: global HDD context
*
* The function hdd_wlan_startup calls this function to initialize the
* FTM specific modules.
*
* Return: 0 on success, non-zero on error
*/
int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx)
{
QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
p_cds_contextType p_cds_context = NULL;
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: Opening CDS", __func__);
p_cds_context = cds_get_global_context();
if (NULL == p_cds_context) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
"%s: Trying to open CDS without a PreOpen", __func__);
QDF_ASSERT(0);
goto err_qdf_status_failure;
}
vStatus = wlan_ftm_cds_open(p_cds_context, 0);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_open failed", __func__);
goto err_qdf_status_failure;
}
/*
* only needed to start WMA, which happens in wlan_hdd_ftm_start()
*/
/* Save the hal context in Adapter */
hdd_ctx->hHal =
(tHalHandle) cds_get_context(QDF_MODULE_ID_SME);
if (NULL == hdd_ctx->hHal) {
hddLog(QDF_TRACE_LEVEL_ERROR, "%s: HAL context is null",
__func__);
goto err_ftm_close;
}
return 0;
err_ftm_close:
wlan_ftm_cds_close(p_cds_context);
err_qdf_status_failure:
return -EPERM;
}
/**
* hdd_ftm_service_registration() - Register FTM service
* @hdd_ctx: global HDD context
*
* Return: 0 on success, non-zero on failure
*/
static int hdd_ftm_service_registration(hdd_context_t *hdd_ctx)
{
hdd_adapter_t *adapter;
adapter = hdd_open_adapter(hdd_ctx, QDF_FTM_MODE, "wlan%d",
wlan_hdd_get_intf_addr(hdd_ctx),
NET_NAME_UNKNOWN, false);
if (NULL == adapter) {
hddLog(QDF_TRACE_LEVEL_ERROR, "%s: hdd_open_adapter failed",
__func__);
goto err_adapter_open_failure;
}
hdd_ctx->ftm.ftm_state = WLAN_FTM_INITIALIZED;
return 0;
err_adapter_open_failure:
return -EPERM;
}
/**
* wlan_ftm_stop() - Stop HDD in FTM mode
* @hdd_ctx: pointer to HDD context
*
* This function stops the following modules
* WMA
*
* Return: 0 on success, non-zero on failure
*/
static int wlan_ftm_stop(hdd_context_t *hdd_ctx)
{
if (hdd_ctx->ftm.ftm_state != WLAN_FTM_STARTED) {
hddLog(LOGP, FL("FTM has not started. No need to stop"));
return -EPERM;
}
wma_stop(hdd_ctx->pcds_context, HAL_STOP_TYPE_RF_KILL);
return 0;
}
/**
* wlan_hdd_ftm_close() - Close HDD in FTM mode
* @hdd_ctx: pointer to HDD context
*
* Return: 0 on success, non-zero on failure
*/
int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx)
{
QDF_STATUS qdf_status;
v_CONTEXT_t cds_context = hdd_ctx->pcds_context;
hdd_adapter_t *adapter = hdd_get_adapter(hdd_ctx, QDF_FTM_MODE);
ENTER();
if (adapter == NULL) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
"%s:adapter is NULL", __func__);
return -ENXIO;
}
if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
"%s: Ftm has been started. stopping ftm", __func__);
wlan_ftm_stop(hdd_ctx);
}
hdd_close_all_adapters(hdd_ctx, false);
qdf_status = cds_sched_close(cds_context);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to close CDS Scheduler", __func__);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
}
/* Close CDS */
wlan_ftm_cds_close(cds_context);
#if defined(QCA_WIFI_FTM) && defined(LINUX_QCMBR)
spin_lock_bh(&qcmbr_queue_lock);
if (!list_empty(&qcmbr_queue_head)) {
qcmbr_queue_t *msg_buf, *tmp_buf;
list_for_each_entry_safe(msg_buf, tmp_buf, &qcmbr_queue_head,
list) {
list_del(&msg_buf->list);
kfree(msg_buf);
}
}
spin_unlock_bh(&qcmbr_queue_lock);
#endif
return 0;
}
/**
* hdd_ftm_mc_process_msg() - Process FTM mailbox message
@ -727,7 +163,7 @@ int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx)
*
* Return: void
*/
static void hdd_ftm_mc_process_msg(void *message)
void hdd_ftm_mc_process_msg(void *message)
{
void *data;
uint32_t data_len;
@ -750,107 +186,6 @@ static void hdd_ftm_mc_process_msg(void *message)
return;
}
/**
* wlan_hdd_ftm_start() - Start HDD in FTM mode
* @hdd_ctx: Global HDD context
*
* This function starts the following modules.
* 1) WMA Start.
* 2) HTC Start.
* 3) MAC Start to download the firmware.
*
* Return: 0 for success, non zero for failure
*/
static int wlan_hdd_ftm_start(hdd_context_t *hdd_ctx)
{
QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
p_cds_contextType p_cds_context =
(p_cds_contextType) (hdd_ctx->pcds_context);
if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) {
return 0;
}
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
"%s: Starting CLD SW", __func__);
/* We support only one instance for now ... */
if (p_cds_context == NULL) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
"%s: mismatch in context", __func__);
goto err_status_failure;
}
if (p_cds_context->pMACContext == NULL) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
"%s: MAC NULL context", __func__);
goto err_status_failure;
}
/* Vos preStart is calling */
if (!QDF_IS_STATUS_SUCCESS(cds_ftm_pre_start(hdd_ctx->pcds_context))) {
hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_pre_enable failed",
__func__);
goto err_status_failure;
}
sme_register_ftm_msg_processor(hdd_ctx->hHal, hdd_ftm_mc_process_msg);
vStatus = wma_start(p_cds_context);
if (vStatus != QDF_STATUS_SUCCESS) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Failed to start WMA", __func__);
goto err_status_failure;
}
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
"%s: MAC correctly started", __func__);
if (hdd_ftm_service_registration(hdd_ctx)) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
"%s: failed", __func__);
goto err_ftm_service_reg;
}
hdd_ctx->ftm.ftm_state = WLAN_FTM_STARTED;
return 0;
err_ftm_service_reg:
wlan_hdd_ftm_close(hdd_ctx);
err_status_failure:
return -EPERM;
}
#if defined(QCA_WIFI_FTM)
/**
* hdd_ftm_start() - Start HDD in FTM mode
* @hdd_ctx: Global HDD context
*
* Return: 0 for success, non zero for failure
*/
int hdd_ftm_start(hdd_context_t *hdd_ctx)
{
return wlan_hdd_ftm_start(hdd_ctx);
}
#endif
#if defined(QCA_WIFI_FTM)
/**
* hdd_ftm_stop() - Stop HDD in FTM mode
* @hdd_ctx: Global HDD context
*
* Return: 0 for success, non zero for failure
*/
int hdd_ftm_stop(hdd_context_t *hdd_ctx)
{
return wlan_ftm_stop(hdd_ctx);
}
#endif
#if defined(QCA_WIFI_FTM)
#if defined(LINUX_QCMBR)
/**

File diff suppressed because it is too large Load Diff

View File

@ -536,7 +536,6 @@ int memdump_init(void)
{
hdd_context_t *hdd_ctx;
int status = 0;
QDF_STATUS cb_status;
QDF_STATUS qdf_status;
hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
@ -550,13 +549,6 @@ int memdump_init(void)
return -EINVAL;
}
cb_status = sme_fw_mem_dump_register_cb(hdd_ctx->hHal,
wlan_hdd_cfg80211_fw_mem_dump_cb);
if (QDF_STATUS_SUCCESS != cb_status) {
hddLog(LOGE , FL("Failed to register the callback"));
return -EINVAL;
}
status = memdump_procfs_init();
if (status) {
hddLog(LOGE , FL("Failed to create proc file"));

View File

@ -1299,7 +1299,6 @@ static void hdd_ssr_timer_start(int msec)
*/
QDF_STATUS hdd_wlan_shutdown(void)
{
QDF_STATUS qdf_status;
v_CONTEXT_t p_cds_context = NULL;
hdd_context_t *pHddCtx;
p_cds_sched_context cds_sched_context = NULL;
@ -1350,76 +1349,8 @@ QDF_STATUS hdd_wlan_shutdown(void)
}
#endif
/* Stop all the threads; we do not want any messages to be a processed,
* any more and the best way to ensure that is to terminate the threads
* gracefully.
*/
/* Wait for MC to exit */
hdd_alert("Shutting down MC thread");
set_bit(MC_SHUTDOWN_EVENT_MASK, &cds_sched_context->mcEventFlag);
set_bit(MC_POST_EVENT_MASK, &cds_sched_context->mcEventFlag);
wake_up_interruptible(&cds_sched_context->mcWaitQueue);
wait_for_completion(&cds_sched_context->McShutdown);
#ifdef QCA_CONFIG_SMP
/* Wait for OL RX to exit */
hdd_alert("Shutting down OL RX thread");
unregister_hotcpu_notifier(cds_sched_context->cpu_hot_plug_notifier);
set_bit(RX_SHUTDOWN_EVENT_MASK, &cds_sched_context->ol_rx_event_flag);
set_bit(RX_POST_EVENT_MASK, &cds_sched_context->ol_rx_event_flag);
wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue);
wait_for_completion(&cds_sched_context->ol_rx_shutdown);
cds_sched_context->ol_rx_thread = NULL;
cds_drop_rxpkt_by_staid(cds_sched_context, WLAN_MAX_STA_COUNT);
cds_free_ol_rx_pkt_freeq(cds_sched_context);
#endif
hdd_alert("Doing WMA STOP");
qdf_status = wma_stop(p_cds_context, HAL_STOP_TYPE_RF_KILL);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, LOGE,
"%s: Failed to stop WMA", __func__);
QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
wma_setneedshutdown(p_cds_context);
}
hdd_alert("Doing SME STOP");
/* Stop SME - Cannot invoke cds_disable as cds_disable relies
* on threads being running to process the SYS Stop
*/
qdf_status = sme_stop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, LOGE,
"%s: Failed to stop sme %d", __func__, qdf_status);
QDF_ASSERT(0);
}
hdd_alert("Doing MAC STOP");
/* Stop MAC (PE and HAL) */
qdf_status = mac_stop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
QDF_TRACE(QDF_MODULE_ID_QDF, LOGE,
"%s: Failed to stop mac %d", __func__, qdf_status);
QDF_ASSERT(0);
}
hdd_notice("Flush Queues");
/* Clean up message queues of TX, RX and MC thread */
cds_sched_flush_mc_mqs(cds_sched_context);
/* Deinit all the TX, RX and MC queues */
cds_sched_deinit_mqs(cds_sched_context);
hdd_notice("Doing CDS Shutdown");
/* shutdown CDS */
cds_shutdown(p_cds_context);
/*mac context has already been released in mac_close call
so setting it to NULL in hdd context */
pHddCtx->hHal = (tHalHandle) NULL;
wlansap_global_deinit();
hdd_wlan_stop_modules(pHddCtx, true);
hdd_alert("WLAN driver shutdown complete");
return QDF_STATUS_SUCCESS;
@ -1433,14 +1364,14 @@ QDF_STATUS hdd_wlan_shutdown(void)
* Return: QDF_STATUS_SUCCESS if the driver was re-initialized,
* or an error status otherwise
*/
QDF_STATUS hdd_wlan_re_init(void *hif_sc)
QDF_STATUS hdd_wlan_re_init(void)
{
QDF_STATUS qdf_status;
v_CONTEXT_t p_cds_context = NULL;
hdd_context_t *pHddCtx = NULL;
QDF_STATUS qdf_ret_status;
hdd_adapter_t *pAdapter;
int i, ret;
QDF_STATUS qdf_status;
int ret;
hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);
@ -1458,93 +1389,8 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc)
goto err_re_init;
}
if (!hif_sc) {
hdd_alert("hif_sc is NULL");
goto err_re_init;
}
((cds_context_type *) p_cds_context)->pHIFContext = hif_sc;
/* The driver should always be initialized in STA mode after SSR */
hdd_set_conparam(0);
ret = hdd_update_config(pHddCtx);
if (ret)
goto err_re_init;
/* Re-open CDS, it is a re-open b'se control transport was never closed. */
qdf_status = cds_open();
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_alert("cds_open failed");
goto err_re_init;
}
/* Save the hal context in Adapter */
pHddCtx->hHal = cds_get_context(QDF_MODULE_ID_SME);
if (NULL == pHddCtx->hHal) {
hdd_alert("HAL context is null");
goto err_cds_close;
}
qdf_status = cds_pre_enable(pHddCtx->pcds_context);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_alert("cds_pre_enable failed");
goto err_cds_close;
}
/*
* Note that the cds_pre_enable() sequence triggers the cfg download.
* The cfg download must occur before we update the SME config
* since the SME config operation must access the cfg database.
* Set the SME configuration parameters.
*/
qdf_status = hdd_set_sme_config(pHddCtx);
if (QDF_STATUS_SUCCESS != qdf_status) {
hdd_alert("Failed hdd_set_sme_config");
goto err_cds_close;
}
ol_txrx_register_pause_cb(wlan_hdd_txrx_pause_cb);
qdf_status = hdd_set_sme_chan_list(pHddCtx);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_alert("Failed to init channel list");
goto err_cds_close;
}
/* Apply the cfg.ini to cfg.dat */
if (false == hdd_update_config_dat(pHddCtx)) {
hdd_alert("config update failed");
goto err_cds_close;
}
/* Set the MAC Address, currently this is used by HAL to add self sta.
* Remove this once self sta is added as part of session open. */
qdf_ret_status = cfg_set_str(pHddCtx->hHal, WNI_CFG_STA_ID,
(uint8_t *) &pHddCtx->config->
intfMacAddr[0],
sizeof(pHddCtx->config->intfMacAddr[0]));
if (!QDF_IS_STATUS_SUCCESS(qdf_ret_status)) {
hdd_err("Failed to set MAC Address. "
"HALStatus is %08d [x%08x]", qdf_ret_status,
qdf_ret_status);
goto err_cds_close;
}
/* Start CDS which starts up the SME/MAC/HAL modules and everything else
Note: Firmware image will be read and downloaded inside cds_enable API */
qdf_status = cds_enable(p_cds_context);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_alert("cds_enable failed");
goto err_cds_close;
}
qdf_status = hdd_post_cds_enable_config(pHddCtx);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_alert("hdd_post_cds_enable_config failed");
goto err_cds_disable;
}
/* Try to get an adapter from mode ID */
pAdapter = hdd_get_adapter(pHddCtx, QDF_STA_MODE);
if (!pAdapter) {
@ -1560,6 +1406,12 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc)
if (pHddCtx->config->enable_dp_trace)
qdf_dp_trace_init();
ret = hdd_wlan_start_modules(pHddCtx, pAdapter, true);
if (ret) {
hdd_err("Failed to start wlan after error");
goto err_wiphy_unregister;
}
if (hdd_ipa_uc_ssr_reinit())
hdd_err("HDD IPA UC reinit failed");
@ -1568,50 +1420,6 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc)
/* Restart all adapters */
hdd_start_all_adapters(pHddCtx);
/* Reconfigure FW logs after SSR */
if (pAdapter) {
if (pHddCtx->fw_log_settings.enable != 0) {
wma_cli_set_command(pAdapter->sessionId,
WMI_DBGLOG_MODULE_ENABLE,
pHddCtx->fw_log_settings.enable,
DBG_CMD);
} else {
wma_cli_set_command(pAdapter->sessionId,
WMI_DBGLOG_MODULE_DISABLE,
pHddCtx->fw_log_settings.enable,
DBG_CMD);
}
if (pHddCtx->fw_log_settings.dl_report != 0) {
wma_cli_set_command(pAdapter->sessionId,
WMI_DBGLOG_REPORT_ENABLE,
pHddCtx->fw_log_settings.
dl_report, DBG_CMD);
wma_cli_set_command(pAdapter->sessionId,
WMI_DBGLOG_TYPE,
pHddCtx->fw_log_settings.
dl_type, DBG_CMD);
wma_cli_set_command(pAdapter->sessionId,
WMI_DBGLOG_LOG_LEVEL,
pHddCtx->fw_log_settings.
dl_loglevel, DBG_CMD);
for (i = 0; i < MAX_MOD_LOGLEVEL; i++) {
if (pHddCtx->fw_log_settings.
dl_mod_loglevel[i] != 0) {
wma_cli_set_command(
pAdapter->sessionId,
WMI_DBGLOG_MOD_LOG_LEVEL,
pHddCtx->fw_log_settings.
dl_mod_loglevel[i],
DBG_CMD);
}
}
}
}
pHddCtx->hdd_mcastbcast_filter_set = false;
pHddCtx->btCoexModeSet = false;
hdd_ssr_timer_del();
@ -1639,16 +1447,13 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc)
goto success;
err_cds_disable:
cds_disable(p_cds_context);
hdd_wlan_stop_modules(pHddCtx, true);
err_cds_close:
cds_close(p_cds_context);
cds_sched_close(p_cds_context);
err_wiphy_unregister:
if (pHddCtx) {
/* Unregister the Net Device Notifier */
unregister_netdevice_notifier(&hdd_netdev_notifier);
ptt_sock_deactivate_svc();
nl_srv_exit();
/* Free up dynamically allocated members inside HDD Adapter */
@ -1656,13 +1461,7 @@ err_cds_close:
pHddCtx->config = NULL;
wlan_hdd_deinit_tx_rx_histogram(pHddCtx);
wiphy_unregister(pHddCtx->wiphy);
wlan_hdd_cfg80211_deinit(pHddCtx->wiphy);
wiphy_free(pHddCtx->wiphy);
if (!QDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) {
hdd_err("Failed to deinit policy manager");
/* Proceed and complete the clean up */
}
}
err_re_init:
@ -1763,6 +1562,14 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
result = wlan_hdd_validate_context(pHddCtx);
if (0 != result)
return result;
mutex_lock(&pHddCtx->iface_change_lock);
if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
mutex_unlock(&pHddCtx->iface_change_lock);
hdd_info("Driver Module not enabled return success");
return 0;
}
mutex_unlock(&pHddCtx->iface_change_lock);
pld_request_bus_bandwidth(pHddCtx->parent_dev, PLD_BUS_WIDTH_MEDIUM);
/* Resume MC thread */
@ -1897,6 +1704,14 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
if (0 != rc)
return rc;
mutex_lock(&pHddCtx->iface_change_lock);
if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
mutex_unlock(&pHddCtx->iface_change_lock);
hdd_info("Driver Modules not Enabled ");
return 0;
}
mutex_unlock(&pHddCtx->iface_change_lock);
/* If RADAR detection is in progress (HDD), prevent suspend. The flag
* "dfs_cac_block_tx" is set to true when RADAR is found and stay true
* until CAC is done for a SoftAP which is in started state.