Browse Source

qcacld-3.0: Clean up struct wma_txrx_node unused members

As a part of vdev convergence, struct wma_tx_rx_node's bssid & addr
members are no more unused. These values are derived from mlme_obj.

So no more used members of struct wma_txrx_node are cleaned.

Change-Id: I2462a25f91b66b9efac42935a599f1362cb268f1
CRs-Fixed: 2532061
Abhishek Ambure 5 years ago
parent
commit
3ee80888e3

+ 23 - 4
core/wma/inc/wma.h

@@ -676,8 +676,6 @@ struct roam_synch_frame_ind {
 /**
  * struct wma_txrx_node - txrx node
  * @vdev: pointer to vdev object
- * @addr: mac address
- * @bssid: bssid
  * @handle: wma handle
  * @beacon: beacon info
  * @config: per vdev config parameters
@@ -735,8 +733,6 @@ struct roam_synch_frame_ind {
  */
 struct wma_txrx_node {
 	struct wlan_objmgr_vdev *vdev;
-	uint8_t addr[QDF_MAC_ADDR_SIZE];
-	uint8_t bssid[QDF_MAC_ADDR_SIZE];
 	struct cdp_vdev *handle;
 	struct beacon_info *beacon;
 	vdev_cli_config_t config;
@@ -1525,6 +1521,14 @@ enum uapsd_ac {
 	UAPSD_VO
 };
 
+/**
+ * wma_disable_uapsd_per_ac() - disable uapsd per ac
+ * @wmi_handle: wma handle
+ * @vdev_id: vdev id
+ * @ac: access category
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
 QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
 				    uint32_t vdev_id, enum uapsd_ac ac);
 
@@ -1597,6 +1601,21 @@ A_UINT32 e_csr_auth_type_to_rsn_authmode(enum csr_akm_type authtype,
 					 eCsrEncryptionType encr);
 A_UINT32 e_csr_encryption_type_to_rsn_cipherset(eCsrEncryptionType encr);
 
+/**
+ * wma_trigger_uapsd_params() - set trigger uapsd parameter
+ * @wmi_handle: wma handle
+ * @vdev_id: vdev id
+ * @trigger_uapsd_params: trigger uapsd parameters
+ *
+ * This function sets the trigger uapsd
+ * params such as service interval, delay
+ * interval and suspend interval which
+ * will be used by the firmware to send
+ * trigger frames periodically when there
+ * is no traffic on the transmit side.
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
 QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
 				    tp_wma_trigger_uapsd_params
 				    trigger_uapsd_params);

+ 6 - 0
core/wma/inc/wma_api.h

@@ -154,6 +154,12 @@ QDF_STATUS wma_get_link_speed(WMA_HANDLE handle,
 QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
 #endif
 
+/**
+ * wma_get_vdev_address_by_vdev_id() - lookup MAC address from vdev ID
+ * @vdev_id: vdev id
+ *
+ * Return: mac address
+ */
 uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id);
 struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id);
 QDF_STATUS wma_get_connection_info(uint8_t vdev_id,

+ 53 - 1
core/wma/inc/wma_internal.h

@@ -516,6 +516,14 @@ static inline bool wma_is_roam_synch_in_progress(tp_wma_handle wma,
  * wma_dev_if.c functions declarations
  */
 
+/**
+ * wma_find_vdev_by_addr() - find vdev_id from mac address
+ * @wma: wma handle
+ * @addr: mac address
+ * @vdev_id: return vdev_id
+ *
+ * Return: Returns vdev handle or NULL if mac address don't match
+ */
 struct cdp_vdev *wma_find_vdev_by_addr(tp_wma_handle wma, uint8_t *addr,
 				   uint8_t *vdev_id);
 
@@ -634,6 +642,16 @@ wma_ibss_peer_info_event_handler(void *handle, uint8_t *data,
 }
 #endif /* QCA_IBSS_SUPPORT */
 
+/**
+ * wma_get_vdev_bssid() - Get BSSID from mlme_obj
+ * @vdev - pointer to vdev
+ *
+ * This API is used to get BSSID stored in vdev mlme object.
+ *
+ * Return: pointer to bssid on success else NULL.
+ */
+uint8_t *wma_get_vdev_bssid(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wma_find_bssid_by_vdev_id() - Get the BSS ID corresponding to the vdev ID
  * @wma - wma handle
@@ -648,9 +666,17 @@ static inline uint8_t *wma_find_bssid_by_vdev_id(tp_wma_handle wma,
 	if (vdev_id >= wma->max_bssid)
 		return NULL;
 
-	return wma->interfaces[vdev_id].bssid;
+	return wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
 }
 
+/**
+ * wma_find_vdev_by_bssid() - Get the corresponding vdev_id from BSSID
+ * @wma - wma handle
+ * @vdev_id - vdev ID
+ *
+ * Return: fill vdev_id with appropriate vdev id and return vdev
+ *         handle or NULL if not found.
+ */
 struct cdp_vdev *wma_find_vdev_by_bssid(tp_wma_handle wma, uint8_t *bssid,
 				    uint8_t *vdev_id);
 
@@ -787,6 +813,18 @@ uint32_t wma_get_bcn_rate_code(uint16_t rate);
 int wma_beacon_swba_handler(void *handle, uint8_t *event, uint32_t len);
 #endif
 
+/**
+ * wma_peer_sta_kickout_event_handler() - kickout event handler
+ * @handle: wma handle
+ * @event: event data
+ * @len: data length
+ *
+ * Kickout event is received from firmware on observing beacon miss
+ * It handles kickout event for different modes and indicate to
+ * upper layers.
+ *
+ * Return: 0 for success or error code
+ */
 int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 				       uint32_t len);
 
@@ -1041,12 +1079,26 @@ int wma_smps_mode_to_force_mode_param(uint8_t smps_mode);
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 void wma_register_ll_stats_event_handler(tp_wma_handle wma_handle);
 
+/**
+ * wma_process_ll_stats_clear_req() - clear link layer stats
+ * @wma: wma handle
+ * @clearReq: ll stats clear request command params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
 QDF_STATUS wma_process_ll_stats_clear_req
 	(tp_wma_handle wma, const tpSirLLStatsClearReq clearReq);
 
 QDF_STATUS wma_process_ll_stats_set_req
 	(tp_wma_handle wma, const tpSirLLStatsSetReq setReq);
 
+/**
+ * wma_process_ll_stats_get_req() - link layer stats get request
+ * @wma:wma handle
+ * @getReq:ll stats get request command params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
 QDF_STATUS wma_process_ll_stats_get_req
 	(tp_wma_handle wma, const tpSirLLStatsGetReq getReq);
 

+ 8 - 1
core/wma/inc/wma_types.h

@@ -647,7 +647,14 @@ QDF_STATUS
 wma_ds_peek_rx_packet_info
 	(cds_pkt_t *vosDataBuff, void **ppRxHeader, bool bSwap);
 
-
+/**
+ * wma_tx_abort() - abort tx
+ * @vdev_id: vdev id
+ *
+ * In case of deauth host abort transmitting packet.
+ *
+ * Return: none
+ */
 void wma_tx_abort(uint8_t vdev_id);
 
 /**

+ 19 - 11
core/wma/src/wma_data.c

@@ -2945,6 +2945,7 @@ void ol_rx_err(void *pdev, uint8_t vdev_id,
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	struct mic_failure_ind *mic_err_ind;
 	qdf_ether_header_t *eth_hdr;
+	uint8_t *bssid;
 	struct scheduler_msg cds_msg = {0};
 
 	if (!wma)
@@ -2963,8 +2964,15 @@ void ol_rx_err(void *pdev, uint8_t vdev_id,
 	mic_err_ind->messageType = eWNI_SME_MIC_FAILURE_IND;
 	mic_err_ind->length = sizeof(*mic_err_ind);
 	mic_err_ind->sessionId = vdev_id;
+	bssid = wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		qdf_mem_free((void *)mic_err_ind);
+		return;
+	}
 	qdf_copy_macaddr(&mic_err_ind->bssId,
-		     (struct qdf_mac_addr *) &wma->interfaces[vdev_id].bssid);
+		     (struct qdf_mac_addr *)bssid);
 	qdf_mem_copy(mic_err_ind->info.taMacAddr,
 		     (struct qdf_mac_addr *) peer_mac_addr,
 			sizeof(tSirMacAddr));
@@ -2994,20 +3002,13 @@ void ol_rx_err(void *pdev, uint8_t vdev_id,
 	}
 }
 
-/**
- * wma_tx_abort() - abort tx
- * @vdev_id: vdev id
- *
- * In case of deauth host abort transmitting packet.
- *
- * Return: none
- */
 void wma_tx_abort(uint8_t vdev_id)
 {
 #define PEER_ALL_TID_BITMASK 0xffffffff
 	tp_wma_handle wma;
 	uint32_t peer_tid_bitmap = PEER_ALL_TID_BITMASK;
 	struct wma_txrx_node *iface;
+	uint8_t *bssid;
 	struct peer_flush_params param = {0};
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
@@ -3020,7 +3021,14 @@ void wma_tx_abort(uint8_t vdev_id)
 			 __func__, iface->handle);
 		return;
 	}
-	WMA_LOGD("%s: vdevid %d bssid %pM", __func__, vdev_id, iface->bssid);
+	bssid = wma_get_vdev_bssid(iface->vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		return;
+	}
+
+	WMA_LOGD("%s: vdevid %d bssid %pM", __func__, vdev_id, bssid);
 	wma_vdev_set_pause_bit(vdev_id, PAUSE_TYPE_HOST);
 	cdp_fc_vdev_pause(cds_get_context(QDF_MODULE_ID_SOC),
 			iface->handle,
@@ -3030,7 +3038,7 @@ void wma_tx_abort(uint8_t vdev_id)
 	peer_tid_bitmap &= ~(0x1 << WMI_MGMT_TID);
 	param.peer_tid_bitmap = peer_tid_bitmap;
 	param.vdev_id = vdev_id;
-	wmi_unified_peer_flush_tids_send(wma->wmi_handle, iface->bssid,
+	wmi_unified_peer_flush_tids_send(wma->wmi_handle, bssid,
 					 &param);
 }
 

+ 91 - 44
core/wma/src/wma_dev_if.c

@@ -85,23 +85,20 @@
 #include "../../core/src/vdev_mgr_ops.h"
 #include "wlan_utility.h"
 
-/**
- * wma_find_vdev_by_addr() - find vdev_id from mac address
- * @wma: wma handle
- * @addr: mac address
- * @vdev_id: return vdev_id
- *
- * Return: Returns vdev handle or NULL if mac address don't match
- */
 struct cdp_vdev *wma_find_vdev_by_addr(tp_wma_handle wma, uint8_t *addr,
 				   uint8_t *vdev_id)
 {
 	uint8_t i;
+	struct wlan_objmgr_vdev *vdev;
 
 	for (i = 0; i < wma->max_bssid; i++) {
+		vdev = wma->interfaces[i].vdev;
+		if (!vdev)
+			continue;
+
 		if (qdf_is_macaddr_equal(
-			(struct qdf_mac_addr *) wma->interfaces[i].addr,
-			(struct qdf_mac_addr *) addr) == true) {
+			(struct qdf_mac_addr *)wlan_vdev_mlme_get_macaddr(vdev),
+			(struct qdf_mac_addr *)addr) == true) {
 			*vdev_id = i;
 			return wma->interfaces[i].handle;
 		}
@@ -333,23 +330,38 @@ wma_send_peer_atim_window_len(tp_wma_handle wma, tpAddStaParams add_sta)
 }
 #endif /* QCA_IBSS_SUPPORT */
 
-/**
- * wma_find_vdev_by_bssid() - Get the corresponding vdev_id from BSSID
- * @wma - wma handle
- * @vdev_id - vdev ID
- *
- * Return: fill vdev_id with appropriate vdev id and return vdev
- *         handle or NULL if not found.
- */
+uint8_t *wma_get_vdev_bssid(struct wlan_objmgr_vdev *vdev)
+{
+	struct vdev_mlme_obj *mlme_obj;
+
+	if (!vdev) {
+		WMA_LOGE("%s vdev is NULL", __func__);
+		return NULL;
+	}
+
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!mlme_obj) {
+		WMA_LOGE("%s Failed to get mlme_obj", __func__);
+		return NULL;
+	}
+
+	return mlme_obj->mgmt.generic.bssid;
+}
+
 struct cdp_vdev *wma_find_vdev_by_bssid(tp_wma_handle wma, uint8_t *bssid,
 				    uint8_t *vdev_id)
 {
 	int i;
+	uint8_t *bssid_addr;
 
 	for (i = 0; i < wma->max_bssid; i++) {
+		bssid_addr = wma_get_vdev_bssid(wma->interfaces[i].vdev);
+		if (!bssid_addr)
+			continue;
+
 		if (qdf_is_macaddr_equal(
-			(struct qdf_mac_addr *) wma->interfaces[i].bssid,
-			(struct qdf_mac_addr *) bssid) == true) {
+			(struct qdf_mac_addr *)bssid_addr,
+			(struct qdf_mac_addr *)bssid) == true) {
 			*vdev_id = i;
 			return wma->interfaces[i].handle;
 		}
@@ -1203,6 +1215,7 @@ QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
 {
 	enum wlan_vdev_sm_evt  event;
 	struct wma_txrx_node *iface;
+	uint8_t *bssid;
 
 	iface = &wma->interfaces[rsp->vdev_id];
 	WMA_LOGD("%s: Send channel switch resp vdev %d status %d",
@@ -1228,7 +1241,13 @@ QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
 		int err;
 
 		/* for CSA case firmware expects phymode before ch_wd */
-		err = wma_set_peer_param(wma, iface->bssid,
+		bssid = wma_get_vdev_bssid(iface->vdev);
+		if (!bssid) {
+			WMA_LOGE("%s:Failed to get bssid for vdev_id %d",
+				 __func__, rsp->vdev_id);
+			return QDF_STATUS_E_FAILURE;
+		}
+		err = wma_set_peer_param(wma, bssid,
 					 WMI_PEER_PHYMODE, iface->chanmode,
 					rsp->vdev_id);
 		WMA_LOGD("%s:vdev_id %d chanmode %d status %d",
@@ -1236,7 +1255,7 @@ QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
 
 		chanwidth = wmi_get_ch_width_from_phy_mode(wma->wmi_handle,
 							   iface->chanmode);
-		err = wma_set_peer_param(wma, iface->bssid, WMI_PEER_CHWIDTH,
+		err = wma_set_peer_param(wma, bssid, WMI_PEER_CHWIDTH,
 					 chanwidth, rsp->vdev_id);
 		WMA_LOGD("%s:vdev_id %d chanwidth %d status %d",
 			 __func__, rsp->vdev_id, chanwidth, err);
@@ -1356,8 +1375,6 @@ QDF_STATUS wma_vdev_start_resp_handler(struct vdev_mlme_obj *vdev_mlme,
 	}  else if (iface->type == WMI_VDEV_TYPE_OCB) {
 		mlme_obj = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
 		mlme_obj->proto.sta.assoc_id = iface->aid;
-		qdf_mem_copy(mlme_obj->mgmt.generic.bssid, iface->bssid,
-			     QDF_MAC_ADDR_SIZE);
 		if (vdev_mgr_up_send(mlme_obj) != QDF_STATUS_SUCCESS) {
 			WMA_LOGE(FL("failed to send vdev up"));
 			policy_mgr_set_do_hw_mode_change_flag(
@@ -1374,8 +1391,12 @@ QDF_STATUS wma_vdev_start_resp_handler(struct vdev_mlme_obj *vdev_mlme,
 			WMA_LOGE("%s: Failed to get bssid", __func__);
 			return QDF_STATUS_E_INVAL;
 		}
-
-		qdf_mem_copy(iface->bssid, bss_peer.bytes,
+		mlme_obj = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
+		if (!mlme_obj) {
+			WMA_LOGE("%s: Failed to get mlme obj", __func__);
+			return QDF_STATUS_E_INVAL;
+		}
+		qdf_mem_copy(mlme_obj->mgmt.generic.bssid, bss_peer.bytes,
 			     QDF_MAC_ADDR_SIZE);
 		wma_vdev_start_rsp(wma, vdev_mlme->vdev, rsp);
 	}
@@ -1780,17 +1801,25 @@ static int wma_get_obj_mgr_peer_type(tp_wma_handle wma, uint8_t vdev_id,
 
 {
 	uint32_t obj_peer_type = 0;
+	struct wlan_objmgr_vdev *vdev;
+	uint8_t *addr;
+
+	vdev = wma->interfaces[vdev_id].vdev;
+	if (!vdev) {
+		WMA_LOGE("Couldnt find vdev for VDEV_%d", vdev_id);
+		return obj_peer_type;
+	}
+	addr = wlan_vdev_mlme_get_macaddr(vdev);
 
 	WMA_LOGD("vdev id %d vdev type %d vdev subtype %d peer addr %pM vdev addr %pM",
 		 vdev_id, wma->interfaces[vdev_id].type,
 		 wma->interfaces[vdev_id].sub_type, peer_addr,
-		 wma->interfaces[vdev_id].addr);
+		 addr);
 
 	if (wma_peer_type == WMI_PEER_TYPE_TDLS)
 		return WLAN_PEER_TDLS;
 
-	if (!qdf_mem_cmp(wma->interfaces[vdev_id].addr, peer_addr,
-					QDF_MAC_ADDR_SIZE)) {
+	if (!qdf_mem_cmp(addr, peer_addr, QDF_MAC_ADDR_SIZE)) {
 		obj_peer_type = WLAN_PEER_SELF;
 	} else if (wma->interfaces[vdev_id].type == WMI_VDEV_TYPE_STA) {
 		if (wma->interfaces[vdev_id].sub_type ==
@@ -2561,10 +2590,6 @@ QDF_STATUS wma_post_vdev_create_setup(struct wlan_objmgr_vdev *vdev)
 	wma_handle->interfaces[vdev_id].sub_type =
 		vdev_mlme->mgmt.generic.subtype;
 
-	qdf_mem_copy(wma_handle->interfaces[vdev_id].addr,
-		     vdev->vdev_mlme.macaddr,
-		     sizeof(wma_handle->interfaces[vdev_id].addr));
-
 	qos_aggr = &mac->mlme_cfg->qos_mlme_params;
 	status = wma_set_tx_rx_aggr_size(vdev_id, qos_aggr->tx_aggregation_size,
 					 qos_aggr->rx_aggregation_size,
@@ -4084,6 +4109,7 @@ QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss)
 	QDF_STATUS status;
 	struct wma_txrx_node *iface;
 	int pps_val = 0;
+	struct vdev_mlme_obj *mlme_obj;
 	struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
 	bool peer_assoc_sent = false;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
@@ -4173,11 +4199,17 @@ QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss)
 				add_bss->llbCoexist,
 				add_bss->maxTxPower);
 
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
+	if (!mlme_obj) {
+		WMA_LOGE("Failed to mlme obj");
+		goto peer_cleanup;
+	}
 	/*
 	 * Store the bssid in interface table, bssid will
 	 * be used during group key setting sta mode.
 	 */
-	qdf_mem_copy(iface->bssid, add_bss->bssId, QDF_MAC_ADDR_SIZE);
+	qdf_mem_copy(mlme_obj->mgmt.generic.bssid,
+		     add_bss->bssId, QDF_MAC_ADDR_SIZE);
 
 send_bss_resp:
 	wma_save_bss_params(wma, add_bss);
@@ -5248,6 +5280,7 @@ void wma_delete_bss_ho_fail(tp_wma_handle wma, uint8_t vdev_id)
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct vdev_stop_response resp_event;
 	struct del_bss_resp *vdev_stop_resp;
+	uint8_t *bssid;
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 
@@ -5262,7 +5295,13 @@ void wma_delete_bss_ho_fail(tp_wma_handle wma, uint8_t vdev_id)
 				__func__, vdev_id);
 		goto fail_del_bss_ho_fail;
 	}
-	qdf_mem_zero(iface->bssid, QDF_MAC_ADDR_SIZE);
+	bssid = wma_get_vdev_bssid(iface->vdev);
+	if (!bssid) {
+		WMA_LOGE("%s:Invalid bssid", __func__);
+		status = QDF_STATUS_E_FAILURE;
+		goto fail_del_bss_ho_fail;
+	}
+	qdf_mem_zero(bssid, QDF_MAC_ADDR_SIZE);
 
 	txrx_vdev = wma_find_vdev_by_id(wma, vdev_id);
 	if (!txrx_vdev) {
@@ -5387,6 +5426,7 @@ void wma_delete_bss(tp_wma_handle wma, uint8_t vdev_id)
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct qdf_mac_addr bssid;
 	struct del_bss_resp *params;
+	uint8_t *addr, *bssid_addr;
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 
 	if (!pdev) {
@@ -5408,18 +5448,19 @@ void wma_delete_bss(tp_wma_handle wma, uint8_t vdev_id)
 		goto out;
 	}
 
+	addr = wlan_vdev_mlme_get_macaddr(iface->vdev);
+	if (!addr) {
+		WMA_LOGE("%s vdev id %d : failed to get macaddr",
+			 __func__, vdev_id);
+		goto out;
+	}
 	if (wma_is_vdev_in_ibss_mode(wma, vdev_id))
 		/* in rome ibss case, self mac is used to create the bss peer */
-		peer = cdp_peer_find_by_addr(soc,
-			pdev,
-			wma->interfaces[vdev_id].addr,
-			&peer_id);
+		peer = cdp_peer_find_by_addr(soc, pdev, addr, &peer_id);
 	else if (WMA_IS_VDEV_IN_NDI_MODE(wma->interfaces,
 			vdev_id))
 		/* In ndi case, self mac is used to create the self peer */
-		peer = cdp_peer_find_by_addr(soc, pdev,
-				wma->interfaces[vdev_id].addr,
-				&peer_id);
+		peer = cdp_peer_find_by_addr(soc, pdev, addr, &peer_id);
 	else
 		peer = cdp_peer_find_by_addr(soc, pdev,
 				bssid.bytes,
@@ -5431,8 +5472,14 @@ void wma_delete_bss(tp_wma_handle wma, uint8_t vdev_id)
 		status = QDF_STATUS_E_FAILURE;
 		goto out;
 	}
-
-	qdf_mem_zero(wma->interfaces[vdev_id].bssid,
+	bssid_addr = wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
+	if (!bssid_addr) {
+		WMA_LOGE("%s: Failed to bssid for vdev_%d", __func__,
+			 vdev_id);
+		status = QDF_STATUS_E_FAILURE;
+		goto out;
+	}
+	qdf_mem_zero(bssid_addr,
 		     QDF_MAC_ADDR_SIZE);
 
 	txrx_vdev = wma_find_vdev_by_id(wma, vdev_id);

+ 7 - 1
core/wma/src/wma_features.c

@@ -2430,7 +2430,13 @@ static int wma_wake_event_piggybacked(
 	}
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-	bssid = wma->interfaces[event_param->fixed_param->vdev_id].bssid;
+	bssid = wma_get_vdev_bssid
+		(wma->interfaces[event_param->fixed_param->vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, event_param->fixed_param->vdev_id);
+		return 0;
+	}
 	peer = cdp_peer_find_by_addr(soc, pdev, bssid, &peer_id);
 	wake_reason = event_param->fixed_param->wake_reason;
 

+ 29 - 24
core/wma/src/wma_mgmt.c

@@ -329,18 +329,6 @@ void wma_sta_kickout_event(uint32_t kickout_reason, uint8_t vdev_id,
 }
 #endif
 
-/**
- * wma_peer_sta_kickout_event_handler() - kickout event handler
- * @handle: wma handle
- * @event: event data
- * @len: data length
- *
- * Kickout event is received from firmware on observing beacon miss
- * It handles kickout event for different modes and indicate to
- * upper layers.
- *
- * Return: 0 for success or error code
- */
 int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 				       uint32_t len)
 {
@@ -352,6 +340,8 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 	struct cdp_pdev *pdev;
 	tpDeleteStaContext del_sta_ctx;
 	struct ibss_peer_inactivity_ind *inactivity;
+	uint8_t *addr, *bssid;
+	struct wlan_objmgr_vdev *vdev;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	WMA_LOGD("%s: Enter", __func__);
@@ -373,14 +363,26 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 		WMA_LOGE("Not able to find BSSID for peer [%pM]", macaddr);
 		return -EINVAL;
 	}
+	vdev = wma->interfaces[vdev_id].vdev;
+	if (!vdev) {
+		WMA_LOGE("Not able to find vdev for VDEV_%d", vdev_id);
+		return -EINVAL;
+	}
+	addr = wlan_vdev_mlme_get_macaddr(vdev);
 
 	WMA_LOGA("%s: PEER:[%pM], ADDR:[%pN], INTERFACE:%d, peer_id:%d, reason:%d",
-		__func__, macaddr, wma->interfaces[vdev_id].addr, vdev_id,
+		__func__, macaddr, addr, vdev_id,
 		 peer_id, kickout_event->reason);
 	if (wma->interfaces[vdev_id].roaming_in_progress) {
 		WMA_LOGE("Ignore STA kick out since roaming is in progress");
 		return -EINVAL;
 	}
+	bssid = wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		return -ENOMEM;
+	}
 
 	switch (kickout_event->reason) {
 	case WMI_PEER_STA_KICKOUT_REASON_IBSS_DISCONNECT:
@@ -410,7 +412,7 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 		del_sta_ctx->vdev_id = vdev_id;
 		del_sta_ctx->staId = peer_id;
 		qdf_mem_copy(del_sta_ctx->addr2, macaddr, QDF_MAC_ADDR_SIZE);
-		qdf_mem_copy(del_sta_ctx->bssId, wma->interfaces[vdev_id].bssid,
+		qdf_mem_copy(del_sta_ctx->bssId, bssid,
 			     QDF_MAC_ADDR_SIZE);
 		del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_KEEP_ALIVE;
 		wma_send_msg(wma, SIR_LIM_DELETE_STA_CONTEXT_IND,
@@ -422,7 +424,7 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 		    (wma->interfaces[vdev_id].sub_type == 0 ||
 		     wma->interfaces[vdev_id].sub_type ==
 		     WMI_UNIFIED_VDEV_SUBTYPE_P2P_CLIENT) &&
-		    !qdf_mem_cmp(wma->interfaces[vdev_id].bssid,
+		    !qdf_mem_cmp(bssid,
 				    macaddr, QDF_MAC_ADDR_SIZE)) {
 			wma_sta_kickout_event(HOST_STA_KICKOUT_REASON_XRETRY,
 							vdev_id, macaddr);
@@ -451,7 +453,7 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 		    (wma->interfaces[vdev_id].sub_type == 0 ||
 		     wma->interfaces[vdev_id].sub_type ==
 		     WMI_UNIFIED_VDEV_SUBTYPE_P2P_CLIENT) &&
-		    !qdf_mem_cmp(wma->interfaces[vdev_id].bssid,
+		    !qdf_mem_cmp(bssid,
 				    macaddr, QDF_MAC_ADDR_SIZE)) {
 			wma_sta_kickout_event(
 			HOST_STA_KICKOUT_REASON_UNSPECIFIED, vdev_id, macaddr);
@@ -496,8 +498,7 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
 	del_sta_ctx->vdev_id = vdev_id;
 	del_sta_ctx->staId = peer_id;
 	qdf_mem_copy(del_sta_ctx->addr2, macaddr, QDF_MAC_ADDR_SIZE);
-	qdf_mem_copy(del_sta_ctx->bssId, wma->interfaces[vdev_id].addr,
-		     QDF_MAC_ADDR_SIZE);
+	qdf_mem_copy(del_sta_ctx->bssId, addr, QDF_MAC_ADDR_SIZE);
 	del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_KEEP_ALIVE;
 	if (wmi_service_enabled(wma->wmi_handle,
 				wmi_service_hw_db2dbm_support))
@@ -2498,7 +2499,7 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 	uint32_t def_key_idx = 0;
 	uint32_t wlan_opmode;
 	struct cdp_vdev *txrx_vdev;
-	uint8_t *mac_addr;
+	uint8_t *mac_addr, *bssid;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wlan_objmgr_vdev *vdev;
 
@@ -2531,9 +2532,15 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 	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->vdev_id].bssid,
-			QDF_MAC_ADDR_SIZE);
+		bssid = wma_get_vdev_bssid
+			(wma_handle->interfaces[key_info->vdev_id].vdev);
+		if (!bssid) {
+			WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+				 __func__, key_info->vdev_id);
+			key_info->status = QDF_STATUS_E_FAILURE;
+			goto out;
+		}
+		qdf_mem_copy(key_params.peer_mac, bssid, QDF_MAC_ADDR_SIZE);
 	} else {
 		mac_addr = cdp_get_vdev_mac_addr(soc, txrx_vdev);
 		if (!mac_addr) {
@@ -3177,8 +3184,6 @@ QDF_STATUS wma_set_ap_vdev_up(tp_wma_handle wma, uint8_t vdev_id)
 	vdev = iface->vdev;
 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
 	mlme_obj->proto.sta.assoc_id = 0;
-	qdf_mem_copy(mlme_obj->mgmt.generic.bssid, iface->bssid,
-		     QDF_MAC_ADDR_SIZE);
 
 	status = vdev_mgr_up_send(mlme_obj);
 	if (QDF_IS_STATUS_ERROR(status)) {

+ 16 - 25
core/wma/src/wma_power.c

@@ -993,26 +993,12 @@ static QDF_STATUS wma_set_sta_uapsd_auto_trig_cmd(wmi_unified_t wmi_handle,
 	return ret;
 }
 
-/**
- * wma_trigger_uapsd_params() - set trigger uapsd parameter
- * @wmi_handle: wma handle
- * @vdev_id: vdev id
- * @trigger_uapsd_params: trigger uapsd parameters
- *
- * This function sets the trigger uapsd
- * params such as service interval, delay
- * interval and suspend interval which
- * will be used by the firmware to send
- * trigger frames periodically when there
- * is no traffic on the transmit side.
- *
- * Return: QDF_STATUS_SUCCESS for success or error code.
- */
 QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
 				    tp_wma_trigger_uapsd_params
 				    trigger_uapsd_params)
 {
 	QDF_STATUS ret;
+	uint8_t *bssid;
 	struct sta_uapsd_params uapsd_trigger_param;
 
 	WMA_LOGD("Trigger uapsd params vdev id %d", vdev_id);
@@ -1041,8 +1027,14 @@ QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
 	uapsd_trigger_param.delay_interval =
 		trigger_uapsd_params->delay_interval;
 
+	bssid = wma_get_vdev_bssid(wma_handle->interfaces[vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
 	ret = wma_set_sta_uapsd_auto_trig_cmd(wma_handle->wmi_handle,
-			vdev_id, wma_handle->interfaces[vdev_id].bssid,
+			vdev_id, bssid,
 			&uapsd_trigger_param, 1);
 	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMA_LOGE("Fail to send uapsd param cmd for vdevid %d ret = %d",
@@ -1053,18 +1045,11 @@ QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
 	return ret;
 }
 
-/**
- * wma_disable_uapsd_per_ac() - disable uapsd per ac
- * @wmi_handle: wma handle
- * @vdev_id: vdev id
- * @ac: access category
- *
- * Return: QDF_STATUS_SUCCESS for success or error code.
- */
 QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
 				    uint32_t vdev_id, enum uapsd_ac ac)
 {
 	QDF_STATUS ret;
+	uint8_t *bssid;
 	struct wma_txrx_node *iface = &wma_handle->interfaces[vdev_id];
 	struct sta_uapsd_params uapsd_trigger_param;
 	enum uapsd_up user_priority;
@@ -1111,8 +1096,14 @@ QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
 	uapsd_trigger_param.suspend_interval = 0;
 	uapsd_trigger_param.delay_interval = 0;
 
+	bssid = wma_get_vdev_bssid(wma_handle->interfaces[vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
 	ret = wma_set_sta_uapsd_auto_trig_cmd(wma_handle->wmi_handle,
-		vdev_id, wma_handle->interfaces[vdev_id].bssid,
+		vdev_id, bssid,
 		&uapsd_trigger_param, 1);
 	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMA_LOGE("Fail to send auto trig cmd for vdevid %d ret = %d",

+ 11 - 4
core/wma/src/wma_scan_roam.c

@@ -2651,7 +2651,7 @@ wma_roam_update_vdev(tp_wma_handle wma,
 	tDeleteStaParams *del_sta_params;
 	tAddStaParams *add_sta_params;
 	uint32_t uc_cipher = 0, cipher_cap = 0;
-	uint8_t vdev_id;
+	uint8_t vdev_id, *bssid;
 
 	vdev_id = roam_synch_ind_ptr->roamed_vdev_id;
 	wma->interfaces[vdev_id].nss = roam_synch_ind_ptr->nss;
@@ -2678,11 +2678,18 @@ wma_roam_update_vdev(tp_wma_handle wma,
 	add_sta_params->staIdx = STA_INVALID_IDX;
 	add_sta_params->assocId = roam_synch_ind_ptr->aid;
 
+	bssid = wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
+	if (!bssid) {
+		WMA_LOGE("%s: Failed to get bssid for vdev_%d",
+			 __func__, vdev_id);
+		return;
+	}
+
 	/*
 	 * Get uc cipher of old peer to update new peer as it doesnt
 	 * change in roaming
 	 */
-	wma_get_peer_uc_cipher(wma, wma->interfaces[vdev_id].bssid,
+	wma_get_peer_uc_cipher(wma, bssid,
 			       &uc_cipher, &cipher_cap);
 
 	wma_delete_sta(wma, del_sta_params);
@@ -2694,8 +2701,8 @@ wma_roam_update_vdev(tp_wma_handle wma,
 					      roam_synch_ind_ptr->bssid.bytes);
 	wma_add_bss_lfr3(wma, roam_synch_ind_ptr->add_bss_params);
 	wma_add_sta(wma, add_sta_params);
-	qdf_mem_copy(wma->interfaces[vdev_id].bssid,
-			roam_synch_ind_ptr->bssid.bytes, QDF_MAC_ADDR_SIZE);
+	qdf_mem_copy(bssid, roam_synch_ind_ptr->bssid.bytes,
+		     QDF_MAC_ADDR_SIZE);
 	qdf_mem_free(add_sta_params);
 }
 

+ 42 - 37
core/wma/src/wma_utils.c

@@ -1973,17 +1973,11 @@ void wma_register_ll_stats_event_handler(tp_wma_handle wma_handle)
 
 }
 
-
-/**
- * wma_process_ll_stats_clear_req() - clear link layer stats
- * @wma: wma handle
- * @clearReq: ll stats clear request command params
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
 QDF_STATUS wma_process_ll_stats_clear_req(tp_wma_handle wma,
 				 const tpSirLLStatsClearReq clearReq)
 {
+	struct wlan_objmgr_vdev *vdev;
+	uint8_t *addr;
 	struct ll_stats_clear_params cmd = {0};
 	int ret;
 
@@ -2001,9 +1995,20 @@ QDF_STATUS wma_process_ll_stats_clear_req(tp_wma_handle wma,
 	cmd.stop_req = clearReq->stopReq;
 	cmd.vdev_id = clearReq->staId;
 	cmd.stats_clear_mask = clearReq->statsClearReqMask;
-	qdf_mem_copy(cmd.peer_macaddr.bytes,
-		     wma->interfaces[clearReq->staId].addr,
-		     QDF_MAC_ADDR_SIZE);
+
+	vdev = wma->interfaces[clearReq->staId].vdev;
+	if (!vdev) {
+		WMA_LOGE("%s: Failed to get vdev for vdev_%d",
+			 __func__, clearReq->staId);
+		return QDF_STATUS_E_FAILURE;
+	}
+	addr = wlan_vdev_mlme_get_macaddr(vdev);
+	if (!addr) {
+		WMA_LOGE("%s: Failed to get macaddr for vdev_%d",
+			 __func__, clearReq->staId);
+		return QDF_STATUS_E_FAILURE;
+	}
+	qdf_mem_copy(cmd.peer_macaddr.bytes, addr, QDF_MAC_ADDR_SIZE);
 	ret = wmi_unified_process_ll_stats_clear_cmd(wma->wmi_handle, &cmd);
 	if (ret) {
 		WMA_LOGE("%s: Failed to send clear link stats req", __func__);
@@ -2045,16 +2050,11 @@ QDF_STATUS wma_process_ll_stats_set_req(tp_wma_handle wma,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * wma_process_ll_stats_get_req() - link layer stats get request
- * @wma:wma handle
- * @getReq:ll stats get request command params
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
 QDF_STATUS wma_process_ll_stats_get_req(tp_wma_handle wma,
 				 const tpSirLLStatsGetReq getReq)
 {
+	struct wlan_objmgr_vdev *vdev;
+	uint8_t *addr;
 	struct ll_stats_get_params cmd = {0};
 	int ret;
 
@@ -2072,10 +2072,20 @@ QDF_STATUS wma_process_ll_stats_get_req(tp_wma_handle wma,
 	cmd.req_id = getReq->reqId;
 	cmd.param_id_mask = getReq->paramIdMask;
 	cmd.vdev_id = getReq->staId;
-	qdf_mem_copy(cmd.peer_macaddr.bytes,
-		     wma->interfaces[getReq->staId].addr,
-		     QDF_MAC_ADDR_SIZE);
 
+	vdev = wma->interfaces[getReq->staId].vdev;
+	if (!vdev) {
+		WMA_LOGE("%s: Failed to get vdev for vdev_%d",
+			 __func__, getReq->staId);
+		return QDF_STATUS_E_FAILURE;
+	}
+	addr = wlan_vdev_mlme_get_macaddr(vdev);
+	if (!addr) {
+		WMA_LOGE("%s: Failed to get macaddr for vdev_%d",
+			 __func__, getReq->staId);
+		return QDF_STATUS_E_FAILURE;
+	}
+	qdf_mem_copy(cmd.peer_macaddr.bytes, addr, QDF_MAC_ADDR_SIZE);
 	ret = wmi_unified_process_ll_stats_get_cmd(wma->wmi_handle, &cmd);
 	if (ret) {
 		WMA_LOGE("%s: Failed to send get link stats request", __func__);
@@ -3130,15 +3140,10 @@ void *wma_get_beacon_buffer_by_vdev_id(uint8_t vdev_id, uint32_t *buffer_size)
 	return buf;
 }
 
-/**
- * wma_get_vdev_address_by_vdev_id() - lookup MAC address from vdev ID
- * @vdev_id: vdev id
- *
- * Return: mac address
- */
 uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id)
 {
 	tp_wma_handle wma;
+	struct wlan_objmgr_vdev *vdev;
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
 	if (!wma) {
@@ -3150,8 +3155,12 @@ uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id)
 		WMA_LOGE("%s: Invalid vdev_id %u", __func__, vdev_id);
 		return NULL;
 	}
-
-	return wma->interfaces[vdev_id].addr;
+	vdev = wma->interfaces[vdev_id].vdev;
+	if (!vdev) {
+		WMA_LOGE("%s: Invalid vdev for vdev_id %u", __func__, vdev_id);
+		return NULL;
+	}
+	return wlan_vdev_mlme_get_macaddr(vdev);
 }
 
 QDF_STATUS wma_get_connection_info(uint8_t vdev_id,
@@ -3985,15 +3994,13 @@ QDF_STATUS wma_sta_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
 	vdev_id = wlan_vdev_get_id(vdev_mlme->vdev);
 	iface = &wma->interfaces[vdev_id];
 	vdev_mlme->proto.sta.assoc_id = iface->aid;
-	qdf_mem_copy(vdev_mlme->mgmt.generic.bssid, iface->bssid,
-		     QDF_MAC_ADDR_SIZE);
 
 	wma_update_roam_offload_flag(wma, vdev_id, true);
 	status = vdev_mgr_up_send(vdev_mlme);
 
 	if (QDF_IS_STATUS_ERROR(status)) {
-		WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d bssid %pM",
-			 __func__, vdev_id, iface->bssid);
+		WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d",
+			 __func__, vdev_id);
 		policy_mgr_set_do_hw_mode_change_flag(
 			wma->psoc, false);
 		status = QDF_STATUS_E_FAILURE;
@@ -4244,13 +4251,11 @@ QDF_STATUS wma_mon_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
 	vdev_id = wlan_vdev_get_id(vdev_mlme->vdev);
 	iface = &wma->interfaces[vdev_id];
 	vdev_mlme->proto.sta.assoc_id = 0;
-	qdf_mem_copy(vdev_mlme->mgmt.generic.bssid, iface->bssid,
-		     QDF_MAC_ADDR_SIZE);
 
 	status = vdev_mgr_up_send(vdev_mlme);
 	if (QDF_IS_STATUS_ERROR(status))
-		WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d bssid %pM",
-			 __func__, vdev_id, iface->bssid);
+		WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d",
+			 __func__, vdev_id);
 
 	return status;
 }