qcacmn: Fix ext Tx descriptor pool lock issue
Replace internal spin_lock macros with qdf_spin_lock APIs for lock operating on TSO/EXT descriptor pools. TX_DESC_LOCK_* APIs are used only by the flow_control V2 support to by pass them. Change-Id: I926c279de3878b6f48efd798194fa896072c1f6d CRs-Fixed: 2142815
This commit is contained in:

committed by
snandini

parent
30927c532c
commit
ddf07405c5
@@ -246,7 +246,7 @@ QDF_STATUS dp_tx_ext_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
soc->tx_ext_desc[pool_id].num_free = num_elem;
|
soc->tx_ext_desc[pool_id].num_free = num_elem;
|
||||||
TX_DESC_LOCK_CREATE(&soc->tx_ext_desc[pool_id].lock);
|
qdf_spinlock_create(&soc->tx_ext_desc[pool_id].lock);
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
|
|
||||||
free_ext_link_desc_page:
|
free_ext_link_desc_page:
|
||||||
@@ -281,7 +281,7 @@ QDF_STATUS dp_tx_ext_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
|
|||||||
qdf_get_dma_mem_context((&soc->tx_ext_desc[pool_id]), memctx),
|
qdf_get_dma_mem_context((&soc->tx_ext_desc[pool_id]), memctx),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
TX_DESC_LOCK_DESTROY(&soc->tx_ext_desc[pool_id].lock);
|
qdf_spinlock_destroy(&soc->tx_ext_desc[pool_id].lock);
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ QDF_STATUS dp_tx_tso_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
|
|||||||
TSO_DEBUG("Number of free descriptors: %u\n",
|
TSO_DEBUG("Number of free descriptors: %u\n",
|
||||||
soc->tx_tso_desc[pool_id].num_free);
|
soc->tx_tso_desc[pool_id].num_free);
|
||||||
soc->tx_tso_desc[pool_id].pool_size = num_elem;
|
soc->tx_tso_desc[pool_id].pool_size = num_elem;
|
||||||
TX_DESC_LOCK_CREATE(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spinlock_create(&soc->tx_tso_desc[pool_id].lock);
|
||||||
|
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
|
|
||||||
@@ -359,11 +359,11 @@ void dp_tx_tso_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
|
|||||||
struct qdf_tso_seg_elem_t *c_element;
|
struct qdf_tso_seg_elem_t *c_element;
|
||||||
struct qdf_tso_seg_elem_t *temp;
|
struct qdf_tso_seg_elem_t *temp;
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
c_element = soc->tx_tso_desc[pool_id].freelist;
|
c_element = soc->tx_tso_desc[pool_id].freelist;
|
||||||
|
|
||||||
if (!c_element) {
|
if (!c_element) {
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
||||||
FL("Desc Pool Corrupt %d"), pool_id);
|
FL("Desc Pool Corrupt %d"), pool_id);
|
||||||
return;
|
return;
|
||||||
@@ -380,8 +380,8 @@ void dp_tx_tso_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
|
|||||||
soc->tx_tso_desc[pool_id].freelist = NULL;
|
soc->tx_tso_desc[pool_id].freelist = NULL;
|
||||||
soc->tx_tso_desc[pool_id].num_free = 0;
|
soc->tx_tso_desc[pool_id].num_free = 0;
|
||||||
soc->tx_tso_desc[pool_id].pool_size = 0;
|
soc->tx_tso_desc[pool_id].pool_size = 0;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
TX_DESC_LOCK_DESTROY(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spinlock_destroy(&soc->tx_tso_desc[pool_id].lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -429,7 +429,7 @@ QDF_STATUS dp_tx_tso_num_seg_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
soc->tx_tso_num_seg[pool_id].num_seg_pool_size = num_elem;
|
soc->tx_tso_num_seg[pool_id].num_seg_pool_size = num_elem;
|
||||||
TX_DESC_LOCK_CREATE(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spinlock_create(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
|
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
|
|
||||||
@@ -457,11 +457,11 @@ void dp_tx_tso_num_seg_pool_free(struct dp_soc *soc, uint8_t pool_id)
|
|||||||
struct qdf_tso_num_seg_elem_t *c_element;
|
struct qdf_tso_num_seg_elem_t *c_element;
|
||||||
struct qdf_tso_num_seg_elem_t *temp;
|
struct qdf_tso_num_seg_elem_t *temp;
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
c_element = soc->tx_tso_num_seg[pool_id].freelist;
|
c_element = soc->tx_tso_num_seg[pool_id].freelist;
|
||||||
|
|
||||||
if (!c_element) {
|
if (!c_element) {
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
||||||
FL("Desc Pool Corrupt %d"), pool_id);
|
FL("Desc Pool Corrupt %d"), pool_id);
|
||||||
return;
|
return;
|
||||||
@@ -478,8 +478,8 @@ void dp_tx_tso_num_seg_pool_free(struct dp_soc *soc, uint8_t pool_id)
|
|||||||
soc->tx_tso_num_seg[pool_id].freelist = NULL;
|
soc->tx_tso_num_seg[pool_id].freelist = NULL;
|
||||||
soc->tx_tso_num_seg[pool_id].num_free = 0;
|
soc->tx_tso_num_seg[pool_id].num_free = 0;
|
||||||
soc->tx_tso_num_seg[pool_id].num_seg_pool_size = 0;
|
soc->tx_tso_num_seg[pool_id].num_seg_pool_size = 0;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
TX_DESC_LOCK_DESTROY(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spinlock_destroy(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -367,16 +367,16 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
|
|||||||
{
|
{
|
||||||
struct dp_tx_ext_desc_elem_s *c_elem;
|
struct dp_tx_ext_desc_elem_s *c_elem;
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
if (soc->tx_ext_desc[desc_pool_id].num_free <= 0) {
|
if (soc->tx_ext_desc[desc_pool_id].num_free <= 0) {
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
c_elem = soc->tx_ext_desc[desc_pool_id].freelist;
|
c_elem = soc->tx_ext_desc[desc_pool_id].freelist;
|
||||||
soc->tx_ext_desc[desc_pool_id].freelist =
|
soc->tx_ext_desc[desc_pool_id].freelist =
|
||||||
soc->tx_ext_desc[desc_pool_id].freelist->next;
|
soc->tx_ext_desc[desc_pool_id].freelist->next;
|
||||||
soc->tx_ext_desc[desc_pool_id].num_free--;
|
soc->tx_ext_desc[desc_pool_id].num_free--;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
return c_elem;
|
return c_elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,11 +391,11 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
|
|||||||
static inline void dp_tx_ext_desc_free(struct dp_soc *soc,
|
static inline void dp_tx_ext_desc_free(struct dp_soc *soc,
|
||||||
struct dp_tx_ext_desc_elem_s *elem, uint8_t desc_pool_id)
|
struct dp_tx_ext_desc_elem_s *elem, uint8_t desc_pool_id)
|
||||||
{
|
{
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
elem->next = soc->tx_ext_desc[desc_pool_id].freelist;
|
elem->next = soc->tx_ext_desc[desc_pool_id].freelist;
|
||||||
soc->tx_ext_desc[desc_pool_id].freelist = elem;
|
soc->tx_ext_desc[desc_pool_id].freelist = elem;
|
||||||
soc->tx_ext_desc[desc_pool_id].num_free++;
|
soc->tx_ext_desc[desc_pool_id].num_free++;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,11 +431,11 @@ static inline void dp_tx_ext_desc_free_multiple(struct dp_soc *soc,
|
|||||||
/* caller should always guarantee atleast list of num_free nodes */
|
/* caller should always guarantee atleast list of num_free nodes */
|
||||||
qdf_assert_always(tail);
|
qdf_assert_always(tail);
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
tail->next = soc->tx_ext_desc[desc_pool_id].freelist;
|
tail->next = soc->tx_ext_desc[desc_pool_id].freelist;
|
||||||
soc->tx_ext_desc[desc_pool_id].freelist = head;
|
soc->tx_ext_desc[desc_pool_id].freelist = head;
|
||||||
soc->tx_ext_desc[desc_pool_id].num_free += num_free;
|
soc->tx_ext_desc[desc_pool_id].num_free += num_free;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -456,14 +456,14 @@ static inline struct qdf_tso_seg_elem_t *dp_tx_tso_desc_alloc(
|
|||||||
{
|
{
|
||||||
struct qdf_tso_seg_elem_t *tso_seg = NULL;
|
struct qdf_tso_seg_elem_t *tso_seg = NULL;
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
if (soc->tx_tso_desc[pool_id].freelist) {
|
if (soc->tx_tso_desc[pool_id].freelist) {
|
||||||
soc->tx_tso_desc[pool_id].num_free--;
|
soc->tx_tso_desc[pool_id].num_free--;
|
||||||
tso_seg = soc->tx_tso_desc[pool_id].freelist;
|
tso_seg = soc->tx_tso_desc[pool_id].freelist;
|
||||||
soc->tx_tso_desc[pool_id].freelist =
|
soc->tx_tso_desc[pool_id].freelist =
|
||||||
soc->tx_tso_desc[pool_id].freelist->next;
|
soc->tx_tso_desc[pool_id].freelist->next;
|
||||||
}
|
}
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
|
|
||||||
return tso_seg;
|
return tso_seg;
|
||||||
}
|
}
|
||||||
@@ -482,11 +482,11 @@ static inline struct qdf_tso_seg_elem_t *dp_tx_tso_desc_alloc(
|
|||||||
static inline void dp_tx_tso_desc_free(struct dp_soc *soc,
|
static inline void dp_tx_tso_desc_free(struct dp_soc *soc,
|
||||||
uint8_t pool_id, struct qdf_tso_seg_elem_t *tso_seg)
|
uint8_t pool_id, struct qdf_tso_seg_elem_t *tso_seg)
|
||||||
{
|
{
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
tso_seg->next = soc->tx_tso_desc[pool_id].freelist;
|
tso_seg->next = soc->tx_tso_desc[pool_id].freelist;
|
||||||
soc->tx_tso_desc[pool_id].freelist = tso_seg;
|
soc->tx_tso_desc[pool_id].freelist = tso_seg;
|
||||||
soc->tx_tso_desc[pool_id].num_free++;
|
soc->tx_tso_desc[pool_id].num_free++;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
@@ -495,14 +495,14 @@ struct qdf_tso_num_seg_elem_t *dp_tso_num_seg_alloc(struct dp_soc *soc,
|
|||||||
{
|
{
|
||||||
struct qdf_tso_num_seg_elem_t *tso_num_seg = NULL;
|
struct qdf_tso_num_seg_elem_t *tso_num_seg = NULL;
|
||||||
|
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
if (soc->tx_tso_num_seg[pool_id].freelist) {
|
if (soc->tx_tso_num_seg[pool_id].freelist) {
|
||||||
soc->tx_tso_num_seg[pool_id].num_free--;
|
soc->tx_tso_num_seg[pool_id].num_free--;
|
||||||
tso_num_seg = soc->tx_tso_num_seg[pool_id].freelist;
|
tso_num_seg = soc->tx_tso_num_seg[pool_id].freelist;
|
||||||
soc->tx_tso_num_seg[pool_id].freelist =
|
soc->tx_tso_num_seg[pool_id].freelist =
|
||||||
soc->tx_tso_num_seg[pool_id].freelist->next;
|
soc->tx_tso_num_seg[pool_id].freelist->next;
|
||||||
}
|
}
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
|
|
||||||
return tso_num_seg;
|
return tso_num_seg;
|
||||||
}
|
}
|
||||||
@@ -511,11 +511,11 @@ static inline
|
|||||||
void dp_tso_num_seg_free(struct dp_soc *soc,
|
void dp_tso_num_seg_free(struct dp_soc *soc,
|
||||||
uint8_t pool_id, struct qdf_tso_num_seg_elem_t *tso_num_seg)
|
uint8_t pool_id, struct qdf_tso_num_seg_elem_t *tso_num_seg)
|
||||||
{
|
{
|
||||||
TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
tso_num_seg->next = soc->tx_tso_num_seg[pool_id].freelist;
|
tso_num_seg->next = soc->tx_tso_num_seg[pool_id].freelist;
|
||||||
soc->tx_tso_num_seg[pool_id].freelist = tso_num_seg;
|
soc->tx_tso_num_seg[pool_id].freelist = tso_num_seg;
|
||||||
soc->tx_tso_num_seg[pool_id].num_free++;
|
soc->tx_tso_num_seg[pool_id].num_free++;
|
||||||
TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
|
qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user