summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <naveenrawat@codeaurora.org>2016-08-01 15:22:20 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-11 16:49:46 -0700
commit03e8d95c9e5ff42933f7a942dc69ae7a7874fb3a (patch)
treeca15f04c6c026fc96a050bc1947f080f4df56163
parent52b4b703310727b374d96f11f82801d43f5db18d (diff)
qcacld-3.0: Send HT/VHT CAPs IE to firmware per band
Send HT/VHT CAPs IE to firmware per band. This will allow certain features like LDPC to be configured per band. Change-Id: I21c83af984f9be3ade46121ef148b52568c3ad0f CRs-Fixed: 1055774 (cherry picked from commit 2a94c5666ea0c66477d0086c8d5a401db8e4afcf)
-rw-r--r--core/cds/inc/cds_utils.h7
-rw-r--r--core/mac/inc/sir_api.h2
-rw-r--r--core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c5
-rw-r--r--core/mac/src/pe/lim/lim_utils.c188
-rw-r--r--core/mac/src/pe/lim/lim_utils.h12
-rw-r--r--core/wma/src/wma_features.c7
6 files changed, 221 insertions, 0 deletions
diff --git a/core/cds/inc/cds_utils.h b/core/cds/inc/cds_utils.h
index 16d856340699..0a0cef30f7eb 100644
--- a/core/cds/inc/cds_utils.h
+++ b/core/cds/inc/cds_utils.h
@@ -82,7 +82,14 @@
#define cds_debug(format, args...) \
cds_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
+/**
+ * enum cds_band_type - Band type - 2g, 5g or all
+ * CDS_BAND_ALL: Both 2G and 5G are valid.
+ * CDS_BAND_2GHZ: only 2G is valid.
+ * CDS_BAND_5GHZ: only 5G is valid.
+ */
enum cds_band_type {
+ CDS_BAND_ALL = 0,
CDS_BAND_2GHZ = 1,
CDS_BAND_5GHZ = 2
};
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 35b011cb38b5..39182147fd86 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -5329,6 +5329,7 @@ struct fw_dump_rsp {
* @vdev_id - vdev for which the IE is being sent
* @ie_id - ID of the IE
* @length - length of the IE data
+ * @band - indicates IE is intended for which band
* @data - IE data
*
* This structure is used to store the IE information.
@@ -5337,6 +5338,7 @@ struct vdev_ie_info {
uint32_t vdev_id;
uint32_t ie_id;
uint32_t length;
+ uint32_t band;
uint8_t *data;
};
diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
index eed53e74afe1..26da4a71315d 100644
--- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
@@ -2483,6 +2483,11 @@ lim_process_sta_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx,
goto end;
}
+ if (lim_send_ht_vht_ie(mac_ctx, session_entry) !=
+ QDF_STATUS_SUCCESS)
+ lim_log(mac_ctx, LOGE,
+ FL("Unable to send HT/VHT Cap to FW"));
+
/* Set MLME state */
session_entry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE,
diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c
index 84dae0da0b61..758d71bf423c 100644
--- a/core/mac/src/pe/lim/lim_utils.c
+++ b/core/mac/src/pe/lim/lim_utils.c
@@ -57,6 +57,7 @@
#include "lim_session.h"
#include "cds_reg_service.h"
#include "nan_datapath.h"
+#include "wma.h"
#ifdef WLAN_FEATURE_11W
#include "wni_cfg.h"
@@ -6446,6 +6447,192 @@ void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap,
}
/**
+ * lim_send_ie() - sends IE to wma
+ * @mac_ctx: global MAC context
+ * @sme_session_id: sme session id
+ * @eid: IE id
+ * @band: band for which IE is intended
+ * @buf: buffer containing IE
+ * @len: length of buffer
+ *
+ * This funciton sends the IE data to WMA.
+ *
+ * Return: status of operation
+ */
+QDF_STATUS lim_send_ie(tpAniSirGlobal mac_ctx, uint32_t sme_session_id,
+ uint8_t eid, enum cds_band_type band, uint8_t *buf,
+ uint32_t len)
+{
+ struct vdev_ie_info *ie_msg;
+ cds_msg_t msg = {0};
+ QDF_STATUS status;
+
+ /* Allocate memory for the WMI request */
+ ie_msg = qdf_mem_malloc(sizeof(*ie_msg) + len);
+ if (!ie_msg) {
+ lim_log(mac_ctx, LOGE, FL("Failed to allocate memory"));
+ return QDF_STATUS_E_NOMEM;
+ }
+
+ ie_msg->vdev_id = sme_session_id;
+ ie_msg->ie_id = eid;
+ ie_msg->length = len;
+ ie_msg->band = band;
+ /* IE data buffer starts at end of the struct */
+ ie_msg->data = (uint8_t *)&ie_msg[1];
+
+ qdf_mem_copy(ie_msg->data, buf, len);
+ msg.type = WMA_SET_IE_INFO;
+ msg.bodyptr = ie_msg;
+ msg.reserved = 0;
+
+ status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg);
+ if (QDF_STATUS_SUCCESS != status) {
+ lim_log(mac_ctx, LOGE,
+ FL("Not able to post WMA_SET_IE_INFO to WMA"));
+ qdf_mem_free(ie_msg);
+ return status;
+ }
+
+ return status;
+}
+
+/**
+ * lim_populate_ht_caps_from_hw_caps() - gets HTCAPs IE from session, then
+ * updates, HTCAPs 16 bit from hw caps
+ * @mac_ctx: global MAC context
+ * @session: pe session
+ * @ht_caps: HTCAPs struct to populate
+ * @hw_caps: hw caps
+ *
+ * This funciton sends the IE data to WMA.
+ *
+ * Return: status of operation
+ */
+QDF_STATUS lim_populate_ht_caps_from_hw_caps(tpAniSirGlobal mac_ctx,
+ tpPESession session,
+ tDot11fIEHTCaps *ht_caps,
+ uint32_t hw_caps)
+{
+ tSirRetStatus status;
+
+ if (!mac_ctx) {
+ QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+ FL("mac_ctx is NULL"));
+ return QDF_STATUS_E_INVAL;
+ }
+
+ /* following functions that use session can take NULL */
+ status = populate_dot11f_ht_caps(mac_ctx, session, ht_caps);
+ if (eSIR_SUCCESS != status) {
+ lim_log(mac_ctx, LOGE, FL("Failed to populate ht cap IE"));
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ ht_caps->rxSTBC = !!(hw_caps & WMI_HT_CAP_RX_STBC);
+ ht_caps->txSTBC = !!(hw_caps & WMI_HT_CAP_TX_STBC);
+ ht_caps->advCodingCap = !!(hw_caps & WMI_HT_CAP_RX_LDPC);
+ ht_caps->shortGI20MHz = !!(hw_caps & WMI_HT_CAP_HT20_SGI);
+ ht_caps->shortGI40MHz = !!(hw_caps & WMI_HT_CAP_HT40_SGI);
+ return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * lim_populate_vht_caps_from_hw_caps() - gets VHTCAPs IE from session, then
+ * updates, HTCAPs 16 bit from hw caps
+ * @mac_ctx: global MAC context
+ * @session: pe session
+ * @vht_caps: VHTCAPs struct to populate
+ * @hw_caps: hw caps
+ *
+ * This funciton sends the IE data to WMA.
+ *
+ * Return: status of operation
+ */
+QDF_STATUS lim_populate_vht_caps_from_hw_caps(tpAniSirGlobal mac_ctx,
+ tpPESession session,
+ tDot11fIEVHTCaps *vht_caps,
+ uint32_t hw_caps)
+{
+ uint8_t *ie_buff = (uint8_t *)vht_caps;
+ tSirRetStatus status;
+
+ if (!mac_ctx) {
+ QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+ FL("mac_ctx is NULL"));
+ return QDF_STATUS_E_INVAL;
+ }
+
+ /* following functions that use session can take NULL */
+ status = populate_dot11f_vht_caps(mac_ctx, session, vht_caps);
+ if (eSIR_SUCCESS != status) {
+ lim_log(mac_ctx, LOGE, FL("Failed to populate vht cap IE"));
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ *((uint32_t *)(ie_buff + 1)) = hw_caps;
+ return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * lim_send_ht_vht_ie() - gets ht and vht capability and send to firmware via
+ * wma
+ * updates, HTCAPs 16 bit from hw caps
+ * @session: pe session
+ *
+ * This funciton gets ht and vht capability and send to firmware via wma
+ *
+ * Return: status of operation
+ */
+QDF_STATUS lim_send_ht_vht_ie(tpAniSirGlobal mac_ctx, tpPESession session)
+{
+ uint8_t *ie_buff;
+ tDot11fIEHTCaps ht_caps;
+ tDot11fIEVHTCaps vht_caps;
+ struct wma_caps_per_phy caps_2g;
+ struct wma_caps_per_phy caps_5g;
+
+ if (wma_is_dbs_enable()) {
+ wma_get_caps_for_phyidx_hwmode(&caps_2g, HW_MODE_DBS,
+ CDS_BAND_2GHZ);
+ wma_get_caps_for_phyidx_hwmode(&caps_5g, HW_MODE_DBS,
+ CDS_BAND_5GHZ);
+ } else {
+ wma_get_caps_for_phyidx_hwmode(&caps_2g, HW_MODE_DBS_NONE,
+ CDS_BAND_2GHZ);
+ wma_get_caps_for_phyidx_hwmode(&caps_5g, HW_MODE_DBS_NONE,
+ CDS_BAND_5GHZ);
+ }
+ lim_log(mac_ctx, LOG1,
+ FL("HT Caps: 2G: 0x%X, 5G: 0x%X, VHT Caps: 2G: 0x%X, 5G: 0x%X"),
+ caps_2g.ht_2g, caps_5g.ht_5g, caps_2g.vht_2g, caps_5g.vht_5g);
+
+ ie_buff = (uint8_t *)&ht_caps;
+ lim_populate_ht_caps_from_hw_caps(mac_ctx, session,
+ &ht_caps, caps_2g.ht_2g);
+ lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_HTCAPS,
+ CDS_BAND_2GHZ, ie_buff + 1, DOT11F_IE_HTCAPS_MIN_LEN);
+
+ lim_populate_ht_caps_from_hw_caps(mac_ctx, session,
+ &ht_caps, caps_5g.ht_5g);
+ lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_HTCAPS,
+ CDS_BAND_5GHZ, ie_buff + 1, DOT11F_IE_HTCAPS_MIN_LEN);
+
+ ie_buff = (uint8_t *)&vht_caps;
+ lim_populate_vht_caps_from_hw_caps(mac_ctx, session,
+ &vht_caps, caps_2g.vht_2g);
+ lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_VHTCAPS,
+ CDS_BAND_2GHZ, ie_buff + 1, DOT11F_IE_VHTCAPS_MAX_LEN);
+
+ lim_populate_vht_caps_from_hw_caps(mac_ctx, session,
+ &vht_caps, caps_5g.vht_5g);
+ lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_VHTCAPS,
+ CDS_BAND_5GHZ, ie_buff + 1, DOT11F_IE_VHTCAPS_MAX_LEN);
+
+ return QDF_STATUS_SUCCESS;
+}
+
+/**
* lim_send_ext_cap_ie() - send ext cap IE to FW
* @mac_ctx: global MAC context
* @session_entry: PE session
@@ -6500,6 +6687,7 @@ QDF_STATUS lim_send_ext_cap_ie(tpAniSirGlobal mac_ctx,
vdev_ie->vdev_id = session_id;
vdev_ie->ie_id = DOT11F_EID_EXTCAP;
vdev_ie->length = num_bytes;
+ vdev_ie->band = 0;
lim_log(mac_ctx, LOG1, FL("vdev %d ieid %d len %d"), session_id,
DOT11F_EID_EXTCAP, num_bytes);
diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h
index 6854ea0e6279..8cb8b35033d5 100644
--- a/core/mac/src/pe/lim/lim_utils.h
+++ b/core/mac/src/pe/lim/lim_utils.h
@@ -574,6 +574,18 @@ void lim_check_and_reset_protection_params(tpAniSirGlobal mac_ctx);
QDF_STATUS lim_send_ext_cap_ie(tpAniSirGlobal mac_ctx, uint32_t session_id,
tDot11fIEExtCap *extracted_extcap, bool merge);
+QDF_STATUS lim_populate_vht_caps_from_hw_caps(tpAniSirGlobal mac_ctx,
+ tpPESession session,
+ tDot11fIEVHTCaps *vht_caps,
+ uint32_t hw_caps);
+
+QDF_STATUS lim_populate_ht_caps_from_hw_caps(tpAniSirGlobal mac_ctx,
+ tpPESession session,
+ tDot11fIEHTCaps *ht_caps,
+ uint32_t hw_caps);
+
+QDF_STATUS lim_send_ht_vht_ie(tpAniSirGlobal mac_ctx, tpPESession session);
+
tSirRetStatus lim_strip_extcap_ie(tpAniSirGlobal mac_ctx, uint8_t *addn_ie,
uint16_t *addn_ielen, uint8_t *extracted_extcap);
void lim_update_extcap_struct(tpAniSirGlobal mac_ctx, uint8_t *buf,
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 02accd7c0766..a01e5bcbbc36 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -7625,8 +7625,15 @@ QDF_STATUS wma_process_set_ie_info(tp_wma_handle wma,
cmd.vdev_id = ie_info->vdev_id;
cmd.ie_id = ie_info->ie_id;
cmd.length = ie_info->length;
+ cmd.band = ie_info->band;
cmd.data = ie_info->data;
+ WMA_LOGD(FL("ie_id: %d, band: %d, len: %d"),
+ ie_info->ie_id, ie_info->band, ie_info->length);
+
+ QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
+ ie_info->data, ie_info->length);
+
ret = wmi_unified_process_set_ie_info_cmd(wma->wmi_handle,
&cmd);