From 2f608c555a269e85a3fb2468da7b80b2e25e0f63 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Thu, 6 Sep 2018 19:01:13 +0800 Subject: [PATCH] qcacmn: Do not remove id when tx action frame Don't remove id tx action frame, since it will be removed when cleanup related ROC. Limit the ROC duration if the original ROC duration is very long. Change-Id: I78e34710530a32f88e955471c974f7078df2e0a9 CRs-Fixed: 2302008 --- umac/p2p/core/src/wlan_p2p_off_chan_tx.c | 5 ++++- umac/p2p/core/src/wlan_p2p_roc.c | 22 +++++++++++++-------- umac/p2p/core/src/wlan_p2p_roc.h | 11 +++-------- umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c | 3 ++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c index 275442a70850..73e53e78b3ad 100644 --- a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c +++ b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c @@ -966,6 +966,7 @@ static QDF_STATUS p2p_roc_req_for_tx_action( roc_ctx->roc_state = ROC_STATE_IDLE; roc_ctx->roc_type = OFF_CHANNEL_TX; roc_ctx->tx_ctx = tx_ctx; + roc_ctx->id = tx_ctx->id; tx_ctx->roc_cookie = (uintptr_t)roc_ctx; p2p_debug("create roc request for off channel tx, tx ctx:%pK, roc ctx:%pK", @@ -1244,7 +1245,8 @@ static QDF_STATUS p2p_remove_tx_context( } end: - qdf_idr_remove(&p2p_soc_obj->p2p_idr, tx_ctx->id); + if (!tx_ctx->roc_cookie) + qdf_idr_remove(&p2p_soc_obj->p2p_idr, tx_ctx->id); qdf_mem_free(tx_ctx->buf); qdf_mem_free(tx_ctx); @@ -1885,6 +1887,7 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx) fail: p2p_send_tx_conf(tx_ctx, false); + qdf_idr_remove(&p2p_soc_obj->p2p_idr, tx_ctx->id); qdf_mem_free(tx_ctx->buf); qdf_mem_free(tx_ctx); diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 13b85f291e6e..7a1e35842894 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -365,14 +365,20 @@ static QDF_STATUS p2p_execute_roc_req(struct p2p_roc_context *roc_ctx) } roc_ctx->roc_state = ROC_STATE_REQUESTED; - go_num = policy_mgr_mode_specific_connection_count( - p2p_soc_obj->soc, PM_P2P_GO_MODE, NULL); - p2p_debug("present go number:%d", go_num); - if (go_num) - roc_ctx->duration *= P2P_ROC_DURATION_MULTI_GO_PRESENT; - else - roc_ctx->duration *= P2P_ROC_DURATION_MULTI_GO_ABSENT; - + if (roc_ctx->duration < P2P_MAX_ROC_DURATION) { + go_num = policy_mgr_mode_specific_connection_count( + p2p_soc_obj->soc, PM_P2P_GO_MODE, NULL); + p2p_debug("present go number:%d", go_num); + if (go_num) + roc_ctx->duration *= P2P_ROC_DURATION_MULTI_GO_PRESENT; + else + roc_ctx->duration *= P2P_ROC_DURATION_MULTI_GO_ABSENT; + /* this is to protect too huge value if some customers + * give a higher value from supplicant + */ + if (roc_ctx->duration > P2P_MAX_ROC_DURATION) + roc_ctx->duration = P2P_MAX_ROC_DURATION; + } status = p2p_scan_start(roc_ctx); if (status != QDF_STATUS_SUCCESS) { qdf_mc_timer_destroy(&roc_ctx->roc_timer); diff --git a/umac/p2p/core/src/wlan_p2p_roc.h b/umac/p2p/core/src/wlan_p2p_roc.h index 2bce9a4b68b5..5e49b1497647 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.h +++ b/umac/p2p/core/src/wlan_p2p_roc.h @@ -30,16 +30,11 @@ #define P2P_EVENT_PROPAGATE_TIME 10 #define P2P_WAIT_CANCEL_ROC 1000 #define P2P_WAIT_CLEANUP_ROC 2000 +#define P2P_MAX_ROC_DURATION 1500 -#ifdef QCA_WIFI_3_0_EMU -#define P2P_ROC_DURATION_MULTI_GO_PRESENT 2 -#define P2P_ROC_DURATION_MULTI_GO_ABSENT 3 -#define P2P_ACTION_FRAME_DEFAULT_WAIT 500 -#else -#define P2P_ROC_DURATION_MULTI_GO_PRESENT 2 -#define P2P_ROC_DURATION_MULTI_GO_ABSENT 5 +#define P2P_ROC_DURATION_MULTI_GO_PRESENT 6 +#define P2P_ROC_DURATION_MULTI_GO_ABSENT 10 #define P2P_ACTION_FRAME_DEFAULT_WAIT 200 -#endif struct wlan_objmgr_vdev; struct scan_event; diff --git a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c index cfeddc9967c4..70ff4c660698 100644 --- a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c +++ b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c @@ -392,10 +392,11 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc, } if (QDF_STATUS_SUCCESS != qdf_idr_find(&p2p_soc_obj->p2p_idr, - cookie, &tx_ctx)) { + (int32_t)cookie, &tx_ctx)) { p2p_debug("invalid id"); return QDF_STATUS_E_INVAL; } + qdf_idr_remove(&p2p_soc_obj->p2p_idr, (int32_t)cookie); cancel_tx = qdf_mem_malloc(sizeof(*cancel_tx)); if (!cancel_tx) {