wlan: Use time_after api to take care of jiffies wrap around
qcacld-2.0 to prima propagation
jiffies wrap around can cause the confusion that the threshold
time has has elapsed and thus raise false alarm for scan reject.
To fix this use time_after api to take care of jiffies wrap around.
Change-Id: I20c0abbcaab0bea8054c2f497f41e50572008a8c
CRs-Fixed: 2075451
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 5d505ab..2c94045 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -13430,22 +13430,23 @@
{
pHddCtx->last_scan_reject_session_id = curr_session_id;
pHddCtx->last_scan_reject_reason = curr_reason;
- pHddCtx->last_scan_reject_timestamp = jiffies_to_msecs(jiffies);
+ pHddCtx->last_scan_reject_timestamp =
+ jiffies_to_msecs(jiffies) + SCAN_REJECT_THRESHOLD_TIME;
pHddCtx->scan_reject_cnt = 0;
}
else
{
pHddCtx->scan_reject_cnt++;
- hddLog(LOGE, FL("Reject cnt %d time delta %lu ms"), pHddCtx->scan_reject_cnt,
- (jiffies_to_msecs(jiffies) -
+ hddLog(LOGE, FL("Session %d reason %d reject cnt %d threshold time has elapsed? %d"),
+ curr_session_id, curr_reason, pHddCtx->scan_reject_cnt,
+ vos_system_time_after(jiffies_to_msecs(jiffies),
pHddCtx->last_scan_reject_timestamp));
if ((pHddCtx->scan_reject_cnt >=
SCAN_REJECT_THRESHOLD) &&
- (jiffies_to_msecs(jiffies) -
- pHddCtx->last_scan_reject_timestamp) >=
- SCAN_REJECT_THRESHOLD_TIME)
+ vos_system_time_after(jiffies_to_msecs(jiffies),
+ pHddCtx->last_scan_reject_timestamp))
{
pHddCtx->last_scan_reject_timestamp = 0;
pHddCtx->scan_reject_cnt = 0;
diff --git a/CORE/VOSS/inc/vos_timer.h b/CORE/VOSS/inc/vos_timer.h
index 70a0977..12e2f7c 100644
--- a/CORE/VOSS/inc/vos_timer.h
+++ b/CORE/VOSS/inc/vos_timer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -326,6 +326,20 @@
------------------------------------------------------------------------*/
v_TIME_t vos_timer_get_system_ticks( v_VOID_t );
+/**
+ * vos_system_time_after() - Check if a is later than b
+ * @a: Time stamp value a
+ * @b: Time stamp value b
+ *
+ * Return:
+ * true if a is after b else false
+ */
+static inline bool vos_system_time_after(v_TIME_t a, v_TIME_t b)
+{
+ return (long)(b) - (long)(a) < 0;
+}
+
+
/*--------------------------------------------------------------------------