qcacmn: Enable wbuff support for WMI
Register WMI with wbuff for pre-allocation of skbs. Register at wmi_unified_attach() and de-register at wmi wmi_unified_detach(). Change-Id: I9d6df1a8480324dd2a258de12672669a8fbe8940 CRs-Fixed: 2313935
This commit is contained in:

committed by
nshrivas

parent
a1860003dd
commit
1f18454889
@@ -30,6 +30,7 @@
|
|||||||
#include <wmi_unified.h>
|
#include <wmi_unified.h>
|
||||||
#endif
|
#endif
|
||||||
#include "qdf_atomic.h"
|
#include "qdf_atomic.h"
|
||||||
|
#include <wbuff.h>
|
||||||
|
|
||||||
#ifdef CONVERGED_P2P_ENABLE
|
#ifdef CONVERGED_P2P_ENABLE
|
||||||
#include <wlan_p2p_public_struct.h>
|
#include <wlan_p2p_public_struct.h>
|
||||||
@@ -1795,6 +1796,7 @@ struct wmi_host_abi_version {
|
|||||||
struct wmi_unified {
|
struct wmi_unified {
|
||||||
void *scn_handle; /* handle to device */
|
void *scn_handle; /* handle to device */
|
||||||
osdev_t osdev; /* handle to use OS-independent services */
|
osdev_t osdev; /* handle to use OS-independent services */
|
||||||
|
struct wbuff_mod_handle *wbuff_handle; /* handle to wbuff */
|
||||||
qdf_atomic_t pending_cmds;
|
qdf_atomic_t pending_cmds;
|
||||||
HTC_ENDPOINT_ID wmi_endpoint_id;
|
HTC_ENDPOINT_ID wmi_endpoint_id;
|
||||||
uint16_t max_msg_len;
|
uint16_t max_msg_len;
|
||||||
|
@@ -352,6 +352,16 @@ typedef PREPACK struct {
|
|||||||
|
|
||||||
#define WMI_MIN_HEAD_ROOM 64
|
#define WMI_MIN_HEAD_ROOM 64
|
||||||
|
|
||||||
|
/* WBUFF pool sizes for WMI */
|
||||||
|
/* Allocation of size 256 bytes */
|
||||||
|
#define WMI_WBUFF_POOL_0_SIZE 128
|
||||||
|
/* Allocation of size 512 bytes */
|
||||||
|
#define WMI_WBUFF_POOL_1_SIZE 16
|
||||||
|
/* Allocation of size 1024 bytes */
|
||||||
|
#define WMI_WBUFF_POOL_2_SIZE 8
|
||||||
|
/* Allocation of size 2048 bytes */
|
||||||
|
#define WMI_WBUFF_POOL_3_SIZE 8
|
||||||
|
|
||||||
#ifdef WMI_INTERFACE_EVENT_LOGGING
|
#ifdef WMI_INTERFACE_EVENT_LOGGING
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))
|
||||||
/* TODO Cleanup this backported function */
|
/* TODO Cleanup this backported function */
|
||||||
@@ -1462,10 +1472,13 @@ wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint32_t len, uint8_t *file_name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wmi_buf = wbuff_buff_get(wmi_handle->wbuff_handle, len);
|
||||||
|
if (!wmi_buf)
|
||||||
wmi_buf = qdf_nbuf_alloc_debug(NULL,
|
wmi_buf = qdf_nbuf_alloc_debug(NULL,
|
||||||
roundup(len + WMI_MIN_HEAD_ROOM, 4),
|
roundup(len + WMI_MIN_HEAD_ROOM,
|
||||||
WMI_MIN_HEAD_ROOM, 4, false, file_name,
|
4),
|
||||||
line_num);
|
WMI_MIN_HEAD_ROOM, 4, false,
|
||||||
|
file_name, line_num);
|
||||||
|
|
||||||
if (!wmi_buf)
|
if (!wmi_buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1484,6 +1497,8 @@ qdf_export_symbol(wmi_buf_alloc_debug);
|
|||||||
|
|
||||||
void wmi_buf_free(wmi_buf_t net_buf)
|
void wmi_buf_free(wmi_buf_t net_buf)
|
||||||
{
|
{
|
||||||
|
net_buf = wbuff_buff_put(net_buf);
|
||||||
|
if (net_buf)
|
||||||
qdf_nbuf_free(net_buf);
|
qdf_nbuf_free(net_buf);
|
||||||
}
|
}
|
||||||
qdf_export_symbol(wmi_buf_free);
|
qdf_export_symbol(wmi_buf_free);
|
||||||
@@ -1499,8 +1514,12 @@ wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wmi_buf = qdf_nbuf_alloc_fl(NULL, roundup(len + WMI_MIN_HEAD_ROOM, 4),
|
wmi_buf = wbuff_buff_get(wmi_handle->wbuff_handle, len);
|
||||||
WMI_MIN_HEAD_ROOM, 4, false, func, line);
|
if (!wmi_buf)
|
||||||
|
wmi_buf = qdf_nbuf_alloc_fl(NULL, roundup(len +
|
||||||
|
WMI_MIN_HEAD_ROOM, 4), WMI_MIN_HEAD_ROOM, 4,
|
||||||
|
false, func, line);
|
||||||
|
|
||||||
if (!wmi_buf)
|
if (!wmi_buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1517,6 +1536,8 @@ qdf_export_symbol(wmi_buf_alloc_fl);
|
|||||||
|
|
||||||
void wmi_buf_free(wmi_buf_t net_buf)
|
void wmi_buf_free(wmi_buf_t net_buf)
|
||||||
{
|
{
|
||||||
|
net_buf = wbuff_buff_put(net_buf);
|
||||||
|
if (net_buf)
|
||||||
qdf_nbuf_free(net_buf);
|
qdf_nbuf_free(net_buf);
|
||||||
}
|
}
|
||||||
qdf_export_symbol(wmi_buf_free);
|
qdf_export_symbol(wmi_buf_free);
|
||||||
@@ -2392,6 +2413,41 @@ void wmi_unified_register_module(enum wmi_target_type target_type,
|
|||||||
}
|
}
|
||||||
qdf_export_symbol(wmi_unified_register_module);
|
qdf_export_symbol(wmi_unified_register_module);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wmi_wbuff_register() - register wmi with wbuff
|
||||||
|
* @wmi_handle: handle to wmi
|
||||||
|
*
|
||||||
|
* @Return: void
|
||||||
|
*/
|
||||||
|
static void wmi_wbuff_register(struct wmi_unified *wmi_handle)
|
||||||
|
{
|
||||||
|
struct wbuff_alloc_request wbuff_alloc[4];
|
||||||
|
|
||||||
|
wbuff_alloc[0].slot = WBUFF_POOL_0;
|
||||||
|
wbuff_alloc[0].size = WMI_WBUFF_POOL_0_SIZE;
|
||||||
|
wbuff_alloc[1].slot = WBUFF_POOL_1;
|
||||||
|
wbuff_alloc[1].size = WMI_WBUFF_POOL_1_SIZE;
|
||||||
|
wbuff_alloc[2].slot = WBUFF_POOL_2;
|
||||||
|
wbuff_alloc[2].size = WMI_WBUFF_POOL_2_SIZE;
|
||||||
|
wbuff_alloc[3].slot = WBUFF_POOL_3;
|
||||||
|
wbuff_alloc[3].size = WMI_WBUFF_POOL_3_SIZE;
|
||||||
|
|
||||||
|
wmi_handle->wbuff_handle = wbuff_module_register(wbuff_alloc, 4,
|
||||||
|
WMI_MIN_HEAD_ROOM, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wmi_wbuff_deregister() - deregister wmi with wbuff
|
||||||
|
* @wmi_handle: handle to wmi
|
||||||
|
*
|
||||||
|
* @Return: void
|
||||||
|
*/
|
||||||
|
static inline void wmi_wbuff_deregister(struct wmi_unified *wmi_handle)
|
||||||
|
{
|
||||||
|
wbuff_module_deregister(wmi_handle->wbuff_handle);
|
||||||
|
wmi_handle->wbuff_handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wmi_unified_attach() - attach for unified WMI
|
* wmi_unified_attach() - attach for unified WMI
|
||||||
* @scn_handle: handle to SCN
|
* @scn_handle: handle to SCN
|
||||||
@@ -2478,6 +2534,8 @@ void *wmi_unified_attach(void *scn_handle,
|
|||||||
if (wmi_ext_dbgfs_init(wmi_handle) != QDF_STATUS_SUCCESS)
|
if (wmi_ext_dbgfs_init(wmi_handle) != QDF_STATUS_SUCCESS)
|
||||||
WMI_LOGE("failed to initialize wmi extended debugfs");
|
WMI_LOGE("failed to initialize wmi extended debugfs");
|
||||||
|
|
||||||
|
wmi_wbuff_register(wmi_handle);
|
||||||
|
|
||||||
return wmi_handle;
|
return wmi_handle;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@@ -2500,7 +2558,10 @@ void wmi_unified_detach(struct wmi_unified *wmi_handle)
|
|||||||
struct wmi_soc *soc;
|
struct wmi_soc *soc;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
|
wmi_wbuff_deregister(wmi_handle);
|
||||||
|
|
||||||
wmi_ext_dbgfs_deinit(wmi_handle);
|
wmi_ext_dbgfs_deinit(wmi_handle);
|
||||||
|
|
||||||
soc = wmi_handle->soc;
|
soc = wmi_handle->soc;
|
||||||
for (i = 0; i < WMI_MAX_RADIOS; i++) {
|
for (i = 0; i < WMI_MAX_RADIOS; i++) {
|
||||||
if (soc->wmi_pdev[i]) {
|
if (soc->wmi_pdev[i]) {
|
||||||
@@ -2621,7 +2682,7 @@ static void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt)
|
|||||||
buf_ptr = (u_int8_t *) wmi_buf_data(wmi_cmd_buf);
|
buf_ptr = (u_int8_t *) wmi_buf_data(wmi_cmd_buf);
|
||||||
len = qdf_nbuf_len(wmi_cmd_buf);
|
len = qdf_nbuf_len(wmi_cmd_buf);
|
||||||
qdf_mem_zero(buf_ptr, len);
|
qdf_mem_zero(buf_ptr, len);
|
||||||
qdf_nbuf_free(wmi_cmd_buf);
|
wmi_buf_free(wmi_cmd_buf);
|
||||||
qdf_mem_free(htc_pkt);
|
qdf_mem_free(htc_pkt);
|
||||||
qdf_atomic_dec(&wmi_handle->pending_cmds);
|
qdf_atomic_dec(&wmi_handle->pending_cmds);
|
||||||
}
|
}
|
||||||
|
@@ -975,7 +975,7 @@ QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi,
|
|||||||
WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) {
|
WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) {
|
||||||
WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID",
|
WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID",
|
||||||
__func__);
|
__func__);
|
||||||
qdf_nbuf_free(buf);
|
wmi_buf_free(buf);
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__,
|
WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__,
|
||||||
@@ -1022,7 +1022,7 @@ QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi,
|
|||||||
WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) {
|
WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) {
|
||||||
WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID",
|
WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID",
|
||||||
__func__);
|
__func__);
|
||||||
qdf_nbuf_free(buf);
|
wmi_buf_free(buf);
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__,
|
WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__,
|
||||||
@@ -14324,7 +14324,7 @@ QDF_STATUS send_enable_enhance_multicast_offload_tlv(
|
|||||||
status = wmi_unified_cmd_send(wmi_handle, buf,
|
status = wmi_unified_cmd_send(wmi_handle, buf,
|
||||||
sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID);
|
sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID);
|
||||||
if (status != QDF_STATUS_SUCCESS) {
|
if (status != QDF_STATUS_SUCCESS) {
|
||||||
qdf_nbuf_free(buf);
|
wmi_buf_free(buf);
|
||||||
WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID",
|
WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
@@ -15373,7 +15373,7 @@ QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
|
if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
|
||||||
WMI_FWTEST_CMDID)) {
|
WMI_FWTEST_CMDID)) {
|
||||||
WMI_LOGP("%s: failed to send fw test command", __func__);
|
WMI_LOGP("%s: failed to send fw test command", __func__);
|
||||||
qdf_nbuf_free(wmi_buf);
|
wmi_buf_free(wmi_buf);
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user