浏览代码

qcacld-3.0: Keep IBSS code under feature flag in WMA

IBSS code is placed under QCA_IBSS_SUPPORT feature flag.

Change-Id: I08248985dc1a61ce8dce4eea9a6a6b8c01a93ec1
CRs-Fixed: 2525652
Abhishek Ambure 5 年之前
父节点
当前提交
8ed62cb4f0
共有 5 个文件被更改,包括 392 次插入338 次删除
  1. 101 11
      core/wma/inc/wma_internal.h
  2. 2 10
      core/wma/src/wma_data.c
  3. 192 212
      core/wma/src/wma_dev_if.c
  4. 97 98
      core/wma/src/wma_mgmt.c
  5. 0 7
      core/wma/src/wma_power.c

+ 101 - 11
core/wma/inc/wma_internal.h

@@ -541,7 +541,52 @@ struct cdp_vdev *wma_find_vdev_by_id(tp_wma_handle wma, uint8_t vdev_id)
 bool wma_is_vdev_in_ap_mode(tp_wma_handle wma, uint8_t vdev_id);
 
 #ifdef QCA_IBSS_SUPPORT
+/**
+ * wma_is_vdev_in_ibss_mode() - check that vdev is in ibss mode or not
+ * @wma: wma handle
+ * @vdev_id: vdev id
+ *
+ * Helper function to know whether given vdev id
+ * is in IBSS mode or not.
+ *
+ * Return: True/False
+ */
 bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id);
+
+/**
+ * wma_adjust_ibss_heart_beat_timer() - set ibss heart beat timer in fw.
+ * @wma: wma handle
+ * @vdev_id: vdev id
+ * @peer_num_delta: peer number delta value
+ *
+ * Return: none
+ */
+void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
+				      uint8_t vdev_id,
+				      int8_t peer_num_delta);
+
+/**
+ * wma_set_ibss_pwrsave_params() - set ibss power save parameter to fw
+ * @wma: wma handle
+ * @vdev_id: vdev id
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+wma_set_ibss_pwrsave_params(tp_wma_handle wma, uint8_t vdev_id);
+
+/**
+ * wma_ibss_peer_info_event_handler() - IBSS peer info event handler
+ * @handle: wma handle
+ * @data: event data
+ * @len: length of data
+ *
+ * This function handles IBSS peer info event from FW.
+ *
+ * Return: 0 for success or error code
+ */
+int wma_ibss_peer_info_event_handler(void *handle, uint8_t *data,
+				     uint32_t len);
 #else
 /**
  * wma_is_vdev_in_ibss_mode(): dummy function
@@ -555,7 +600,41 @@ bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id)
 {
 	return false;
 }
-#endif
+
+/**
+ * wma_adjust_ibss_heart_beat_timer() - set ibss heart beat timer in fw.
+ * @wma: wma handle
+ * @vdev_id: vdev id
+ * @peer_num_delta: peer number delta value
+ *
+ * This function is dummy
+ *
+ * Return: none
+ */
+static inline void
+wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
+				 uint8_t vdev_id,
+				 int8_t peer_num_delta)
+{
+}
+
+/**
+ * wma_ibss_peer_info_event_handler() - IBSS peer info event handler
+ * @handle: wma handle
+ * @data: event data
+ * @len: length of data
+ *
+ * This function is dummy
+ *
+ * Return: 0 for success or error code
+ */
+static inline int
+wma_ibss_peer_info_event_handler(void *handle, uint8_t *data,
+				 uint32_t len)
+{
+	return 0;
+}
+#endif /* QCA_IBSS_SUPPORT */
 
 /**
  * wma_find_bssid_by_vdev_id() - Get the BSS ID corresponding to the vdev ID
@@ -644,10 +723,31 @@ struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma,
 				    uint8_t type, void *params,
 				    uint32_t timeout);
 
+/**
+ * wma_add_bss() - Add BSS request to fw as per opmode
+ * @wma: wma handle
+ * @params: add bss params
+ *
+ * Return: none
+ */
 void wma_add_bss(tp_wma_handle wma, struct bss_params *params);
 
+/**
+ * wma_add_sta() - process add sta request as per opmode
+ * @wma: wma handle
+ * @add_Sta: add sta params
+ *
+ * Return: none
+ */
 void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta);
 
+/**
+ * wma_delete_sta() - process del sta request as per opmode
+ * @wma: wma handle
+ * @del_sta: delete sta params
+ *
+ * Return: none
+ */
 void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta);
 
 /**
@@ -726,10 +826,6 @@ void wma_update_rts_params(tp_wma_handle wma, uint32_t value);
 
 void wma_update_frag_params(tp_wma_handle wma, uint32_t value);
 
-void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
-				      uint8_t vdev_id,
-				      int8_t peer_num_delta);
-
 #ifdef CRYPTO_SET_KEY_CONVERGED
 static inline void wma_set_stakey(tp_wma_handle wma_handle,
 				  tpSetStaKeyParams key_info)
@@ -811,9 +907,6 @@ QDF_STATUS wma_unified_set_sta_ps_param(wmi_unified_t wmi_handle,
 					    uint32_t vdev_id, uint32_t param,
 					    uint32_t value);
 
-QDF_STATUS
-wma_set_ibss_pwrsave_params(tp_wma_handle wma, uint8_t vdev_id);
-
 QDF_STATUS wma_set_ap_peer_uapsd(tp_wma_handle wma, uint32_t vdev_id,
 				     uint8_t *peer_addr, uint8_t uapsd_value,
 				     uint8_t max_sp);
@@ -932,9 +1025,6 @@ QDF_STATUS wma_set_thermal_mgmt(tp_wma_handle wma_handle,
 int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event,
 					uint32_t len);
 
-int wma_ibss_peer_info_event_handler(void *handle, uint8_t *data,
-					    uint32_t len);
-
 int wma_fast_tx_fail_event_handler(void *handle, uint8_t *data,
 					  uint32_t len);
 

+ 2 - 10
core/wma/src/wma_data.c

@@ -2023,16 +2023,7 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, uint32_t len)
 	return 0;
 }
 
-/**
- * wma_ibss_peer_info_event_handler() - IBSS peer info event handler
- * @handle: wma handle
- * @data: event data
- * @len: length of data
- *
- * This function handles IBSS peer info event from FW.
- *
- * Return: 0 for success or error code
- */
+#ifdef QCA_IBSS_SUPPORT
 int wma_ibss_peer_info_event_handler(void *handle, uint8_t *data,
 					    uint32_t len)
 {
@@ -2130,6 +2121,7 @@ send_response:
 
 	return 0;
 }
+#endif
 
 /**
  * wma_fast_tx_fail_event_handler() -tx failure event handler

+ 192 - 212
core/wma/src/wma_dev_if.c

@@ -137,16 +137,6 @@ bool wma_is_vdev_in_ap_mode(tp_wma_handle wma, uint8_t vdev_id)
 }
 
 #ifdef QCA_IBSS_SUPPORT
-/**
- * wma_is_vdev_in_ibss_mode() - check that vdev is in ibss mode or not
- * @wma: wma handle
- * @vdev_id: vdev id
- *
- * Helper function to know whether given vdev id
- * is in IBSS mode or not.
- *
- * Return: True/False
- */
 bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id)
 {
 	struct wma_txrx_node *intf = wma->interfaces;
@@ -162,6 +152,196 @@ bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id)
 
 	return false;
 }
+
+/**
+ * wma_add_bss_ibss_mode() -  process add bss request in IBSS mode
+ * @wma: wma handle
+ * @add_bss: add bss parameters
+ *
+ * Return: none
+ */
+static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
+{
+	struct cdp_pdev *pdev;
+	struct cdp_vdev *vdev;
+	struct wma_vdev_start_req req;
+	void *peer = NULL;
+	struct wlan_objmgr_vdev *vdev_obj;
+	uint8_t vdev_id, peer_id;
+	QDF_STATUS status;
+	tSetBssKeyParams key_info;
+	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+
+	vdev = wma_find_vdev_by_addr(wma, add_bss->self_mac_addr, &vdev_id);
+	if (!vdev) {
+		WMA_LOGE("%s: vdev not found for vdev id %d.",
+			 __func__, vdev_id);
+		goto send_fail_resp;
+	}
+	WMA_LOGD("%s: add_bss->sessionId = %d", __func__, vdev_id);
+	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+
+	if (!pdev) {
+		WMA_LOGE("%s: Failed to get pdev", __func__);
+		goto send_fail_resp;
+	}
+	wma_set_bss_rate_flags(wma, vdev_id, add_bss);
+
+	/* create ibss bss peer */
+	status = wma_create_peer(wma, pdev, vdev, add_bss->self_mac_addr,
+				 WMI_PEER_TYPE_DEFAULT, vdev_id,
+				 false);
+	if (status != QDF_STATUS_SUCCESS) {
+		WMA_LOGE("%s: Failed to create peer", __func__);
+		goto send_fail_resp;
+	}
+	WMA_LOGA("IBSS BSS peer created with mac %pM",
+		 add_bss->self_mac_addr);
+
+	peer = cdp_peer_find_by_addr(soc, pdev,
+				     add_bss->self_mac_addr,
+				     &peer_id);
+	if (!peer) {
+		WMA_LOGE("%s Failed to find peer %pM", __func__,
+			 add_bss->self_mac_addr);
+		goto send_fail_resp;
+	}
+
+	/* clear leftover ibss keys on bss peer */
+
+	WMA_LOGD("%s: ibss bss key clearing", __func__);
+	qdf_mem_zero(&key_info, sizeof(key_info));
+	key_info.smesessionId = vdev_id;
+	key_info.numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+	qdf_mem_copy(&wma->ibsskey_info, &key_info, sizeof(tSetBssKeyParams));
+
+	/* start ibss vdev */
+
+	add_bss->operMode = BSS_OPERATIONAL_MODE_IBSS;
+	vdev_obj = wma->interfaces[vdev_id].vdev;
+	if (!vdev_obj) {
+		wma_err("vdev not found for id: %d", vdev_id);
+		goto send_fail_resp;
+	}
+	mlme_set_bss_params(vdev_obj, add_bss);
+
+	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
+
+	/*
+	 * If IBSS Power Save is supported by firmware
+	 * set the IBSS power save params to firmware.
+	 */
+	if (wmi_service_enabled(wma->wmi_handle,
+				wmi_service_ibss_pwrsave)) {
+		status = wma_set_ibss_pwrsave_params(wma, vdev_id);
+		if (status != QDF_STATUS_SUCCESS) {
+			WMA_LOGE("%s: Failed to Set IBSS Power Save Params to firmware",
+				 __func__);
+			goto peer_cleanup;
+		}
+	}
+
+	qdf_mem_zero(&req, sizeof(req));
+	req.vdev_id = vdev_id;
+	req.op_chan_freq = add_bss->op_chan_freq;
+	req.chan_width = add_bss->ch_width;
+	req.chan_freq_seg0 = add_bss->chan_freq_seg0;
+	req.chan_freq_seg1 = add_bss->chan_freq_seg1;
+	req.vht_capable = add_bss->vhtCapable;
+#if defined WLAN_FEATURE_VOWIF
+	req.max_txpow = add_bss->maxTxPower;
+#else
+	req.max_txpow = 0;
+#endif /* WLAN_FEATURE_VOWIF */
+	req.beacon_intval = add_bss->beaconInterval;
+	req.dtim_period = add_bss->dtimPeriod;
+	req.hidden_ssid = add_bss->bHiddenSSIDEn;
+	req.is_dfs = add_bss->bSpectrumMgtEnabled;
+	req.oper_mode = BSS_OPERATIONAL_MODE_IBSS;
+	req.ssid.length = add_bss->ssId.length;
+	if (req.ssid.length > 0)
+		qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId,
+			     add_bss->ssId.length);
+
+	if (add_bss->nss == 2) {
+		req.preferred_rx_streams = 2;
+		req.preferred_tx_streams = 2;
+	} else {
+		req.preferred_rx_streams = 1;
+		req.preferred_tx_streams = 1;
+	}
+
+	WMA_LOGD("%s: op_chan_freq %d chan_width %d", __func__,
+		 req.op_chan_freq, req.chan_width);
+	WMA_LOGD("%s: ssid = %s", __func__, req.ssid.ssId);
+
+	status = wma_vdev_start(wma, &req, false);
+	if (status != QDF_STATUS_SUCCESS) {
+		mlme_clear_bss_params(vdev_obj);
+		goto peer_cleanup;
+	}
+
+	/* Initialize protection mode to no protection */
+	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
+				    WMI_VDEV_PARAM_PROTECTION_MODE,
+				    IEEE80211_PROT_NONE);
+	if (QDF_IS_STATUS_ERROR(status))
+		WMA_LOGE("Failed to initialize protection mode");
+
+	return;
+
+peer_cleanup:
+	if (peer)
+		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
+send_fail_resp:
+	add_bss->status = QDF_STATUS_E_FAILURE;
+	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
+}
+
+/**
+ * wma_send_peer_atim_window_len() - send peer atim window length
+ * @wma: wma handle
+ * @add_sta: add sta  parameters
+ *
+ * This API sends the peer Atim Window length if IBSS
+ * power save is enabled by the firmware.
+ *
+ * Return: none
+ */
+static void
+wma_send_peer_atim_window_len(tp_wma_handle wma, tpAddStaParams add_sta)
+{
+	if (wma_is_vdev_in_ibss_mode(wma, add_sta->smesessionId) &&
+	    wmi_service_enabled(wma->wmi_handle,
+				wmi_service_ibss_pwrsave)) {
+		/*
+		 * If ATIM Window is present in the peer
+		 * beacon then send it to firmware else
+		 * configure Zero ATIM Window length to
+		 * firmware.
+		 */
+		if (add_sta->atimIePresent) {
+			wma_set_peer_param(wma, add_sta->staMac,
+					   WMI_PEER_IBSS_ATIM_WINDOW_LENGTH,
+					   add_sta->peerAtimWindowLength,
+					   add_sta->smesessionId);
+		} else {
+			wma_set_peer_param(wma, add_sta->staMac,
+					   WMI_PEER_IBSS_ATIM_WINDOW_LENGTH,
+					   0, add_sta->smesessionId);
+		}
+	}
+}
+#else
+static inline
+void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
+{
+}
+
+static inline void
+wma_send_peer_atim_window_len(tp_wma_handle wma, tpAddStaParams add_sta)
+{
+}
 #endif /* QCA_IBSS_SUPPORT */
 
 /**
@@ -3538,152 +3718,6 @@ send_fail_resp:
 	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
 }
 
-#ifdef QCA_IBSS_SUPPORT
-/**
- * wma_add_bss_ibss_mode() -  process add bss request in IBSS mode
- * @wma: wma handle
- * @add_bss: add bss parameters
- *
- * Return: none
- */
-static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
-{
-	struct cdp_pdev *pdev;
-	struct cdp_vdev *vdev;
-	struct wma_vdev_start_req req;
-	void *peer = NULL;
-	struct wlan_objmgr_vdev *vdev_obj;
-	uint8_t vdev_id, peer_id;
-	QDF_STATUS status;
-	tSetBssKeyParams key_info;
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	vdev = wma_find_vdev_by_addr(wma, add_bss->self_mac_addr, &vdev_id);
-	if (!vdev) {
-		WMA_LOGE("%s: vdev not found for vdev id %d.",
-				__func__, vdev_id);
-		goto send_fail_resp;
-	}
-	WMA_LOGD("%s: add_bss->sessionId = %d", __func__, vdev_id);
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-
-	if (!pdev) {
-		WMA_LOGE("%s: Failed to get pdev", __func__);
-		goto send_fail_resp;
-	}
-	wma_set_bss_rate_flags(wma, vdev_id, add_bss);
-
-	/* create ibss bss peer */
-	status = wma_create_peer(wma, pdev, vdev, add_bss->self_mac_addr,
-				 WMI_PEER_TYPE_DEFAULT, vdev_id,
-				 false);
-	if (status != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("%s: Failed to create peer", __func__);
-		goto send_fail_resp;
-	}
-	WMA_LOGA("IBSS BSS peer created with mac %pM",
-		 add_bss->self_mac_addr);
-
-	peer = cdp_peer_find_by_addr(soc, pdev,
-			add_bss->self_mac_addr, &peer_id);
-	if (!peer) {
-		WMA_LOGE("%s Failed to find peer %pM", __func__,
-			 add_bss->self_mac_addr);
-		goto send_fail_resp;
-	}
-
-	/* clear leftover ibss keys on bss peer */
-
-	WMA_LOGD("%s: ibss bss key clearing", __func__);
-	qdf_mem_zero(&key_info, sizeof(key_info));
-	key_info.smesessionId = vdev_id;
-	key_info.numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
-	qdf_mem_copy(&wma->ibsskey_info, &key_info, sizeof(tSetBssKeyParams));
-
-	/* start ibss vdev */
-
-	add_bss->operMode = BSS_OPERATIONAL_MODE_IBSS;
-	vdev_obj = wma->interfaces[vdev_id].vdev;
-	if (!vdev_obj) {
-		wma_err("vdev not found for id: %d", vdev_id);
-		goto send_fail_resp;
-	}
-	mlme_set_bss_params(vdev_obj, add_bss);
-
-	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
-
-	/*
-	 * If IBSS Power Save is supported by firmware
-	 * set the IBSS power save params to firmware.
-	 */
-	if (wmi_service_enabled(wma->wmi_handle,
-				   wmi_service_ibss_pwrsave)) {
-		status = wma_set_ibss_pwrsave_params(wma, vdev_id);
-		if (status != QDF_STATUS_SUCCESS) {
-			WMA_LOGE("%s: Failed to Set IBSS Power Save Params to firmware",
-				__func__);
-			goto peer_cleanup;
-		}
-	}
-
-	qdf_mem_zero(&req, sizeof(req));
-	req.vdev_id = vdev_id;
-	req.op_chan_freq = add_bss->op_chan_freq;
-	req.chan_width = add_bss->ch_width;
-	req.chan_freq_seg0 = add_bss->chan_freq_seg0;
-	req.chan_freq_seg1 = add_bss->chan_freq_seg1;
-	req.vht_capable = add_bss->vhtCapable;
-#if defined WLAN_FEATURE_VOWIF
-	req.max_txpow = add_bss->maxTxPower;
-#else
-	req.max_txpow = 0;
-#endif /* WLAN_FEATURE_VOWIF */
-	req.beacon_intval = add_bss->beaconInterval;
-	req.dtim_period = add_bss->dtimPeriod;
-	req.hidden_ssid = add_bss->bHiddenSSIDEn;
-	req.is_dfs = add_bss->bSpectrumMgtEnabled;
-	req.oper_mode = BSS_OPERATIONAL_MODE_IBSS;
-	req.ssid.length = add_bss->ssId.length;
-	if (req.ssid.length > 0)
-		qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId,
-			     add_bss->ssId.length);
-
-	if (add_bss->nss == 2) {
-		req.preferred_rx_streams = 2;
-		req.preferred_tx_streams = 2;
-	} else {
-		req.preferred_rx_streams = 1;
-		req.preferred_tx_streams = 1;
-	}
-
-	WMA_LOGD("%s: op_chan_freq %d chan_width %d", __func__,
-		 req.op_chan_freq, req.chan_width);
-	WMA_LOGD("%s: ssid = %s", __func__, req.ssid.ssId);
-
-	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS) {
-		mlme_clear_bss_params(vdev_obj);
-		goto peer_cleanup;
-	}
-
-	/* Initialize protection mode to no protection */
-	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
-					 WMI_VDEV_PARAM_PROTECTION_MODE,
-					 IEEE80211_PROT_NONE);
-	if (QDF_IS_STATUS_ERROR(status))
-		WMA_LOGE("Failed to initialize protection mode");
-
-	return;
-
-peer_cleanup:
-	if (peer)
-		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
-send_fail_resp:
-	add_bss->status = QDF_STATUS_E_FAILURE;
-	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
-}
-#endif /* QCA_IBSS_SUPPORT */
-
 static QDF_STATUS wma_update_iface_params(tp_wma_handle wma,
 					  struct bss_params *add_bss)
 {
@@ -4071,13 +4105,6 @@ send_resp:
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * wma_add_bss() - Add BSS request to fw as per opmode
- * @wma: wma handle
- * @params: add bss params
- *
- * Return: none
- */
 void wma_add_bss(tp_wma_handle wma, struct bss_params *params)
 {
 	WMA_LOGD("%s: add_bss_param.halPersona = %d",
@@ -4090,11 +4117,9 @@ void wma_add_bss(tp_wma_handle wma, struct bss_params *params)
 		wma_add_bss_ap_mode(wma, params);
 		break;
 
-#ifdef QCA_IBSS_SUPPORT
 	case QDF_IBSS_MODE:
 		wma_add_bss_ibss_mode(wma, params);
 		break;
-#endif
 
 	case QDF_NDI_MODE:
 		wma_add_bss_ndi_mode(wma, params);
@@ -4270,34 +4295,8 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 				peer, false);
 		goto send_rsp;
 	}
-#ifdef QCA_IBSS_SUPPORT
-	/*
-	 * In IBSS mode send the peer
-	 * Atim Window length if IBSS
-	 * power save is enabled by the
-	 * firmware.
-	 */
-	if (wma_is_vdev_in_ibss_mode(wma, add_sta->smesessionId) &&
-	    wmi_service_enabled(wma->wmi_handle,
-				   wmi_service_ibss_pwrsave)) {
-		/*
-		 * If ATIM Window is present in the peer
-		 * beacon then send it to firmware else
-		 * configure Zero ATIM Window length to
-		 * firmware.
-		 */
-		if (add_sta->atimIePresent) {
-			wma_set_peer_param(wma, add_sta->staMac,
-					   WMI_PEER_IBSS_ATIM_WINDOW_LENGTH,
-					   add_sta->peerAtimWindowLength,
-					   add_sta->smesessionId);
-		} else {
-			wma_set_peer_param(wma, add_sta->staMac,
-					   WMI_PEER_IBSS_ATIM_WINDOW_LENGTH,
-					   0, add_sta->smesessionId);
-		}
-	}
-#endif
+
+	wma_send_peer_atim_window_len(wma, add_sta);
 	if (add_sta->rmfEnabled)
 		wma_set_peer_pmf_status(wma, add_sta->staMac, true);
 
@@ -5000,13 +4999,6 @@ static void wma_sap_allow_runtime_pm(tp_wma_handle wma)
 	qdf_runtime_pm_allow_suspend(&wma->sap_prevent_runtime_pm_lock);
 }
 
-/**
- * wma_add_sta() - process add sta request as per opmode
- * @wma: wma handle
- * @add_Sta: add sta params
- *
- * Return: none
- */
 void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta)
 {
 	uint8_t oper_mode = BSS_OPERATIONAL_MODE_STA;
@@ -5053,23 +5045,13 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta)
 		break;
 	}
 
-#ifdef QCA_IBSS_SUPPORT
 	/* adjust heart beat thresold timer value for detecting ibss peer
 	 * departure
 	 */
 	if (oper_mode == BSS_OPERATIONAL_MODE_IBSS)
 		wma_adjust_ibss_heart_beat_timer(wma, add_sta->smesessionId, 1);
-#endif
-
 }
 
-/**
- * wma_delete_sta() - process del sta request as per opmode
- * @wma: wma handle
- * @del_sta: delete sta params
- *
- * Return: none
- */
 void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
 {
 	uint8_t oper_mode = BSS_OPERATIONAL_MODE_STA;
@@ -5142,13 +5124,11 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
 		qdf_mem_free(del_sta);
 	}
 
-#ifdef QCA_IBSS_SUPPORT
 	/* adjust heart beat thresold timer value for
 	 * detecting ibss peer departure
 	 */
 	if (oper_mode == BSS_OPERATIONAL_MODE_IBSS)
 		wma_adjust_ibss_heart_beat_timer(wma, smesession_id, -1);
-#endif
 }
 
 void wma_delete_bss_ho_fail(tp_wma_handle wma, uint8_t vdev_id)

+ 97 - 98
core/wma/src/wma_mgmt.c

@@ -2223,14 +2223,6 @@ static uint16_t wma_calc_ibss_heart_beat_timer(int16_t peer_num)
 	return heart_beat_timer[peer_num - 1];
 }
 
-/**
- * wma_adjust_ibss_heart_beat_timer() - set ibss heart beat timer in fw.
- * @wma: wma handle
- * @vdev_id: vdev id
- * @peer_num_delta: peer number delta value
- *
- * Return: none
- */
 void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 				      uint8_t vdev_id,
 				      int8_t peer_num_delta)
@@ -2296,67 +2288,47 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 	WMA_LOGD("Set IBSS link monitor timer: peer_num = %d timer_value = %d",
 		 new_peer_num, new_timer_value_ms);
 }
-#endif /* QCA_IBSS_SUPPORT */
 
-#ifndef CRYPTO_SET_KEY_CONVERGED
-void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
+/**
+ * wma_set_ibsskey_helper() - cached IBSS key in wma handle
+ * @wma_handle: wma handle
+ * @key_info: set bss key info
+ * @peerMacAddr: peer mac address
+ *
+ * Return: none
+ */
+static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
+				   tpSetBssKeyParams key_info,
+				   struct qdf_mac_addr peer_macaddr)
 {
 	struct wma_set_key_params key_params;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint32_t i;
 	uint32_t def_key_idx = 0;
-	uint32_t wlan_opmode;
 	struct cdp_vdev *txrx_vdev;
-	uint8_t *mac_addr;
+	int opmode;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wlan_objmgr_vdev *vdev;
 
-	WMA_LOGD("BSS key setup");
+	WMA_LOGD("BSS key setup for peer");
 	txrx_vdev = wma_find_vdev_by_id(wma_handle, key_info->smesessionId);
 	if (!txrx_vdev) {
 		WMA_LOGE("%s:Invalid vdev handle", __func__);
 		key_info->status = QDF_STATUS_E_FAILURE;
-		goto out;
-	}
-	wlan_opmode = cdp_get_opmode(soc, txrx_vdev);
-
-	/*
-	 * For IBSS, WMI expects the BSS key to be set per peer key
-	 * So cache the BSS key in the wma_handle and re-use it when the
-	 * STA key is been setup for a peer
-	 */
-	if (wlan_op_mode_ibss == wlan_opmode) {
-		key_info->status = QDF_STATUS_SUCCESS;
-		if (wma_handle->ibss_started > 0)
-			goto out;
-		WMA_LOGD("Caching IBSS Key");
-		qdf_mem_copy(&wma_handle->ibsskey_info, key_info,
-			     sizeof(tSetBssKeyParams));
+		return;
 	}
 
+	qdf_mem_zero(&key_params, sizeof(key_params));
+	opmode = cdp_get_opmode(soc, txrx_vdev);
 	qdf_mem_zero(&key_params, sizeof(key_params));
 	key_params.vdev_id = key_info->smesessionId;
 	key_params.key_type = key_info->encType;
 	key_params.singl_tid_rc = key_info->singleTidRc;
 	key_params.unicast = false;
-	if (wlan_opmode == wlan_op_mode_sta) {
-		qdf_mem_copy(key_params.peer_mac,
-			wma_handle->interfaces[key_info->smesessionId].bssid,
-			QDF_MAC_ADDR_SIZE);
-	} else {
-		mac_addr = cdp_get_vdev_mac_addr(soc,
-					txrx_vdev);
-		if (!mac_addr) {
-			WMA_LOGE("%s: mac_addr is NULL for vdev with id %d",
-				 __func__, key_info->smesessionId);
-			goto out;
-		}
-		/* vdev mac address will be passed for all other modes */
-		qdf_mem_copy(key_params.peer_mac, mac_addr,
-			     QDF_MAC_ADDR_SIZE);
-		WMA_LOGD("BSS Key setup with vdev_mac %pM\n",
-			 mac_addr);
-	}
+	ASSERT(wlan_op_mode_ibss == opmode);
+
+	qdf_mem_copy(key_params.peer_mac, peer_macaddr.bytes,
+		     QDF_MAC_ADDR_SIZE);
 
 	if (key_info->numKeys == 0 &&
 	    (key_info->encType == eSIR_ED_WEP40 ||
@@ -2369,7 +2341,7 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 				    &def_key_idx, &key_info->numKeys, vdev);
 		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
 	} else if ((key_info->encType == eSIR_ED_WEP40) ||
-		   (key_info->encType == eSIR_ED_WEP104)) {
+		(key_info->encType == eSIR_ED_WEP104)) {
 		struct wma_txrx_node *intf =
 			&wma_handle->interfaces[key_info->smesessionId];
 		key_params.def_key_idx = intf->wep_default_key_idx;
@@ -2379,16 +2351,8 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 		if (key_params.key_type != eSIR_ED_NONE &&
 		    !key_info->key[i].keyLength)
 			continue;
-		if (key_info->encType == eSIR_ED_WPI) {
-			key_params.key_idx = key_info->key[i].keyId;
-			key_params.def_key_idx = key_info->key[i].keyId;
-		} else
-			key_params.key_idx = key_info->key[i].keyId;
-
+		key_params.key_idx = key_info->key[i].keyId;
 		key_params.key_len = key_info->key[i].keyLength;
-		qdf_mem_copy(key_params.key_rsc,
-				key_info->key[i].keyRsc,
-				WLAN_CRYPTO_RSC_SIZE);
 		if (key_info->encType == eSIR_ED_TKIP) {
 			qdf_mem_copy(key_params.key_data,
 				     key_info->key[i].key, 16);
@@ -2401,75 +2365,88 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 				     (const void *)key_info->key[i].key,
 				     key_info->key[i].keyLength);
 
-		WMA_LOGD("%s: bss key[%d] length %d", __func__, i,
+		WMA_LOGD("%s: peer bcast key[%d] length %d", __func__, i,
 			 key_info->key[i].keyLength);
 
 		status = wma_setup_install_key_cmd(wma_handle, &key_params,
-						   wlan_opmode);
+						   opmode);
 		if (status == QDF_STATUS_E_NOMEM) {
 			WMA_LOGE("%s:Failed to setup install key buf",
 				 __func__);
-			key_info->status = QDF_STATUS_E_NOMEM;
-			goto out;
+			return;
 		} else if (status == QDF_STATUS_E_FAILURE) {
 			WMA_LOGE("%s:Failed to send install key command",
 				 __func__);
-			key_info->status = QDF_STATUS_E_FAILURE;
-			goto out;
 		}
 	}
-
-	wma_handle->ibss_started++;
-	/* TODO: Should we wait till we get HTT_T2H_MSG_TYPE_SEC_IND? */
-	key_info->status = QDF_STATUS_SUCCESS;
-
-	qdf_mem_zero(&key_params, sizeof(struct wma_set_key_params));
-
-out:
-	wma_send_msg_high_priority(wma_handle, WMA_SET_BSSKEY_RSP,
-				   (void *)key_info, 0);
 }
+#else
+static inline
+void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
+			    tpSetBssKeyParams key_info,
+			    struct qdf_mac_addr peer_macaddr)
+{
+}
+#endif /* QCA_IBSS_SUPPORT */
 
-/**
- * wma_set_ibsskey_helper() - cached IBSS key in wma handle
- * @wma_handle: wma handle
- * @key_info: set bss key info
- * @peerMacAddr: peer mac address
- *
- * Return: none
- */
-static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
-				   tpSetBssKeyParams key_info,
-				   struct qdf_mac_addr peer_macaddr)
+#ifndef CRYPTO_SET_KEY_CONVERGED
+void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 {
 	struct wma_set_key_params key_params;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint32_t i;
 	uint32_t def_key_idx = 0;
+	uint32_t wlan_opmode;
 	struct cdp_vdev *txrx_vdev;
-	int opmode;
+	uint8_t *mac_addr;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wlan_objmgr_vdev *vdev;
 
-	WMA_LOGD("BSS key setup for peer");
+	WMA_LOGD("BSS key setup");
 	txrx_vdev = wma_find_vdev_by_id(wma_handle, key_info->smesessionId);
 	if (!txrx_vdev) {
 		WMA_LOGE("%s:Invalid vdev handle", __func__);
 		key_info->status = QDF_STATUS_E_FAILURE;
-		return;
+		goto out;
+	}
+	wlan_opmode = cdp_get_opmode(soc, txrx_vdev);
+
+	/*
+	 * For IBSS, WMI expects the BSS key to be set per peer key
+	 * So cache the BSS key in the wma_handle and re-use it when the
+	 * STA key is been setup for a peer
+	 */
+	if (wlan_op_mode_ibss == wlan_opmode) {
+		key_info->status = QDF_STATUS_SUCCESS;
+		if (wma_handle->ibss_started > 0)
+			goto out;
+		WMA_LOGD("Caching IBSS Key");
+		qdf_mem_copy(&wma_handle->ibsskey_info, key_info,
+			     sizeof(tSetBssKeyParams));
 	}
 
-	qdf_mem_zero(&key_params, sizeof(key_params));
-	opmode = cdp_get_opmode(soc, txrx_vdev);
 	qdf_mem_zero(&key_params, sizeof(key_params));
 	key_params.vdev_id = key_info->smesessionId;
 	key_params.key_type = key_info->encType;
 	key_params.singl_tid_rc = key_info->singleTidRc;
 	key_params.unicast = false;
-	ASSERT(wlan_op_mode_ibss == opmode);
-
-	qdf_mem_copy(key_params.peer_mac, peer_macaddr.bytes,
+	if (wlan_opmode == wlan_op_mode_sta) {
+		qdf_mem_copy(key_params.peer_mac,
+			wma_handle->interfaces[key_info->smesessionId].bssid,
 			QDF_MAC_ADDR_SIZE);
+	} else {
+		mac_addr = cdp_get_vdev_mac_addr(soc, txrx_vdev);
+		if (!mac_addr) {
+			WMA_LOGE("%s: mac_addr is NULL for vdev with id %d",
+				 __func__, key_info->smesessionId);
+			goto out;
+		}
+		/* vdev mac address will be passed for all other modes */
+		qdf_mem_copy(key_params.peer_mac, mac_addr,
+			     QDF_MAC_ADDR_SIZE);
+		WMA_LOGD("BSS Key setup with vdev_mac %pM\n",
+			 mac_addr);
+	}
 
 	if (key_info->numKeys == 0 &&
 	    (key_info->encType == eSIR_ED_WEP40 ||
@@ -2482,7 +2459,7 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
 				    &def_key_idx, &key_info->numKeys, vdev);
 		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
 	} else if ((key_info->encType == eSIR_ED_WEP40) ||
-		(key_info->encType == eSIR_ED_WEP104)) {
+		   (key_info->encType == eSIR_ED_WEP104)) {
 		struct wma_txrx_node *intf =
 			&wma_handle->interfaces[key_info->smesessionId];
 		key_params.def_key_idx = intf->wep_default_key_idx;
@@ -2492,8 +2469,17 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
 		if (key_params.key_type != eSIR_ED_NONE &&
 		    !key_info->key[i].keyLength)
 			continue;
-		key_params.key_idx = key_info->key[i].keyId;
+		if (key_info->encType == eSIR_ED_WPI) {
+			key_params.key_idx = key_info->key[i].keyId;
+			key_params.def_key_idx = key_info->key[i].keyId;
+		} else {
+			key_params.key_idx = key_info->key[i].keyId;
+		}
+
 		key_params.key_len = key_info->key[i].keyLength;
+		qdf_mem_copy(key_params.key_rsc,
+			     key_info->key[i].keyRsc,
+			     WLAN_CRYPTO_RSC_SIZE);
 		if (key_info->encType == eSIR_ED_TKIP) {
 			qdf_mem_copy(key_params.key_data,
 				     key_info->key[i].key, 16);
@@ -2506,20 +2492,33 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
 				     (const void *)key_info->key[i].key,
 				     key_info->key[i].keyLength);
 
-		WMA_LOGD("%s: peer bcast key[%d] length %d", __func__, i,
+		WMA_LOGD("%s: bss key[%d] length %d", __func__, i,
 			 key_info->key[i].keyLength);
 
 		status = wma_setup_install_key_cmd(wma_handle, &key_params,
-						   opmode);
+						   wlan_opmode);
 		if (status == QDF_STATUS_E_NOMEM) {
 			WMA_LOGE("%s:Failed to setup install key buf",
 				 __func__);
-			return;
+			key_info->status = QDF_STATUS_E_NOMEM;
+			goto out;
 		} else if (status == QDF_STATUS_E_FAILURE) {
 			WMA_LOGE("%s:Failed to send install key command",
 				 __func__);
+			key_info->status = QDF_STATUS_E_FAILURE;
+			goto out;
 		}
 	}
+
+	wma_handle->ibss_started++;
+	/* TODO: Should we wait till we get HTT_T2H_MSG_TYPE_SEC_IND? */
+	key_info->status = QDF_STATUS_SUCCESS;
+
+	qdf_mem_zero(&key_params, sizeof(struct wma_set_key_params));
+
+out:
+	wma_send_msg_high_priority(wma_handle, WMA_SET_BSSKEY_RSP,
+				   (void *)key_info, 0);
 }
 
 void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info)

+ 0 - 7
core/wma/src/wma_power.c

@@ -126,13 +126,6 @@ QDF_STATUS wma_unified_set_sta_ps_param(wmi_unified_t wmi_handle,
 }
 
 #ifdef QCA_IBSS_SUPPORT
-/**
- * wma_set_ibss_pwrsave_params() - set ibss power save parameter to fw
- * @wma: wma handle
- * @vdev_id: vdev id
- *
- * Return: 0 for success or error code.
- */
 QDF_STATUS
 wma_set_ibss_pwrsave_params(tp_wma_handle wma, uint8_t vdev_id)
 {