qca-wifi: add module id for dp peer reference
Use appropriate module id while taking peer
reference
Change-Id: Ifd4c80ff304f599700192a340e60c7f65214f2b7
diff --git a/dp/wifi3.0/dp_tx_capture.c b/dp/wifi3.0/dp_tx_capture.c
index 653cd62..cb41a7f 100644
--- a/dp/wifi3.0/dp_tx_capture.c
+++ b/dp/wifi3.0/dp_tx_capture.c
@@ -2675,10 +2675,11 @@
qdf_nbuf_set_pktlen(tx_capture_info.mpdu_nbuf,
sizeof(struct ieee80211_frame_min_one));
else {
- peer = dp_peer_find_by_id(pdev->soc, user->peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, user->peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (peer) {
vdev = peer->vdev;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
} else {
vdev =
dp_get_vdev_from_soc_vdev_id_wifi3(pdev->soc,
@@ -2783,10 +2784,11 @@
ppdu_desc->tx_duration = cur_ppdu_desc->tx_duration -
(RTS_INTERVAL + SIFS_INTERVAL);
ppdu_desc->user[usr_idx].peer_id = peer_id;
- peer = dp_peer_find_by_id(pdev->soc, peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (peer) {
vdev = peer->vdev;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
} else {
uint8_t vdev_id;
@@ -2828,8 +2830,9 @@
tx_capture_info->ppdu_desc->ppdu_end_timestamp;
ppdu_desc->user[0].peer_id =
tx_capture_info->ppdu_desc->user[0].peer_id;
- peer = dp_peer_find_by_id(pdev->soc,
- tx_capture_info->ppdu_desc->user[0].peer_id);
+ peer = dp_peer_get_ref_by_id
+ (pdev->soc, tx_capture_info->ppdu_desc->user[0].peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (peer) {
struct dp_vdev *vdev = NULL;
@@ -2838,7 +2841,7 @@
qdf_mem_copy(&ppdu_desc->user[0].mac_addr,
vdev->mac_addr.raw,
QDF_MAC_ADDR_SIZE);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
}
dp_send_dummy_mpdu_info_to_stack(pdev, ppdu_desc, 0);
@@ -2874,7 +2877,8 @@
ppdu_id = ppdu_desc->ppdu_id;
user = &ppdu_desc->user[usr_idx];
- peer = dp_peer_find_by_id(pdev->soc, user->peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, user->peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (!peer) {
return;
}
@@ -2961,7 +2965,7 @@
dp_gen_ack_rx_frame(pdev, &tx_capture_info);
return_send_to_stack:
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return;
}
@@ -3473,12 +3477,14 @@
qdf_nbuf_copy_expand_fraglist(
mpdu_nbuf, MAX_MONITOR_HEADER, 0);
- peer = dp_peer_find_by_id(pdev->soc,
- user->peer_id);
+ peer = dp_peer_get_ref_by_id
+ (pdev->soc, user->peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (peer) {
dp_tx_cap_stats_mpdu_update(peer,
PEER_MPDU_CLONE, 1);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete
+ (peer, DP_MOD_ID_TX_CAPTURE);
}
user->failed_bitmap[k] |=
SEQ_SEG_MSK(user->failed_bitmap[k], i);
@@ -3761,20 +3767,21 @@
subtype = 0;
}
- peer = dp_peer_find_by_id(pdev->soc, ppdu_desc->user[0].peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, ppdu_desc->user[0].peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (peer && !peer->bss_peer) {
if (!dp_peer_or_pdev_tx_cap_enabled(pdev, peer,
ppdu_desc->user[0].mac_addr
)) {
qdf_nbuf_free(nbuf_ppdu_desc);
status = 0;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
goto free_ppdu_desc;
}
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
} else {
if (peer)
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
if (!(type == IEEE80211_FC0_TYPE_MGT &&
(subtype == MGMT_SUBTYPE_PROBE_RESP >> 4 ||
subtype == MGMT_SUBTYPE_DISASSOC >> 4 ||
@@ -4235,14 +4242,15 @@
struct cdp_tx_completion_ppdu_user *user;
user = &ppdu_desc->user[usr_idx];
- peer = dp_peer_find_by_id(pdev->soc, user->peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, user->peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (!peer)
return;
dp_peer_tx_cap_tid_queue_flush_tlv(pdev, peer, ppdu_desc, usr_idx);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return;
}
@@ -4382,7 +4390,9 @@
if (user->delayed_ba || user->skip == 1)
continue;
- peer = dp_peer_find_by_id(pdev->soc, user->peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc,
+ user->peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (!peer) {
dp_ppdu_desc_free(ptr_nbuf_list, usr_idx);
user->skip = 1;
@@ -4418,7 +4428,8 @@
"%s: ppdu_desc->mpdus allocation failed",
__func__);
dp_ppdu_desc_free_all(ptr_nbuf_list, num_users);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer,
+ DP_MOD_ID_TX_CAPTURE);
dp_print_pdev_tx_capture_stats(pdev);
qdf_assert_always(0);
return;
@@ -4427,7 +4438,8 @@
if (qdf_unlikely(user->ba_size >
CDP_BA_256_BIT_MAP_SIZE_DWORDS *
SEQ_SEG_SZ_BITS(user->failed_bitmap))) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer,
+ DP_MOD_ID_TX_CAPTURE);
qdf_assert_always(0);
return;
}
@@ -4523,7 +4535,7 @@
user->ba_size = seq_no - start_seq + 1;
}
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
}
}
@@ -4558,7 +4570,8 @@
continue;
peer_id = cur_ppdu_desc->user[usr_idx].peer_id;
- peer = dp_peer_find_by_id(pdev->soc, peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc, peer_id,
+ DP_MOD_ID_TX_CAPTURE);
if (!peer) {
dp_ppdu_desc_free(ptr_nbuf_list, usr_idx);
continue;
@@ -4611,7 +4624,8 @@
tmp_ppdu_q = &tx_tid->pending_ppdu_q;
tmp_nbuf = qdf_nbuf_queue_remove(tmp_ppdu_q);
if (qdf_unlikely(!tmp_nbuf)) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete
+ (peer, DP_MOD_ID_TX_CAPTURE);
qdf_assert_always(0);
return;
}
@@ -4627,7 +4641,7 @@
qdf_nbuf_free(tmp_nbuf);
pdev->tx_capture.pend_ppdu_dropped++;
}
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
}
}
}
@@ -4724,8 +4738,9 @@
}
peer_id = user->peer_id;
- peer = dp_peer_find_by_id(pdev->soc,
- peer_id);
+ peer = dp_peer_get_ref_by_id(pdev->soc,
+ peer_id,
+ DP_MOD_ID_TX_CAPTURE);
/**
* peer can be NULL
*/
@@ -4884,7 +4899,7 @@
mpdu_suc);
dp_tx_cap_stats_mpdu_update(peer, PEER_MPDU_TRI,
mpdu_tri);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
/* get reference count */
ref_cnt = qdf_nbuf_get_users(nbuf_ppdu);
continue;
@@ -4894,7 +4909,8 @@
qdf_nbuf_free(nbuf_ppdu);
ref_cnt--;
if (peer)
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer,
+ DP_MOD_ID_TX_CAPTURE);
continue;
}
@@ -5447,12 +5463,12 @@
peer_id = peer->peer_id;
qdf_spin_unlock_bh(&soc->ast_lock);
- peer = dp_peer_find_by_id(soc, peer_id);
+ peer = dp_peer_get_ref_by_id(soc, peer_id, DP_MOD_ID_TX_CAPTURE);
if (!peer)
return QDF_STATUS_E_FAILURE;
if (!dp_peer_or_pdev_tx_cap_enabled(pdev, NULL, peer->mac_addr.raw)) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return QDF_STATUS_E_FAILURE;
}
@@ -5468,7 +5484,7 @@
}
}
if (!match) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return QDF_STATUS_E_FAILURE;
}
}
@@ -5486,13 +5502,13 @@
4, FALSE);
if (!tx_capture_info.mpdu_nbuf) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return QDF_STATUS_E_NOMEM;
}
dp_gen_cts_frame(ppdu_info, peer,
tx_capture_info.mpdu_nbuf);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
dp_wdi_event_handler(WDI_EVENT_TX_DATA, pdev->soc,
&tx_capture_info, HTT_INVALID_PEER,
WDI_NO_VAL, pdev->pdev_id);
@@ -5588,13 +5604,13 @@
peer_id = peer->peer_id;
qdf_spin_unlock_bh(&soc->ast_lock);
- peer = dp_peer_find_by_id(soc, peer_id);
+ peer = dp_peer_get_ref_by_id(soc, peer_id, DP_MOD_ID_TX_CAPTURE);
if (!peer)
return;
if (!dp_peer_or_pdev_tx_cap_enabled(pdev, peer,
peer->mac_addr.raw)) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return;
}
@@ -5609,7 +5625,7 @@
4, FALSE);
if (!tx_capture_info.mpdu_nbuf) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return;
}
@@ -5627,7 +5643,7 @@
tx_capture_info.mpdu_nbuf);
}
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
dp_wdi_event_handler(WDI_EVENT_TX_DATA, pdev->soc,
&tx_capture_info, HTT_INVALID_PEER,
WDI_NO_VAL, pdev->pdev_id);
@@ -5856,13 +5872,13 @@
peer_id = peer->peer_id;
qdf_spin_unlock_bh(&soc->ast_lock);
- peer = dp_peer_find_by_id(soc, peer_id);
+ peer = dp_peer_get_ref_by_id(soc, peer_id, DP_MOD_ID_TX_CAPTURE);
if (!peer) {
return QDF_STATUS_E_FAILURE;
}
if (!dp_peer_or_pdev_tx_cap_enabled(pdev, peer, peer->mac_addr.raw)) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return QDF_STATUS_E_FAILURE;
}
@@ -5883,14 +5899,14 @@
4, FALSE);
if (!tx_capture_info.mpdu_nbuf) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
return QDF_STATUS_E_NOMEM;
}
dp_gen_noack_frame(ppdu_info, peer,
tx_capture_info.mpdu_nbuf, mon_mpdu);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_CAPTURE);
dp_wdi_event_handler(WDI_EVENT_TX_DATA, pdev->soc,
&tx_capture_info, HTT_INVALID_PEER,
WDI_NO_VAL, pdev->pdev_id);
diff --git a/dp/wifi3.0/dp_txrx_wds.c b/dp/wifi3.0/dp_txrx_wds.c
index 579b72c..7866c73 100644
--- a/dp/wifi3.0/dp_txrx_wds.c
+++ b/dp/wifi3.0/dp_txrx_wds.c
@@ -209,7 +209,8 @@
return;
soc = vdev->pdev->soc;
- peer = dp_vdev_bss_peer_ref_n_get(soc, vdev);
+ peer = dp_vdev_bss_peer_ref_n_get(soc, vdev,
+ DP_MOD_ID_AST);
if (!peer) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
@@ -231,7 +232,7 @@
mac_addr,
CDP_TXRX_AST_TYPE_MEC,
flags);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
}
/**
@@ -257,7 +258,7 @@
return QDF_STATUS_E_INVAL;
}
- peer = dp_vdev_bss_peer_ref_n_get(vdev);
+ peer = dp_vdev_bss_peer_ref_n_get(vdev, DP_MOD_ID_AST);
if (peer) {
peer->wds_ecm.wds_rx_filter = 1;
@@ -265,7 +266,7 @@
(val & WDS_POLICY_RX_UCAST_4ADDR) ? 1 : 0;
peer->wds_ecm.wds_rx_mcast_4addr =
(val & WDS_POLICY_RX_MCAST_4ADDR) ? 1 : 0;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
}
return QDF_STATUS_SUCCESS;
@@ -289,7 +290,8 @@
{
struct dp_peer *peer = dp_peer_find_hash_find((struct dp_soc *)soc,
peer_mac, 0,
- vdev_id);
+ vdev_id,
+ DP_MOD_ID_AST);
if (!peer) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("peer is NULL for mac %pM vdev_id %d"),
@@ -318,7 +320,7 @@
"peer->wds_ecm.wds_tx_mcast_4addr %d\n",
peer->wds_ecm.wds_tx_mcast_4addr);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return QDF_STATUS_SUCCESS;
}
@@ -333,15 +335,15 @@
int rx_mcast = hal_rx_msdu_end_da_is_mcbc_get(hal_soc, rx_tlv_hdr);
if (vdev->opmode == wlan_op_mode_ap) {
- bss_peer = dp_vdev_bss_peer_ref_n_get(vdev);
+ bss_peer = dp_vdev_bss_peer_ref_n_get(vdev, DP_MOD_ID_AST);
/* if wds policy check is not enabled on this vdev, accept all frames */
if (bss_peer && !bss_peer->wds_ecm.wds_rx_filter) {
- dp_peer_unref_delete(bss_peer);
+ dp_peer_unref_delete(bss_peer, DP_MOD_ID_AST);
return 1;
}
rx_policy_ucast = bss_peer->wds_ecm.wds_rx_ucast_4addr;
rx_policy_mcast = bss_peer->wds_ecm.wds_rx_mcast_4addr;
- dp_peer_unref_delete(bss_peer);
+ dp_peer_unref_delete(bss_peer, DP_MOD_ID_AST);
} else { /* sta mode */
if (!peer->wds_ecm.wds_rx_filter) {
return 1;
@@ -491,7 +493,8 @@
return DP_VLAN_UNTAGGED;
}
- peer = dp_peer_find_hash_find(soc, eh->ether_dhost, 0, DP_VDEV_ALL);
+ peer = dp_peer_find_hash_find(soc, eh->ether_dhost, 0, DP_VDEV_ALL,
+ DP_MOD_ID_TX_MULTIPASS);
if (qdf_unlikely(peer == NULL))
return DP_VLAN_UNTAGGED;
@@ -501,11 +504,11 @@
* Send the frame as it is.
*/
if (*vlan_id == peer->vlan_id) {
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_MULTIPASS);
return DP_VLAN_TAGGED_UNICAST;
}
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_MULTIPASS);
return DP_VLAN_UNTAGGED;
}
@@ -647,7 +650,7 @@
qdf_spin_unlock_bh(&vdev->mpass_peer_mutex);
if (found)
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_MULTIPASS);
}
/**
@@ -663,7 +666,8 @@
uint8_t vdev_id, uint16_t vlan_id)
{
struct dp_peer *peer =
- dp_peer_find_hash_find(soc, peer_mac, 0, vdev_id);
+ dp_peer_find_hash_find(soc, peer_mac, 0, vdev_id,
+ DP_MOD_ID_TX_MULTIPASS);
if (qdf_unlikely(!peer)) {
qdf_err("NULL peer");
@@ -678,7 +682,7 @@
dp_debug("peer already added to vdev multipass list"
"MAC: "QDF_MAC_ADDR_STR" vlan: %d ",
QDF_MAC_ADDR_ARRAY(peer->mac_addr.raw), peer->vlan_id);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_TX_MULTIPASS);
return;
}
@@ -889,7 +893,7 @@
if (is_wds)
return;
- peer = dp_peer_find_by_id(soc, peer_id);
+ peer = dp_peer_get_ref_by_id(soc, peer_id, DP_MOD_ID_AST);
if (!peer) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: Invalid peer\n", __func__);
@@ -900,9 +904,7 @@
if (peer->vdev->opmode != wlan_op_mode_ap) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: Peer ast flow map not in STA mode\n", __func__);
- /* Release peer reference */
- dp_peer_unref_delete(peer);
- return;
+ goto end;
}
/* Making sure the peer is for this mac address */
@@ -910,8 +912,7 @@
(struct qdf_mac_addr *)peer->mac_addr.raw)) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: Peer mac address mismatch\n", __func__);
- dp_peer_unref_delete(peer);
- return;
+ goto end;
}
/* Ast entry flow mapping not valid for self peer map */
@@ -919,8 +920,7 @@
(struct qdf_mac_addr *)peer->vdev->mac_addr.raw)) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: Ast flow mapping not valid for self peer \n", __func__);
- dp_peer_unref_delete(peer);
- return;
+ goto end;
}
/* Fill up ast index <---> flow id mapping table for this peer */
@@ -960,8 +960,9 @@
peer->vdev->vdev_id, peer_mac_addr);
}
+end:
/* Release peer reference */
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
}
/**
@@ -987,7 +988,8 @@
}
peer = dp_peer_find_hash_find((struct dp_soc *)soc,
- peer_mac_addr, 0, vdev_id);
+ peer_mac_addr, 0, vdev_id,
+ DP_MOD_ID_AST);
if (!peer) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: Invalid peer\n", __func__);
@@ -1012,7 +1014,7 @@
if (i == DP_PEER_AST_FLOWQ_MAX) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: ast index not found for flow %d\n", __func__, flow_id);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return -1;
}
@@ -1020,7 +1022,7 @@
if (!peer->peer_ast_flowq_idx[i].is_valid) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: ast index is invalid for flow %d\n", __func__, flow_id);
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return -1;
}
@@ -1034,7 +1036,7 @@
& (1 << tid))) {
/* Release peer reference */
ast_index = peer->peer_ast_flowq_idx[i].ast_idx;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return ast_index;
} else {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
@@ -1044,7 +1046,7 @@
* TID is not valid for this flow
* Return -1
*/
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return -1;
}
}
@@ -1054,7 +1056,7 @@
* UDP/NON UDP flow id
*/
ast_index = peer->peer_ast_flowq_idx[i].ast_idx;
- dp_peer_unref_delete(peer);
+ dp_peer_unref_delete(peer, DP_MOD_ID_AST);
return ast_index;
}
#endif