|
@@ -2383,109 +2383,6 @@ static int32_t wma_ieee80211_hdrsize(const void *data)
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * wmi_desc_pool_init() - Initialize the WMI descriptor pool
|
|
|
- * @wma_handle: handle to wma
|
|
|
- * @pool_size: Size of wma pool
|
|
|
- *
|
|
|
- * Return: 0 for success, error code on failure.
|
|
|
- */
|
|
|
-int wmi_desc_pool_init(tp_wma_handle wma_handle, uint32_t pool_size)
|
|
|
-{
|
|
|
- int i;
|
|
|
-
|
|
|
- if (!pool_size) {
|
|
|
- WMA_LOGE("%s: failed to allocate desc pool", __func__);
|
|
|
- qdf_assert_always(pool_size);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- WMA_LOGE("%s: initialize desc pool of size %d", __func__, pool_size);
|
|
|
- wma_handle->wmi_desc_pool.pool_size = pool_size;
|
|
|
- wma_handle->wmi_desc_pool.num_free = pool_size;
|
|
|
- wma_handle->wmi_desc_pool.array = qdf_mem_malloc(pool_size *
|
|
|
- sizeof(union wmi_desc_elem_t));
|
|
|
- if (!wma_handle->wmi_desc_pool.array) {
|
|
|
- WMA_LOGE("%s: failed to allocate desc pool", __func__);
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
- wma_handle->wmi_desc_pool.freelist = &wma_handle->
|
|
|
- wmi_desc_pool.array[0];
|
|
|
-
|
|
|
- for (i = 0; i < (pool_size - 1); i++) {
|
|
|
- wma_handle->wmi_desc_pool.array[i].wmi_desc.desc_id = i;
|
|
|
- wma_handle->wmi_desc_pool.array[i].next =
|
|
|
- &wma_handle->wmi_desc_pool.array[i + 1];
|
|
|
- }
|
|
|
-
|
|
|
- wma_handle->wmi_desc_pool.array[i].next = NULL;
|
|
|
- wma_handle->wmi_desc_pool.array[i].wmi_desc.desc_id = i;
|
|
|
-
|
|
|
- qdf_spinlock_create(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wmi_desc_pool_deinit() - Deinitialize the WMI descriptor pool
|
|
|
- * @wma_handle: handle to wma
|
|
|
- *
|
|
|
- * Return: None
|
|
|
- */
|
|
|
-void wmi_desc_pool_deinit(tp_wma_handle wma_handle)
|
|
|
-{
|
|
|
- qdf_spin_lock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
- if (wma_handle->wmi_desc_pool.array) {
|
|
|
- qdf_mem_free(wma_handle->wmi_desc_pool.array);
|
|
|
- wma_handle->wmi_desc_pool.array = NULL;
|
|
|
- } else {
|
|
|
- WMA_LOGE("%s: Empty WMI descriptor pool", __func__);
|
|
|
- }
|
|
|
-
|
|
|
- wma_handle->wmi_desc_pool.freelist = NULL;
|
|
|
- wma_handle->wmi_desc_pool.pool_size = 0;
|
|
|
- wma_handle->wmi_desc_pool.num_free = 0;
|
|
|
- qdf_spin_unlock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
- qdf_spinlock_destroy(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wmi_desc_get() - Get wmi descriptor from wmi free descriptor pool
|
|
|
- * @wma_handle: handle to wma
|
|
|
- *
|
|
|
- * Return: pointer to wmi descriptor, NULL on failure
|
|
|
- */
|
|
|
-struct wmi_desc_t *wmi_desc_get(tp_wma_handle wma_handle)
|
|
|
-{
|
|
|
- struct wmi_desc_t *wmi_desc = NULL;
|
|
|
-
|
|
|
- qdf_spin_lock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
- if (wma_handle->wmi_desc_pool.freelist) {
|
|
|
- wma_handle->wmi_desc_pool.num_free--;
|
|
|
- wmi_desc = &wma_handle->wmi_desc_pool.freelist->wmi_desc;
|
|
|
- wma_handle->wmi_desc_pool.freelist =
|
|
|
- wma_handle->wmi_desc_pool.freelist->next;
|
|
|
- }
|
|
|
- qdf_spin_unlock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
-
|
|
|
- return wmi_desc;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wmi_desc_put() - Put wmi descriptor to wmi free descriptor pool
|
|
|
- * @wma_handle: handle to wma
|
|
|
- * @wmi_desc: wmi descriptor
|
|
|
- *
|
|
|
- * Return: None
|
|
|
- */
|
|
|
-void wmi_desc_put(tp_wma_handle wma_handle, struct wmi_desc_t *wmi_desc)
|
|
|
-{
|
|
|
- qdf_spin_lock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
- ((union wmi_desc_elem_t *)wmi_desc)->next =
|
|
|
- wma_handle->wmi_desc_pool.freelist;
|
|
|
- wma_handle->wmi_desc_pool.freelist = (union wmi_desc_elem_t *)wmi_desc;
|
|
|
- wma_handle->wmi_desc_pool.num_free++;
|
|
|
- qdf_spin_unlock_bh(&wma_handle->wmi_desc_pool.wmi_desc_pool_lock);
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* wma_tx_packet() - Sends Tx Frame to TxRx
|
|
|
* @wma_context: wma context
|