qcacld-3.0: Send self HT/VHT caps per band IE at hdd_init_station_mode

In function lim_send_ht_vht_ie per band HE/VHT IE being sent to firmware
are being populated as per hardware mode (DBS/Non-DBS). Change that to
absolute self HT/VHT capability.

Change-Id: I3e74ffb89fcdc2903ecaa3c1bb3e4aeffd4f8f35
CRs-Fixed: 1069032
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 62bdc8a..ee901e6 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -2620,6 +2620,7 @@
 		goto error_sme_open;
 	}
 
+	sme_set_vdev_ies_per_band(hdd_ctx->hHal, adapter->sessionId);
 	/* Register wireless extensions */
 	qdf_ret_status = hdd_register_wext(pWlanDev);
 	if (QDF_STATUS_SUCCESS != qdf_ret_status) {
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 26ce1d4..905187b 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -4795,6 +4795,20 @@
 };
 
 /**
+ * struct sir_set_vdev_ies_per_band
+ * @msg_type: message type
+ * @len: message length
+ * @vdev_id: vdev id
+ *
+ * Message wrapper structure for eWNI_SME_SET_VDEV_IES_PER_BAND.
+ */
+struct sir_set_vdev_ies_per_band {
+	uint16_t msg_type;
+	uint16_t len;
+	uint32_t vdev_id;
+};
+
+/**
  * struct sir_set_ht_vht_cfg - ht, vht IE config
  * @msg_type: message type
  * @len: message length
diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h
index c46cb56..0e30f29 100644
--- a/core/mac/inc/wni_api.h
+++ b/core/mac/inc/wni_api.h
@@ -249,6 +249,7 @@
 	eWNI_SME_TSF_EVENT,
 	eWNI_SME_MON_INIT_SESSION,
 	eWNI_SME_PDEV_SET_HT_VHT_IE,
+	eWNI_SME_SET_VDEV_IES_PER_BAND,
 	eWNI_SME_NDP_INITIATOR_REQ,
 	eWNI_SME_NDP_INITIATOR_RSP,
 	eWNI_SME_NDP_NEW_PEER_IND,
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 2f0c3f4..607b42a 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -1381,6 +1381,7 @@
 		}
 		break;
 	case eWNI_SME_PDEV_SET_HT_VHT_IE:
+	case eWNI_SME_SET_VDEV_IES_PER_BAND:
 	case eWNI_SME_SYS_READY_IND:
 	case eWNI_SME_JOIN_REQ:
 	case eWNI_SME_REASSOC_REQ:
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 cdc4906..6f61dce 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,11 +2483,6 @@
 			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_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 006aaba..ab01850 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
@@ -4962,6 +4962,35 @@
 }
 
 /**
+ * lim_process_set_vdev_ies_per_band() - process the set vdev IE req
+ * @mac_ctx: Pointer to Global MAC structure
+ * @msg_buf: Pointer to the SME message buffer
+ *
+ * This function is called by limProcessMessageQueue(). This function sets the
+ * VDEV IEs to the FW.
+ *
+ * Return: None
+ */
+static void lim_process_set_vdev_ies_per_band(tpAniSirGlobal mac_ctx,
+						uint32_t *msg_buf)
+{
+	struct sir_set_vdev_ies_per_band *p_msg =
+				(struct sir_set_vdev_ies_per_band *)msg_buf;
+
+	if (NULL == p_msg) {
+		lim_log(mac_ctx, LOGE, FL("NULL p_msg"));
+		return;
+	}
+
+	lim_log(mac_ctx, LOG1, FL("rcvd set vdev ie per band req vdev_id = %d"),
+		p_msg->vdev_id);
+	/* intentionally using NULL here so that self capabilty are sent */
+	if (lim_send_ies_per_band(mac_ctx, NULL, p_msg->vdev_id) !=
+			QDF_STATUS_SUCCESS)
+		lim_log(mac_ctx, LOGE, FL("Unable to send HT/VHT Cap to FW"));
+}
+
+/**
  * lim_process_set_pdev_IEs() - process the set pdev IE req
  * @mac_ctx: Pointer to Global MAC structure
  * @msg_buf: Pointer to the SME message buffer
@@ -5285,6 +5314,10 @@
 		break;
 	case eWNI_SME_PDEV_SET_HT_VHT_IE:
 		lim_process_set_pdev_IEs(pMac, pMsgBuf);
+		break;
+	case eWNI_SME_SET_VDEV_IES_PER_BAND:
+		lim_process_set_vdev_ies_per_band(pMac, pMsgBuf);
+		break;
 	case eWNI_SME_NDP_END_REQ:
 	case eWNI_SME_NDP_INITIATOR_REQ:
 	case eWNI_SME_NDP_RESPONDER_REQ:
diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c
index 0643ddc..93408fc 100644
--- a/core/mac/src/pe/lim/lim_send_management_frames.c
+++ b/core/mac/src/pe/lim/lim_send_management_frames.c
@@ -1781,6 +1781,8 @@
 	    mac_ctx->lim.htCapabilityPresentInBeacon) {
 		lim_log(mac_ctx, LOG1, FL("Populate HT Caps in Assoc Request"));
 		populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps);
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+				   &frm->HTCaps, sizeof(frm->HTCaps));
 	}
 	lim_log(mac_ctx, LOG1,
 		FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, short GI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
@@ -1795,6 +1797,8 @@
 	    pe_session->vhtCapabilityPresentInBeacon) {
 		lim_log(mac_ctx, LOG1, FL("Populate VHT IEs in Assoc Request"));
 		populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps);
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+				   &frm->VHTCaps, sizeof(frm->VHTCaps));
 		vht_enabled = true;
 		if (pe_session->enableHtSmps &&
 				!pe_session->supported_nss_1x1) {
diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c
index ad5c53a..1d8edcd 100644
--- a/core/mac/src/pe/lim/lim_utils.c
+++ b/core/mac/src/pe/lim/lim_utils.c
@@ -6498,136 +6498,79 @@
 }
 
 /**
- * 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
+ * lim_get_rx_ldpc() - gets ldpc setting for given channel(band)
+ * @mac_ctx: global mac context
+ * @ch: channel for which ldpc setting is required
  *
- * This funciton sends the IE data to WMA.
- *
- * Return: status of operation
+ * Return: true if enabled and false otherwise
  */
-QDF_STATUS lim_populate_ht_caps_from_hw_caps(tpAniSirGlobal mac_ctx,
-					     tpPESession session,
-					     tDot11fIEHTCaps *ht_caps,
-					     uint32_t hw_caps)
+static inline bool lim_get_rx_ldpc(tpAniSirGlobal mac_ctx, uint8_t ch)
 {
-	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;
+	if (mac_ctx->roam.configParam.rxLdpcEnable &&
+		wma_is_rx_ldpc_supported_for_channel(CDS_CHANNEL_NUM(ch)))
+		return true;
+	else
+		return false;
 }
 
 /**
- * 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
+ * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via
  * wma
- * updates, HTCAPs 16 bit from hw caps
- * @session: pe session
+ * @mac_ctx: global mac context
+ * @session: pe session. This can be NULL. In that case self cap will be sent
+ * @vdev_id: vdev for which IE is targeted
  *
  * 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)
+QDF_STATUS lim_send_ies_per_band(tpAniSirGlobal mac_ctx,
+				 tpPESession session,
+				 uint8_t vdev_id)
 {
-	uint8_t *ie_buff;
-	tDot11fIEHTCaps ht_caps;
-	tDot11fIEVHTCaps vht_caps;
-	struct wma_caps_per_phy caps_2g;
-	struct wma_caps_per_phy caps_5g;
+	uint8_t ht_caps[DOT11F_IE_HTCAPS_MIN_LEN + 2] = {0};
+	uint8_t vht_caps[DOT11F_IE_VHTCAPS_MAX_LEN + 2] = {0};
+	tHtCaps *p_ht_cap = (tHtCaps *)ht_caps;
+	tSirMacVHTCapabilityInfo *p_vht_cap =
+			(tSirMacVHTCapabilityInfo *)vht_caps;
 
-	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);
+	/*
+	 * Note: Do not use Dot11f VHT structure, since 1 byte present flag in
+	 * it is causing weird padding errors. Instead use Sir Mac VHT struct
+	 * to send IE to wma.
+	 */
+	ht_caps[0] = DOT11F_EID_HTCAPS;
+	ht_caps[1] = DOT11F_IE_HTCAPS_MIN_LEN;
+	lim_set_ht_caps(mac_ctx, session, ht_caps,
+			DOT11F_IE_HTCAPS_MIN_LEN + 2);
+	/* Get LDPC and over write for 2G */
+	p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6);
+	lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS,
+		CDS_BAND_2GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN);
+	/*
+	 * Get LDPC and over write for 5G - using channel 64 because it
+	 * is available in all reg domains.
+	 */
+	p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64);
+	lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS,
+		CDS_BAND_5GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN);
 
-	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);
+	vht_caps[0] = DOT11F_EID_VHTCAPS;
+	vht_caps[1] = DOT11F_IE_VHTCAPS_MAX_LEN;
+	/* Get LDPC and over write for 2G */
+	lim_set_vht_caps(mac_ctx, session, vht_caps,
+			 DOT11F_IE_VHTCAPS_MIN_LEN + 2);
+	p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6);
+	lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS,
+			CDS_BAND_2GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_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);
+	/*
+	 * Get LDPC and over write for 5G - using channel 64 because it
+	 * is available in all reg domains.
+	 */
+	p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64);
+	lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS,
+			CDS_BAND_5GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN);
 
 	return QDF_STATUS_SUCCESS;
 }
diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h
index 572d35b..6c26d92 100644
--- a/core/mac/src/pe/lim/lim_utils.h
+++ b/core/mac/src/pe/lim/lim_utils.h
@@ -574,17 +574,8 @@
 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);
+QDF_STATUS lim_send_ies_per_band(tpAniSirGlobal mac_ctx,
+				 tpPESession session, uint8_t vdev_id);
 
 tSirRetStatus lim_strip_extcap_ie(tpAniSirGlobal mac_ctx, uint8_t *addn_ie,
 			  uint16_t *addn_ielen, uint8_t *extracted_extcap);
diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c
index fed09ba..360c76a 100644
--- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c
+++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c
@@ -882,18 +882,18 @@
 	lim_log(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"),
 		pDot11f->vhtLinkAdaptCap);
 	lim_log(pMac, LOG1, FL("rxAntPattern (1): %d"),
-		pDot11f->vhtLinkAdaptCap);
+		pDot11f->rxAntPattern);
 	lim_log(pMac, LOG1, FL("txAntPattern (1): %d"),
-		pDot11f->vhtLinkAdaptCap);
+		pDot11f->txAntPattern);
 	lim_log(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
 	lim_log(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
 	lim_log(pMac, LOG1, FL("rxHighSupDataRate (13): %d"),
 		pDot11f->rxHighSupDataRate);
-	lim_log(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
+	lim_log(pMac, LOG1, FL("reserved2(3): %d"), pDot11f->reserved2);
 	lim_log(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
 	lim_log(pMac, LOG1, FL("txSupDataRate (13): %d"),
 		pDot11f->txSupDataRate);
-	lim_log(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3);
+	lim_log(pMac, LOG1, FL("reserved3 (3): %d"), pDot11f->reserved3);
 #endif /* DUMP_MGMT_CNTNTS */
 }
 
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 5abc5fd..c82450b 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1226,6 +1226,8 @@
 QDF_STATUS sme_create_mon_session(tHalHandle hal_handle, uint8_t *bssid);
 QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal,
 			struct adaptive_dwelltime_params *dwelltime_params);
+
+void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id);
 void sme_set_pdev_ht_vht_ies(tHalHandle hHal, bool enable2x2);
 
 void sme_update_vdev_type_nss(tHalHandle hal, uint8_t max_supp_nss,
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 5ea16ec..0af0db1 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -16268,6 +16268,38 @@
 	}
 	return status;
 }
+
+/**
+ * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev
+ * @hal: Pointer to HAL
+ * @vdev_id: vdev_id for which IE is targeted
+ *
+ * Return: None
+ */
+void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id)
+{
+	tpAniSirGlobal p_mac = PMAC_STRUCT(hal);
+	struct sir_set_vdev_ies_per_band *p_msg;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	p_msg = qdf_mem_malloc(sizeof(*p_msg));
+	if (NULL == p_msg) {
+		sms_log(p_mac, LOGE, FL("mem alloc failed for sme msg"));
+		return;
+	}
+
+	p_msg->vdev_id = vdev_id;
+	p_msg->msg_type = eWNI_SME_SET_VDEV_IES_PER_BAND;
+	p_msg->len = sizeof(*p_msg);
+	sms_log(p_mac, LOG1,
+		FL("sending eWNI_SME_SET_VDEV_IES_PER_BAND: vdev_id: %d "),
+		vdev_id);
+	status = cds_send_mb_message_to_mac(p_msg);
+	if (QDF_STATUS_SUCCESS != status)
+		sms_log(p_mac, LOGE,
+			FL("Send eWNI_SME_SET_VDEV_IES_PER_BAND fail"));
+}
+
 /**
  * sme_set_pdev_ht_vht_ies() - sends the set pdev IE req
  * @hal: Pointer to HAL
@@ -16325,7 +16357,6 @@
 		if (QDF_STATUS_SUCCESS != status) {
 			sms_log(mac_ctx, LOGE, FL(
 					"Send SME_PDEV_SET_HT_VHT_IE fail"));
-			qdf_mem_free(ht_vht_cfg);
 		}
 		sme_release_global_lock(&mac_ctx->sme);
 	}