qcacld-3.0: Get/Release ref_cnt for objects store and release

Add get and release reference counts for PSOC/PDEV/VDEV/PEER
objects reference storing and releasing as per the latest reference
count implementation.

Change-Id: I1715be7f8e47b52fa36bb070443051dd99703eb0
CRs-Fixed: 2001058
This commit is contained in:
Selvaraj, Sridhar
2017-02-01 17:32:21 +05:30
committed by qcabuildsw
parent b4272f9466
commit 3a1823f12d
4 changed files with 23 additions and 18 deletions

View File

@@ -53,6 +53,8 @@ int hdd_release_and_destroy_psoc(hdd_context_t *hdd_ctx)
if (!psoc)
return -EINVAL;
wlan_objmgr_print_ref_all_objects_per_psoc(psoc);
return qdf_status_to_os_return(wlan_objmgr_psoc_obj_delete(psoc));
}
@@ -123,9 +125,8 @@ int hdd_create_and_store_vdev(struct wlan_objmgr_pdev *pdev,
wlan_objmgr_vdev_obj_delete(vdev);
return -ENOMEM;
}
adapter->hdd_vdev = vdev;
wlan_objmgr_peer_ref_peer(peer);
adapter->hdd_vdev = vdev;
return 0;
}
@@ -177,7 +178,6 @@ int hdd_add_peer_object(struct wlan_objmgr_vdev *vdev,
if (!peer)
return -ENOMEM;
wlan_objmgr_peer_ref_peer(peer);
hdd_info("Peer object "MAC_ADDRESS_STR" add success!",
MAC_ADDR_ARRAY(mac_addr));
@@ -203,18 +203,12 @@ int hdd_remove_peer_object(struct wlan_objmgr_vdev *vdev,
return -EINVAL;
}
peer = wlan_objmgr_find_peer(psoc, mac_addr);
peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_HDD_ID_OBJ_MGR);
if (peer) {
/* Unref to decrement ref happened in find_peer */
wlan_objmgr_peer_unref_peer(peer);
wlan_objmgr_peer_release_ref(peer, WLAN_HDD_ID_OBJ_MGR);
/*
* Unref to decrement ref of create_peer. This
* is needed until new ref count implementation
* is done. Object manager will delete peer once
* ref count is 0.
*/
wlan_objmgr_peer_unref_peer(peer);
wlan_objmgr_peer_obj_delete(peer);
hdd_info("Peer obj "MAC_ADDRESS_STR" deleted",
MAC_ADDR_ARRAY(mac_addr));

View File

@@ -108,6 +108,7 @@ tSirRetStatus mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
{
tpAniSirGlobal p_mac = NULL;
tSirRetStatus status = eSIR_SUCCESS;
QDF_STATUS qdf_status;
if (pHalHandle == NULL)
return eSIR_FAILURE;
@@ -131,7 +132,12 @@ tSirRetStatus mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
*/
p_mac->hHdd = hHdd;
/* Increase psoc ref count once APIs are available in object manager */
qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_MAC_ID);
if (QDF_IS_STATUS_ERROR(qdf_status)) {
sys_log(p_mac, LOGE, FL("PSOC get ref failure\n"));
return eSIR_FAILURE;
}
p_mac->psoc = psoc;
*pHalHandle = (tHalHandle) p_mac;
@@ -187,7 +193,7 @@ tSirRetStatus mac_close(tHalHandle hHal)
log_deinit(pMac);
/* Decrease psoc ref count once APIs are available in object manager */
wlan_objmgr_psoc_release_ref(pMac->psoc, WLAN_LEGACY_MAC_ID);
pMac->psoc = NULL;
/* Finally, de-allocate the global MAC datastructure: */
qdf_mem_free(pMac);

View File

@@ -2866,10 +2866,11 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
wh = (struct ieee80211_frame *)(qdf_nbuf_data(tx_frame));
mac_addr = wh->i_addr1;
peer = wlan_objmgr_find_peer(psoc, mac_addr);
peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_MGMT_NB_ID);
if (!peer) {
mac_addr = wh->i_addr2;
peer = wlan_objmgr_find_peer(psoc, mac_addr);
peer = wlan_objmgr_get_peer(psoc, mac_addr,
WLAN_MGMT_NB_ID);
}
status = wlan_mgmt_txrx_mgmt_frame_tx(peer,

View File

@@ -1939,7 +1939,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context,
qdf_wake_lock_create(&wma_handle->wow_wake_lock, "wlan_wow_wl");
}
/* Increase psoc ref count once APIs are available in object manager */
qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_WMA_ID);
if (QDF_IS_STATUS_ERROR(qdf_status)) {
WMA_LOGE("%s: PSOC get_ref fails", __func__);
return qdf_status;
}
wma_handle->psoc = psoc;
/* Attach mc_thread context processing function */
@@ -3560,7 +3564,7 @@ QDF_STATUS wma_close(void *cds_ctx)
wmi_desc_pool_deinit(wma_handle);
}
/* Decrease psoc ref count once APIs are available in object manager */
wlan_objmgr_psoc_release_ref(wma_handle->psoc, WLAN_LEGACY_WMA_ID);
wma_handle->psoc = NULL;
target_if_close();
wma_target_if_close(wma_handle);