summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/hdd/src/wlan_hdd_main.c58
-rw-r--r--core/sap/inc/sap_api.h12
-rw-r--r--core/sap/src/sap_module.c16
-rw-r--r--core/utils/nlink/inc/wlan_nlink_common.h22
4 files changed, 102 insertions, 6 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 8aee60443e85..3dc1d087275c 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -8209,6 +8209,57 @@ static void hdd_restart_sap(hdd_adapter_t *adapter, uint8_t channel)
cds_change_sap_channel_with_csa(adapter, hdd_ap_ctx);
}
+
+/**
+ * hdd_send_svc_coex_info() - set and send coex info to application
+ * @hdd_ctx: pointer to hdd context
+ * @adapter: HDD adapter
+ * @restart_chan: new safe channel which SAP will switch to
+ *
+ * This function set coex info depend on different case, then
+ * send to application
+ *
+ * Return: None
+ */
+static void hdd_send_svc_coex_info(hdd_context_t *hdd_ctx,
+ hdd_adapter_t *adapter,
+ uint8_t restart_chan)
+{
+ struct lte_coex_info coex_info;
+ uint8_t op_chan;
+
+ coex_info.recfg_channel = restart_chan;
+ coex_info.recfg_mode = WLAN_SVC_RECFG_ECSA;
+ op_chan = adapter->sessionCtx.ap.operatingChannel;
+ /*
+ * It needs to restart hostapd to config new safe channel
+ * for following case due to DFS channel limitation.
+ * 1: Only one SAP which is starting on DFS channel but cac
+ * doesn't complete yet, need to check SAP started state
+ * For below two cases, if switch with eCSA mode with one SAP
+ * firstly, it will cause MCC which is forbidden on DFS channel.
+ * 2: SAP+SAP, one SAP started on DFS channel
+ * 3: SAP+SAP, recfg_channel is DFS channel
+ */
+ if (CHANNEL_STATE_DFS == cds_get_channel_state(op_chan)) {
+ if (hdd_get_con_sap_adapter(adapter, true) ||
+ !wlansap_check_sap_started(
+ WLAN_HDD_GET_SAP_CTX_PTR(adapter)))
+ coex_info.recfg_mode = WLAN_SVC_RECFG_RESTART_HOSTAPD;
+ }
+
+ if (CHANNEL_STATE_DFS == cds_get_channel_state(restart_chan) &&
+ hdd_get_con_sap_adapter(adapter, true))
+ coex_info.recfg_mode = WLAN_SVC_RECFG_RESTART_HOSTAPD;
+
+ hdd_debug("sending coex indication with sap recfg channel: %d, "
+ "ecsa mode: %d", coex_info.recfg_channel,
+ coex_info.recfg_mode);
+
+ wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index, WLAN_SVC_LTE_COEX_IND,
+ &coex_info, sizeof(struct lte_coex_info));
+}
+
/**
* hdd_unsafe_channel_restart_sap() - restart sap if sap is on unsafe channel
* @hdd_ctx: hdd context pointer
@@ -8287,9 +8338,8 @@ void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctxt)
hdd_ctxt->acs_policy.acs_channel = AUTO_CHANNEL_SELECT;
adapter_temp->sessionCtx.ap.sapConfig.channel =
AUTO_CHANNEL_SELECT;
- hdd_debug("sending coex indication");
- wlan_hdd_send_svc_nlink_msg(hdd_ctxt->radio_index,
- WLAN_SVC_LTE_COEX_IND, NULL, 0);
+ hdd_send_svc_coex_info(hdd_ctxt, adapter_temp,
+ restart_chan);
hdd_debug("driver to start sap: %d",
hdd_ctxt->config->sap_internal_restart);
if (hdd_ctxt->config->sap_internal_restart)
@@ -11847,7 +11897,6 @@ void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len)
switch (type) {
case WLAN_SVC_FW_CRASHED_IND:
case WLAN_SVC_FW_SHUTDOWN_IND:
- case WLAN_SVC_LTE_COEX_IND:
case WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND:
case WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND:
ani_hdr->length = 0;
@@ -11863,6 +11912,7 @@ void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len)
case WLAN_SVC_WLAN_TP_TX_IND:
case WLAN_SVC_RPS_ENABLE_IND:
case WLAN_SVC_CORE_MINFREQ:
+ case WLAN_SVC_LTE_COEX_IND:
ani_hdr->length = len;
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + len));
nl_data = (char *)ani_hdr + sizeof(tAniMsgHdr);
diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h
index 6de2f4029a3a..c27d9382f2c2 100644
--- a/core/sap/inc/sap_api.h
+++ b/core/sap/inc/sap_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -1046,6 +1046,16 @@ void wlansap_cleanup_cac_timer(void *sap_ctx);
*/
void wlansap_set_stop_bss_inprogress(void *ctx, bool in_progress);
+/**
+ * wlansap_check_sap_started() - Get SAP started state
+ * @sap_ctx: sap context
+ *
+ * This api returns the current SAP started state to the caller.
+ *
+ * Return: true if SAP is started state else return false
+ */
+bool wlansap_check_sap_started(void *sap_ctx);
+
#ifdef __cplusplus
}
#endif
diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c
index 179533f450ee..3721fad5e415 100644
--- a/core/sap/src/sap_module.c
+++ b/core/sap/src/sap_module.c
@@ -3851,3 +3851,19 @@ void wlansap_cleanup_cac_timer(void *sap_ctx)
FL("sapdfs, force cleanup running dfs cac timer"));
}
}
+
+bool wlansap_check_sap_started(void *sap_ctx)
+{
+ ptSapContext psap_ctx = CDS_GET_SAP_CB(sap_ctx);
+
+ if (!psap_ctx) {
+ QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+ FL("Invalid SAP context"));
+ return false;
+ }
+
+ if (psap_ctx->sapsMachine == eSAP_STARTED)
+ return true;
+
+ return false;
+}
diff --git a/core/utils/nlink/inc/wlan_nlink_common.h b/core/utils/nlink/inc/wlan_nlink_common.h
index 12add80eca1c..d3b1bfe7c0b1 100644
--- a/core/utils/nlink/inc/wlan_nlink_common.h
+++ b/core/utils/nlink/inc/wlan_nlink_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -175,6 +175,26 @@ struct wlan_dfs_info {
uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN];
};
+/**
+ * enum wlan_svc_recfg_mode - indicate reconfig channel mode to user
+ * WLAN_SVC_RECFG_RESTART_HOSTAPD: restart hostapd to config channel
+ * WLAN_SVC_RECFG_ECSA: config channel with eCSA mode
+ */
+enum wlan_svc_recfg_mode {
+ WLAN_SVC_RECFG_RESTART_HOSTAPD,
+ WLAN_SVC_RECFG_ECSA,
+};
+
+/**
+ * struct lte_coex_info - msg to indicate lte coex info
+ * @recfg_channel: target channel for SAP to switch to.
+ * @recfg_mode: sap switch channel mode
+ */
+struct lte_coex_info {
+ uint8_t recfg_channel;
+ enum wlan_svc_recfg_mode recfg_mode;
+};
+
/*
* Maximim number of queues supported by WLAN driver. Setting an upper
* limit. Actual number of queues may be smaller than this value.