qcacld-3.0: Implement a generic API to set session param from HDD
Currently, in host driver, ssid hide which is a session specific
parameter is set on reception of corresponding iwpriv command. Driver
would need to handle similar cases of setting session specific parameter
from HDD[ need this for setting ignore assoc disallowed parameter
for MBO].
Modify the ssid hide API's to generic so that the same API can be
used for setting any session specific paramater in future.
Change-Id: I29c62ff4a6f6d9ed1ff4a0f31a82727eb623bfd4
CRs-Fixed: 1072081
diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c
index 85cf180..de59d24 100644
--- a/core/hdd/src/wlan_hdd_hostapd.c
+++ b/core/hdd/src/wlan_hdd_hostapd.c
@@ -2553,13 +2553,13 @@
case QCSAP_PARAM_HIDE_SSID:
{
- QDF_STATUS status = QDF_STATUS_SUCCESS;
- status =
- sme_hide_ssid(hHal, pHostapdAdapter->sessionId,
- set_value);
+ QDF_STATUS status;
+ status = sme_update_session_param(hHal,
+ pHostapdAdapter->sessionId,
+ SIR_PARAM_SSID_HIDDEN, set_value);
if (QDF_STATUS_SUCCESS != status) {
hdd_err("QCSAP_PARAM_HIDE_SSID failed");
- return status;
+ return -EIO;
}
break;
}
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 90eb956..ed3a568 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -2502,12 +2502,29 @@
tSirAPWPSIEs APWPSIEs;
} tSirUpdateAPWPSIEsReq, *tpSirUpdateAPWPSIEsReq;
-typedef struct sSirUpdateParams {
- uint16_t messageType;
+/*
+ * enum sir_update_session_param_type - session param type
+ * @SIR_PARAM_SSID_HIDDEN: ssidHidden parameter
+ */
+enum sir_update_session_param_type {
+ SIR_PARAM_SSID_HIDDEN,
+};
+
+/*
+ * struct sir_update_session_param
+ * @message_type: SME message type
+ * @length: size of struct sir_update_session_param
+ * @session_id: Session ID
+ * @param_type: parameter to be updated
+ * @param_val: Parameter value to update
+ */
+struct sir_update_session_param {
+ uint16_t message_type;
uint16_t length;
- uint8_t sessionId; /* Session ID */
- uint8_t ssidHidden; /* Hide SSID */
-} tSirUpdateParams, *tpSirUpdateParams;
+ uint8_t session_id;
+ uint32_t param_type;
+ uint32_t param_val;
+};
/**
* struct sir_create_session - Used for creating session in monitor mode
diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h
index 264ca2e..09f6cdb 100644
--- a/core/mac/inc/wni_api.h
+++ b/core/mac/inc/wni_api.h
@@ -98,7 +98,7 @@
eWNI_SME_WPS_PBC_PROBE_REQ_IND,
eWNI_SME_SET_APWPARSNIEs_REQ,
eWNI_SME_UPPER_LAYER_ASSOC_CNF,
- eWNI_SME_HIDE_SSID_REQ,
+ eWNI_SME_SESSION_UPDATE_PARAM,
eWNI_SME_CHNG_MCC_BEACON_INTERVAL,
eWNI_SME_REMAIN_ON_CHANNEL_REQ,
eWNI_SME_REMAIN_ON_CHN_RSP,
diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c
index da2898f..4f69616 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -1521,7 +1521,7 @@
case eWNI_SME_GET_ASSOC_STAS_REQ:
case eWNI_SME_TKIP_CNTR_MEAS_REQ:
case eWNI_SME_UPDATE_APWPSIE_REQ:
- case eWNI_SME_HIDE_SSID_REQ:
+ case eWNI_SME_SESSION_UPDATE_PARAM:
case eWNI_SME_GET_WPSPBC_SESSION_REQ:
case eWNI_SME_SET_APWPARSNIEs_REQ:
case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 9aea67e..131ce42 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -4193,46 +4193,76 @@
}
}
-static void __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
+/*
+ * lim_handle_update_ssid_hidden() - Processes SSID hidden update
+ * @mac_ctx: Pointer to global mac context
+ * @session: Pointer to PE session
+ * @ssid_hidden: SSID hidden value to set; 0 - Broadcast SSID,
+ * 1 - Disable broadcast SSID
+ *
+ * Return: None
+ */
+static void lim_handle_update_ssid_hidden(tpAniSirGlobal mac_ctx,
+ tpPESession session, uint8_t ssid_hidden)
{
- tpSirUpdateParams pUpdateParams;
- tpPESession psessionEntry;
-
- PELOG1(lim_log(pMac, LOG1, FL("received HIDE_SSID message")););
-
- if (pMsgBuf == NULL) {
- lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));
- return;
- }
-
- pUpdateParams = (tpSirUpdateParams) pMsgBuf;
-
- psessionEntry = pe_find_session_by_sme_session_id(pMac,
- pUpdateParams->sessionId);
- if (psessionEntry == NULL) {
- lim_log(pMac, LOGW,
- "Session does not exist for given sessionId %d",
- pUpdateParams->sessionId);
- return;
- }
-
- if (psessionEntry->ssidHidden != pUpdateParams->ssidHidden) {
- /* Update the session entry */
- psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
- } else {
- lim_log(pMac, LOG1, FL("Same config already present!"));
+ lim_log(mac_ctx, LOG1, FL("received HIDE_SSID message"));
+ if (ssid_hidden != session->ssidHidden)
+ session->ssidHidden = ssid_hidden;
+ else {
+ lim_log(mac_ctx, LOG1, FL("Same config already present!"));
return;
}
/* Send vdev restart */
- lim_send_vdev_restart(pMac, psessionEntry, pUpdateParams->sessionId);
+ lim_send_vdev_restart(mac_ctx, session, session->smeSessionId);
/* Update beacon */
- sch_set_fixed_beacon_fields(pMac, psessionEntry);
- lim_send_beacon_ind(pMac, psessionEntry);
+ sch_set_fixed_beacon_fields(mac_ctx, session);
+ lim_send_beacon_ind(mac_ctx, session);
return;
-} /*** end __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/
+}
+
+/**
+ * __lim_process_sme_session_update - process SME session update msg
+ *
+ * @mac_ctx: Pointer to global mac context
+ * @msg_buf: Pointer to the received message buffer
+ *
+ * Return: None
+ */
+static void __lim_process_sme_session_update(tpAniSirGlobal mac_ctx,
+ uint32_t *msg_buf)
+{
+ struct sir_update_session_param *msg;
+ tpPESession session;
+
+ if (!msg_buf) {
+ lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL"));
+ return;
+ }
+
+ msg = (struct sir_update_session_param *) msg_buf;
+
+ session = pe_find_session_by_sme_session_id(mac_ctx, msg->session_id);
+ if (!session) {
+ lim_log(mac_ctx, LOGW,
+ "Session does not exist for given sessionId %d",
+ msg->session_id);
+ return;
+ }
+
+ lim_log(mac_ctx, LOG1, FL("received SME Session update for %d val %d"),
+ msg->param_type, msg->param_val);
+ switch (msg->param_type) {
+ case SIR_PARAM_SSID_HIDDEN:
+ lim_handle_update_ssid_hidden(mac_ctx, session, msg->param_val);
+ break;
+ default:
+ lim_log(mac_ctx, LOGE, FL("Unknown session param"));
+ break;
+ }
+}
static void __lim_process_sme_set_wparsni_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
{
@@ -5259,8 +5289,8 @@
lim_process_tkip_counter_measures(pMac, pMsgBuf);
break;
- case eWNI_SME_HIDE_SSID_REQ:
- __lim_process_sme_hide_ssid(pMac, pMsgBuf);
+ case eWNI_SME_SESSION_UPDATE_PARAM:
+ __lim_process_sme_session_update(pMac, pMsgBuf);
break;
case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ:
__lim_process_roam_scan_offload_req(pMac, pMsgBuf);
diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
index bd6bf38..064b174 100644
--- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
+++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
@@ -275,7 +275,7 @@
CASE_RETURN_STRING(eWNI_SME_WPS_PBC_PROBE_REQ_IND);
CASE_RETURN_STRING(eWNI_SME_SET_APWPARSNIEs_REQ);
CASE_RETURN_STRING(eWNI_SME_UPPER_LAYER_ASSOC_CNF);
- CASE_RETURN_STRING(eWNI_SME_HIDE_SSID_REQ);
+ CASE_RETURN_STRING(eWNI_SME_SESSION_UPDATE_PARAM);
CASE_RETURN_STRING(eWNI_SME_CHNG_MCC_BEACON_INTERVAL);
CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHANNEL_REQ);
CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHN_RSP);
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 810a35d..9afb984 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1263,4 +1263,17 @@
uint8_t set_value);
QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id,
uint8_t *ie_data, uint16_t ie_len);
+/**
+ * sme_update_session_param() - API to update PE session param
+ * @hal: HAL handle for device
+ * @session_id: Session ID
+ * @param_type: Param type to be updated
+ * @param_val: Param value to be update
+ *
+ * Note: this setting will not persist over reboots.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id,
+ uint32_t param_type, uint32_t param_val);
#endif /* #if !defined( __SME_API_H ) */
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 9eb816c..20e9db1 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -8361,55 +8361,41 @@
return QDF_STATUS_SUCCESS;
}
-/* ---------------------------------------------------------------------------
-
- \fn sme_hide_ssid
-
- \brief hide/show SSID dynamically. Note: this setting will
- not persist over reboots.
-
- \param hHal
- \param sessionId
- \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
- \- return QDF_STATUS
-
- -------------------------------------------------------------------------------*/
-QDF_STATUS sme_hide_ssid(tHalHandle hHal, uint8_t sessionId, uint8_t ssidHidden)
+QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id,
+ uint32_t param_type, uint32_t param_val)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
- tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+ tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
uint16_t len;
- status = sme_acquire_global_lock(&pMac->sme);
+ status = sme_acquire_global_lock(&mac_ctx->sme);
if (QDF_IS_STATUS_SUCCESS(status)) {
- tpSirUpdateParams pMsg;
- tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
+ struct sir_update_session_param *msg;
+ tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id);
- if (!pSession) {
- sms_log(pMac, LOGE, FL(" session %d not found "),
- sessionId);
- sme_release_global_lock(&pMac->sme);
- return QDF_STATUS_E_FAILURE;
+ if (!session) {
+ sms_log(mac_ctx, LOGE, FL("session %d not found"),
+ session_id);
+ sme_release_global_lock(&mac_ctx->sme);
+ return status;
}
- if (!pSession->sessionActive)
+ if (!session->sessionActive)
QDF_ASSERT(0);
- /* Create the message and send to lim */
- len = sizeof(tSirUpdateParams);
- pMsg = qdf_mem_malloc(len);
- if (NULL == pMsg)
+ len = sizeof(*msg);
+ msg = qdf_mem_malloc(len);
+ if (!msg)
status = QDF_STATUS_E_NOMEM;
else {
- qdf_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
- pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
- pMsg->length = len;
- /* Data starts from here */
- pMsg->sessionId = sessionId;
- pMsg->ssidHidden = ssidHidden;
- status = cds_send_mb_message_to_mac(pMsg);
+ msg->message_type = eWNI_SME_SESSION_UPDATE_PARAM;
+ msg->length = len;
+ msg->session_id = session_id;
+ msg->param_type = param_type;
+ msg->param_val = param_val;
+ status = cds_send_mb_message_to_mac(msg);
}
- sme_release_global_lock(&pMac->sme);
+ sme_release_global_lock(&mac_ctx->sme);
}
return status;
}