From 0f9f01950586ec5c5243fa221bdb5c7448e70b49 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 4 Dec 2018 19:55:15 +0530 Subject: [PATCH] qcacmn: Fix memory allocation latency in beacon process Currently if the number of APs in the STA environment are many, then the STA will receive many beacons, whose beacon process path can take long time, in the kernel work queue, hence the other processes have to wait for them to complete, and may get timeout, if the the time to process the beaocns is larger than their process timeout. Fix is to :- 1. Add rate limit to failure conditions of memory not allocated 2. Make memory allocation in path of beacon process atomic. Change-Id: I0b15fd4924bb7d696a33adeb1875f1f9c277db18 CRs-Fixed: 2360624 --- .../mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c | 5 +++-- umac/p2p/core/src/wlan_p2p_main.h | 3 +++ umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c | 8 ++++---- umac/scan/dispatcher/src/wlan_scan_tgt_api.c | 4 ++-- umac/tdls/core/src/wlan_tdls_main.h | 3 +++ umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c | 8 ++++---- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c index e59d429692a1..dc11fe93faa3 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c @@ -809,9 +809,10 @@ static QDF_STATUS wlan_mgmt_txrx_rx_handler_list_copy( struct mgmt_rx_handler *rx_handler_node; while (rx_handler) { - rx_handler_node = qdf_mem_malloc(sizeof(*rx_handler_node)); + rx_handler_node = + qdf_mem_malloc_atomic(sizeof(*rx_handler_node)); if (!rx_handler_node) { - mgmt_txrx_err("Couldn't allocate memory for rx handler node"); + mgmt_txrx_err_rl("Couldn't allocate memory for rx handler node"); return QDF_STATUS_E_NOMEM; } diff --git a/umac/p2p/core/src/wlan_p2p_main.h b/umac/p2p/core/src/wlan_p2p_main.h index 6a6632c44e3d..61921d910a2b 100644 --- a/umac/p2p/core/src/wlan_p2p_main.h +++ b/umac/p2p/core/src/wlan_p2p_main.h @@ -44,6 +44,9 @@ QDF_TRACE_WARN(QDF_MODULE_ID_P2P, params) #define p2p_err(params ...) \ QDF_TRACE_ERROR(QDF_MODULE_ID_P2P, params) +#define p2p_debug_rl(params...) \ + QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_P2P, params) + #define p2p_alert(params ...) \ QDF_TRACE_FATAL(QDF_MODULE_ID_P2P, params) diff --git a/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c b/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c index d6ee448947eb..7bf08c9a4e04 100644 --- a/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c +++ b/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c @@ -331,17 +331,17 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, vdev_id = wlan_vdev_get_id(vdev); } - rx_mgmt_event = qdf_mem_malloc(sizeof(*rx_mgmt_event)); + rx_mgmt_event = qdf_mem_malloc_atomic(sizeof(*rx_mgmt_event)); if (!rx_mgmt_event) { - p2p_err("Failed to allocate rx mgmt event"); + p2p_debug_rl("Failed to allocate rx mgmt event"); qdf_nbuf_free(buf); return QDF_STATUS_E_NOMEM; } - rx_mgmt = qdf_mem_malloc(sizeof(*rx_mgmt) + + rx_mgmt = qdf_mem_malloc_atomic(sizeof(*rx_mgmt) + mgmt_rx_params->buf_len); if (!rx_mgmt) { - p2p_err("Failed to allocate rx mgmt frame"); + p2p_debug_rl("Failed to allocate rx mgmt frame"); qdf_nbuf_free(buf); return QDF_STATUS_E_NOMEM; } diff --git a/umac/scan/dispatcher/src/wlan_scan_tgt_api.c b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c index 53dca352437d..63cdd11659f2 100644 --- a/umac/scan/dispatcher/src/wlan_scan_tgt_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c @@ -272,14 +272,14 @@ QDF_STATUS tgt_scan_bcn_probe_rx_callback(struct wlan_objmgr_psoc *psoc, bcn = qdf_mem_malloc_atomic(sizeof(*bcn)); if (!bcn) { - scm_err("Failed to allocate memory for bcn"); + scm_debug_rl("Failed to allocate memory for bcn"); status = QDF_STATUS_E_NOMEM; goto free; } bcn->rx_data = qdf_mem_malloc_atomic(sizeof(*rx_param)); if (!bcn->rx_data) { - scm_err("Failed to allocate memory for rx_data"); + scm_debug_rl("Failed to allocate memory for rx_data"); status = QDF_STATUS_E_NOMEM; goto free; } diff --git a/umac/tdls/core/src/wlan_tdls_main.h b/umac/tdls/core/src/wlan_tdls_main.h index c03eb16abf36..ed5c1ab2cd82 100644 --- a/umac/tdls/core/src/wlan_tdls_main.h +++ b/umac/tdls/core/src/wlan_tdls_main.h @@ -59,6 +59,9 @@ #define tdls_debug(params...) \ QDF_TRACE_DEBUG(QDF_MODULE_ID_TDLS, params) +#define tdls_debug_rl(params...) \ + QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_TDLS, params) + #define tdls_notice(params...) \ QDF_TRACE_INFO(QDF_MODULE_ID_TDLS, params) #define tdls_warn(params...) \ diff --git a/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c b/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c index bb09a0e8b4a1..36741925ce36 100644 --- a/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c +++ b/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c @@ -289,16 +289,16 @@ QDF_STATUS tgt_tdls_mgmt_frame_process_rx_cb( vdev_id = wlan_vdev_get_id(vdev); } - rx_mgmt_event = qdf_mem_malloc(sizeof(*rx_mgmt_event)); + rx_mgmt_event = qdf_mem_malloc_atomic(sizeof(*rx_mgmt_event)); if (!rx_mgmt_event) { - tdls_err("Failed to allocate rx mgmt event"); + tdls_debug_rl("Failed to allocate rx mgmt event"); return QDF_STATUS_E_NOMEM; } - rx_mgmt = qdf_mem_malloc(sizeof(*rx_mgmt) + + rx_mgmt = qdf_mem_malloc_atomic(sizeof(*rx_mgmt) + mgmt_rx_params->buf_len); if (!rx_mgmt) { - tdls_err("Failed to allocate rx mgmt frame"); + tdls_debug_rl("Failed to allocate rx mgmt frame"); qdf_mem_free(rx_mgmt_event); return QDF_STATUS_E_NOMEM; }