From b07b6563872e0d45652e096298930633b9ea680c Mon Sep 17 00:00:00 2001 From: gaolez Date: Tue, 2 Feb 2021 10:28:04 +0800 Subject: [PATCH] qcacmn: Optimize congestion calculation logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In current code logic, in case of channel utilization value is 0, the congestion value treated as “not present” and give it a medium score. This will cause a very clean channel get a medium score. To fix the issue, need calculated congestion score from 1-100 and not 0-100. Change-Id: Iff030cf4a682d6e585d6f812a522cb8b6683cc44 CRs-Fixed: 2812978 --- umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c b/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c index 01156ba4d635..23a0d84fcdfe 100644 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c +++ b/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -415,7 +415,9 @@ static int32_t cm_get_congestion_pct(struct scan_cache_entry *entry) */ congestion = CM_MAX_CHANNEL_UTILIZATION - est_air_time_percentage; - } else if (entry->qbss_chan_load) { + if (!congestion) + congestion = 1; + } else if (util_scan_entry_qbssload(entry)) { ap_load = (entry->qbss_chan_load * CM_MAX_PCT_SCORE); /* * Calculate ap_load in % from qbss channel load from