qcacmn: Handle failure cases in txrx_peer allocation
Handle failure cases in txrx_peer allocation and return appropriate errors to the callers. Change-Id: I51fb519af86344e078eabfcc3f2883522361e1d9
This commit is contained in:

committed by
Madan Koyyalamudi

parent
f4c7e777f0
commit
c9f584b99f
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
|
||||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
* Copyright (c) 2021,2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
@@ -378,21 +378,21 @@ static inline QDF_STATUS cdp_peer_create
|
|||||||
peer_mac_addr, CDP_LINK_PEER_TYPE);
|
peer_mac_addr, CDP_LINK_PEER_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void cdp_peer_setup
|
static inline QDF_STATUS cdp_peer_setup
|
||||||
(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
|
(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
|
||||||
struct cdp_peer_setup_info *setup_info)
|
struct cdp_peer_setup_info *setup_info)
|
||||||
{
|
{
|
||||||
if (!soc || !soc->ops) {
|
if (!soc || !soc->ops) {
|
||||||
dp_cdp_debug("Invalid Instance:");
|
dp_cdp_debug("Invalid Instance:");
|
||||||
QDF_BUG(0);
|
QDF_BUG(0);
|
||||||
return;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!soc->ops->cmn_drv_ops ||
|
if (!soc->ops->cmn_drv_ops ||
|
||||||
!soc->ops->cmn_drv_ops->txrx_peer_setup)
|
!soc->ops->cmn_drv_ops->txrx_peer_setup)
|
||||||
return;
|
return QDF_STATUS_E_FAILURE;
|
||||||
|
|
||||||
soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
|
return soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
|
||||||
peer_mac, setup_info);
|
peer_mac, setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6782,10 +6782,14 @@ static QDF_STATUS dp_txrx_peer_detach(struct dp_soc *soc, struct dp_peer *peer)
|
|||||||
{
|
{
|
||||||
struct dp_txrx_peer *txrx_peer;
|
struct dp_txrx_peer *txrx_peer;
|
||||||
|
|
||||||
|
/* dp_txrx_peer exists for mld peer and legacy peer */
|
||||||
|
if (peer->txrx_peer) {
|
||||||
txrx_peer = peer->txrx_peer;
|
txrx_peer = peer->txrx_peer;
|
||||||
peer->txrx_peer = NULL;
|
peer->txrx_peer = NULL;
|
||||||
|
|
||||||
qdf_mem_free(txrx_peer);
|
qdf_mem_free(txrx_peer);
|
||||||
|
}
|
||||||
|
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6932,10 +6936,11 @@ dp_peer_create_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
|
|||||||
|
|
||||||
DP_PEER_SET_TYPE(peer, peer_type);
|
DP_PEER_SET_TYPE(peer, peer_type);
|
||||||
if (IS_MLO_DP_MLD_PEER(peer)) {
|
if (IS_MLO_DP_MLD_PEER(peer)) {
|
||||||
dp_mld_peer_init_link_peers_info(peer);
|
|
||||||
if (dp_txrx_peer_attach(soc, peer) !=
|
if (dp_txrx_peer_attach(soc, peer) !=
|
||||||
QDF_STATUS_SUCCESS)
|
QDF_STATUS_SUCCESS)
|
||||||
goto fail; /* failure */
|
goto fail; /* failure */
|
||||||
|
|
||||||
|
dp_mld_peer_init_link_peers_info(peer);
|
||||||
} else if (dp_monitor_peer_attach(soc, peer) !=
|
} else if (dp_monitor_peer_attach(soc, peer) !=
|
||||||
QDF_STATUS_SUCCESS)
|
QDF_STATUS_SUCCESS)
|
||||||
dp_warn("peer monitor ctx alloc failed");
|
dp_warn("peer monitor ctx alloc failed");
|
||||||
@@ -7360,8 +7365,10 @@ dp_peer_setup_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
|
|||||||
|
|
||||||
if (!setup_info)
|
if (!setup_info)
|
||||||
if (dp_peer_legacy_setup(soc, peer) !=
|
if (dp_peer_legacy_setup(soc, peer) !=
|
||||||
QDF_STATUS_SUCCESS)
|
QDF_STATUS_SUCCESS) {
|
||||||
|
status = QDF_STATUS_E_RESOURCES;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
if (peer->bss_peer && vdev->opmode == wlan_op_mode_ap) {
|
if (peer->bss_peer && vdev->opmode == wlan_op_mode_ap) {
|
||||||
status = QDF_STATUS_E_FAILURE;
|
status = QDF_STATUS_E_FAILURE;
|
||||||
@@ -7995,10 +8002,7 @@ void dp_peer_unref_delete(struct dp_peer *peer, enum dp_mod_id mod_id)
|
|||||||
|
|
||||||
qdf_spinlock_destroy(&peer->peer_state_lock);
|
qdf_spinlock_destroy(&peer->peer_state_lock);
|
||||||
|
|
||||||
/* dp_txrx_peer exists for mld peer and legacy peer */
|
|
||||||
if (peer->txrx_peer)
|
|
||||||
dp_txrx_peer_detach(soc, peer);
|
dp_txrx_peer_detach(soc, peer);
|
||||||
|
|
||||||
qdf_mem_free(peer);
|
qdf_mem_free(peer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user