summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Kondabattini <ganeshk@codeaurora.org>2017-10-04 21:19:25 +0530
committerGanesh Kondabattini <ganeshk@codeaurora.org>2017-10-13 11:24:41 +0530
commit6097a3c588a6356caac01e49e25be30d2adaa300 (patch)
tree343ada8d63ff41e775c548841111cf6c9c83841a
parent9bba98ddc3f739f22b38a5ef6040d65b85ba8644 (diff)
qcacld-3.0: Send limit off channel command through SME
HDD is not aware of underlying the messaging system so it should not send a message to WMA directly. HDD should always call SME API to interact with underlying layers. CRs-Fixed: 2117199 Change-Id: I02bbd00f9be8a87392500d253537e5525d8df1c3
-rw-r--r--core/hdd/src/wlan_hdd_main.c73
-rw-r--r--core/sme/inc/sme_api.h17
-rw-r--r--core/sme/src/common/sme_api.c33
3 files changed, 70 insertions, 53 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 7336206c546e..e074ceb5f824 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -12123,29 +12123,6 @@ int hdd_get_rssi_snr_by_bssid(hdd_adapter_t *adapter, const uint8_t *bssid,
}
/**
- * hdd_send_limit_off_chan_cmd() - send limit off-channel command parameters
- * @param - pointer to sir_limit_off_chan
- *
- * Return: 0 on success and non zero value on failure
- */
-static int hdd_send_limit_off_chan_cmd(struct sir_limit_off_chan *param)
-{
- cds_msg_t msg = {0};
- QDF_STATUS status;
-
- msg.type = SIR_HAL_SET_LIMIT_OFF_CHAN;
- msg.reserved = 0;
- msg.bodyptr = param;
-
- status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg);
- if (status != QDF_STATUS_SUCCESS) {
- hdd_err("Not able to post limit off chan param message to WMA");
- return -EIO;
- }
- return 0;
-}
-
-/**
* hdd_set_limit_off_chan_for_tos() - set limit off-channel command parameters
* @adapter - HDD adapter
* @tos - type of service
@@ -12158,9 +12135,11 @@ int hdd_set_limit_off_chan_for_tos(hdd_adapter_t *adapter, enum tos tos,
bool is_tos_active)
{
int ac_bit;
- struct sir_limit_off_chan *cmd;
hdd_context_t *hdd_ctx;
int ret;
+ uint32_t max_off_chan_time = 0;
+ QDF_STATUS status;
+ tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
ret = wlan_hdd_validate_context(hdd_ctx);
@@ -12170,12 +12149,6 @@ int hdd_set_limit_off_chan_for_tos(hdd_adapter_t *adapter, enum tos tos,
return ret;
}
- cmd = qdf_mem_malloc(sizeof(struct sir_limit_off_chan));
- if (!cmd) {
- hdd_err("qdf_mem_malloc failed for limit off channel");
- return -ENOMEM;
- }
-
ac_bit = limit_off_chan_tbl[tos][HDD_AC_BIT_INDX];
if (is_tos_active)
@@ -12188,11 +12161,11 @@ int hdd_set_limit_off_chan_for_tos(hdd_adapter_t *adapter, enum tos tos,
if (adapter->active_ac) {
if (adapter->active_ac & HDD_AC_VO_BIT) {
- cmd->max_off_chan_time =
+ max_off_chan_time =
limit_off_chan_tbl[TOS_VO][HDD_DWELL_TIME_INDX];
cds_set_cur_conc_system_pref(CDS_LATENCY);
} else if (adapter->active_ac & HDD_AC_VI_BIT) {
- cmd->max_off_chan_time =
+ max_off_chan_time =
limit_off_chan_tbl[TOS_VI][HDD_DWELL_TIME_INDX];
cds_set_cur_conc_system_pref(CDS_LATENCY);
} else {
@@ -12206,14 +12179,13 @@ int hdd_set_limit_off_chan_for_tos(hdd_adapter_t *adapter, enum tos tos,
cds_set_cur_conc_system_pref(hdd_ctx->config->conc_system_pref);
}
- cmd->vdev_id = adapter->sessionId;
- cmd->is_tos_active = is_tos_active;
- cmd->rest_time = hdd_ctx->config->nRestTimeConc;
- cmd->skip_dfs_chans = true;
-
- ret = hdd_send_limit_off_chan_cmd(cmd);
- if (ret)
- qdf_mem_free(cmd);
+ status = sme_send_limit_off_channel_params(hal, adapter->sessionId,
+ is_tos_active, max_off_chan_time,
+ hdd_ctx->config->nRestTimeConc, true);
+ if (!QDF_IS_STATUS_SUCCESS(status)) {
+ hdd_err("failed to set limit off chan params");
+ ret = -EINVAL;
+ }
return ret;
}
@@ -12227,9 +12199,10 @@ int hdd_set_limit_off_chan_for_tos(hdd_adapter_t *adapter, enum tos tos,
int hdd_reset_limit_off_chan(hdd_adapter_t *adapter)
{
- struct sir_limit_off_chan *cmd;
hdd_context_t *hdd_ctx;
int ret;
+ QDF_STATUS status;
+ tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
ret = wlan_hdd_validate_context(hdd_ctx);
@@ -12237,12 +12210,6 @@ int hdd_reset_limit_off_chan(hdd_adapter_t *adapter)
if (ret < 0)
return ret;
- cmd = qdf_mem_malloc(sizeof(struct sir_limit_off_chan));
- if (!cmd) {
- hdd_err("qdf_mem_malloc failed for limit off channel");
- return -ENOMEM;
- }
-
cds_set_cur_conc_system_pref(hdd_ctx->config->conc_system_pref);
/* clear the bitmap */
@@ -12251,12 +12218,12 @@ int hdd_reset_limit_off_chan(hdd_adapter_t *adapter)
hdd_debug("reset ac_bitmap for session %hu active_ac %0x",
adapter->sessionId, adapter->active_ac);
- cmd->vdev_id = adapter->sessionId;
- cmd->is_tos_active = false;
-
- ret = hdd_send_limit_off_chan_cmd(cmd);
- if (ret)
- qdf_mem_free(cmd);
+ status = sme_send_limit_off_channel_params(hal, adapter->sessionId,
+ false, 0, 0, false);
+ if (!QDF_IS_STATUS_SUCCESS(status)) {
+ hdd_err("failed to reset limit off chan params");
+ ret = -EINVAL;
+ }
return ret;
}
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 572a2bcfb962..6b41f561c9e9 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1910,4 +1910,21 @@ void sme_display_disconnect_stats(tHalHandle hal, uint8_t session_id);
*/
QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap);
+/*
+ * sme_send_limit_off_channel_params() - send limit off channel parameters
+ * @hal: global hal handle
+ * @vdev_id: vdev id
+ * @is_tos_active: tos active or inactive
+ * @max_off_chan_time: max off channel time
+ * @rest_time: rest time
+ * @skip_dfs_chan: skip dfs channel
+ *
+ * This function sends command to WMA for setting limit off channel command
+ * parameters.
+ *
+ * Return: QDF_STATUS enumeration.
+ */
+QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id,
+ bool is_tos_active, uint32_t max_off_chan_time,
+ uint32_t rest_time, bool skip_dfs_chan);
#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 1f0b1f838602..fa8094b347ca 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -18615,3 +18615,36 @@ void sme_display_disconnect_stats(tHalHandle hal, uint8_t session_id)
sme_debug("No. of Disconnections due to Peer Kickout: %d",
session->disconnect_stats.peer_kickout);
}
+
+QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id,
+ bool is_tos_active, uint32_t max_off_chan_time,
+ uint32_t rest_time, bool skip_dfs_chan)
+{
+ struct sir_limit_off_chan *cmd;
+ cds_msg_t msg;
+
+ cmd = qdf_mem_malloc(sizeof(*cmd));
+ if (!cmd) {
+ sme_err("qdf_mem_malloc failed for limit off channel");
+ return QDF_STATUS_E_NOMEM;
+ }
+
+ cmd->vdev_id = vdev_id;
+ cmd->is_tos_active = is_tos_active;
+ cmd->max_off_chan_time = max_off_chan_time;
+ cmd->rest_time = rest_time;
+ cmd->skip_dfs_chans = skip_dfs_chan;
+
+ msg.type = WMA_SET_LIMIT_OFF_CHAN;
+ msg.reserved = 0;
+ msg.bodyptr = (void *) cmd;
+
+ if (QDF_STATUS_SUCCESS !=
+ cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) {
+ sme_err("Failed to post WMA_SET_LIMIT_OFF_CHAN to WMA");
+ qdf_mem_free(cmd);
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ return QDF_STATUS_SUCCESS;
+}