From 48a68e9d09e88e90a6ae8eacff0e16862b515f37 Mon Sep 17 00:00:00 2001 From: Deeksha Gupta Date: Thu, 7 Oct 2021 12:48:21 +0530 Subject: [PATCH] qcacld-3.0: Limit ROC for listen if NAN or NDI present In P2P, if NDP is present, limit max ROC duration to 400ms on DBS and 250ms on non-DBS case. If NAN is present, limit max ROC duration to 450ms on DBS and 300ms on non-DBS case. Change-Id: I2e943d2f55984464812bba16ca78dfab8681cf30 CRs-Fixed: 3046904 --- components/p2p/core/src/wlan_p2p_roc.c | 37 ++++++++++++++++++++++++-- components/p2p/core/src/wlan_p2p_roc.h | 4 +++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/components/p2p/core/src/wlan_p2p_roc.c b/components/p2p/core/src/wlan_p2p_roc.c index 62ae30badbae..7fa8a6c5b6ff 100644 --- a/components/p2p/core/src/wlan_p2p_roc.c +++ b/components/p2p/core/src/wlan_p2p_roc.c @@ -82,6 +82,8 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx) struct wlan_objmgr_vdev *vdev; struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj; uint32_t go_num; + uint8_t ndp_num = 0, nan_disc_enabled_num = 0; + bool is_dbs; vdev = wlan_objmgr_get_vdev_by_id_from_psoc( p2p_soc_obj->soc, roc_ctx->vdev_id, @@ -121,7 +123,18 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx) if (req->scan_req.dwell_time_passive < 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); + policy_mgr_mode_specific_num_active_sessions(p2p_soc_obj->soc, + QDF_NDI_MODE, + &ndp_num); + policy_mgr_mode_specific_num_active_sessions(p2p_soc_obj->soc, + QDF_NAN_DISC_MODE, + &nan_disc_enabled_num); + + p2p_debug("present go number:%d, NDP number:%d, NAN number:%d", + go_num, ndp_num, nan_disc_enabled_num); + + is_dbs = policy_mgr_is_hw_dbs_capable(p2p_soc_obj->soc); + if (go_num) req->scan_req.dwell_time_passive *= P2P_ROC_DURATION_MULTI_GO_PRESENT; @@ -131,8 +144,28 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx) /* this is to protect too huge value if some customers * give a higher value from supplicant */ - if (req->scan_req.dwell_time_passive > P2P_MAX_ROC_DURATION) + if (ndp_num) { + if (is_dbs && req->scan_req.dwell_time_passive > + P2P_MAX_ROC_DURATION_DBS_NDP_PRESENT) + req->scan_req.dwell_time_passive = + P2P_MAX_ROC_DURATION_DBS_NDP_PRESENT; + else if (!is_dbs && req->scan_req.dwell_time_passive > + P2P_MAX_ROC_DURATION_NON_DBS_NDP_PRESENT) + req->scan_req.dwell_time_passive = + P2P_MAX_ROC_DURATION_NON_DBS_NDP_PRESENT; + } else if (nan_disc_enabled_num) { + if (is_dbs && req->scan_req.dwell_time_passive > + P2P_MAX_ROC_DURATION_DBS_NAN_PRESENT) + req->scan_req.dwell_time_passive = + P2P_MAX_ROC_DURATION_DBS_NAN_PRESENT; + else if (!is_dbs && req->scan_req.dwell_time_passive > + P2P_MAX_ROC_DURATION_NON_DBS_NAN_PRESENT) + req->scan_req.dwell_time_passive = + P2P_MAX_ROC_DURATION_NON_DBS_NAN_PRESENT; + } else if (req->scan_req.dwell_time_passive > + P2P_MAX_ROC_DURATION) { req->scan_req.dwell_time_passive = P2P_MAX_ROC_DURATION; + } } p2p_debug("FW requested roc duration is:%d", req->scan_req.dwell_time_passive); diff --git a/components/p2p/core/src/wlan_p2p_roc.h b/components/p2p/core/src/wlan_p2p_roc.h index e82d8caee189..cfcb586d89c3 100644 --- a/components/p2p/core/src/wlan_p2p_roc.h +++ b/components/p2p/core/src/wlan_p2p_roc.h @@ -31,6 +31,10 @@ #define P2P_WAIT_CANCEL_ROC 1000 #define P2P_WAIT_CLEANUP_ROC 2000 #define P2P_MAX_ROC_DURATION 1500 +#define P2P_MAX_ROC_DURATION_DBS_NDP_PRESENT 400 +#define P2P_MAX_ROC_DURATION_NON_DBS_NDP_PRESENT 250 +#define P2P_MAX_ROC_DURATION_DBS_NAN_PRESENT 450 +#define P2P_MAX_ROC_DURATION_NON_DBS_NAN_PRESENT 300 #define P2P_ROC_DURATION_MULTI_GO_PRESENT 6 #define P2P_ROC_DURATION_MULTI_GO_ABSENT 10