From 8f9f317150acc78a47bb59bbb4a0654bd7606a2f Mon Sep 17 00:00:00 2001 From: Toastman Date: Sun, 8 Jan 2017 04:28:26 +0700 Subject: [PATCH] revert recent changes to rstats and cstats --- release/src/router/cstats/cstats.c | 13 ++----------- release/src/router/cstats/cstats.h | 2 +- release/src/router/rstats/rstats.c | 15 +++------------ 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/release/src/router/cstats/cstats.c b/release/src/router/cstats/cstats.c index 4f71d58d8a..c48ecad8c2 100644 --- a/release/src/router/cstats/cstats.c +++ b/release/src/router/cstats/cstats.c @@ -533,9 +533,6 @@ static void calc(void) { Node *ptr = NULL; Node test; - int wanup = 0; // 0 = FALSE, 1 = TRUE - long wanuptime = 0; // wanuptime in seconds - now = time(0); exclude = strdup(nvram_safe_get("cstats_exclude")); @@ -630,14 +627,8 @@ static void calc(void) { _dprintf("%s: counter[%d]=%llu ptr->last[%d]=%llu c=%llu sc=%llu\n", __FUNCTION__, i, counter[i], i, ptr->last[i], c, sc); #endif if (c < sc) { - wanup = check_wanup(); // router/shared/misc.c - wanuptime = check_wanup_time(); // router/shared/misc.c - diff = ((0xFFFFFFFFFFFFFFFFULL) - sc + 1) + c; - if(wanup && (wanuptime < (INTERVAL + 10))) diff = 0; - // if (diff > MAX_ROLLOVER) diff = 0; // 225 Mbyte / 120 sec => 15 MBit/s only with rollover - // If a rollover AND a reconnect within the last 130 sec (INTERVAL + 10) happend, set diff to 0 - // this will prevent IP Traffic peaks, for example with ADSL/PPPoE - // see https://www.linksysinfo.org/index.php?threads/tomato-toastmans-releases.36106/page-39#post-281722 + diff = (0xFFFFFFFF - sc) + c; + if (diff > MAX_ROLLOVER) diff = 0; } else { diff = c - sc; diff --git a/release/src/router/cstats/cstats.h b/release/src/router/cstats/cstats.h index 3b74a4ba66..fab0adae51 100644 --- a/release/src/router/cstats/cstats.h +++ b/release/src/router/cstats/cstats.h @@ -44,7 +44,7 @@ #define MAX_NSPEED ((24 * SHOUR) / INTERVAL) #define MAX_NDAILY 62 #define MAX_NMONTHLY 25 -//#define MAX_ROLLOVER (225 * M) //not needed anymore +#define MAX_ROLLOVER (225 * M) #define MAX_COUNTER 2 #define RX 0 diff --git a/release/src/router/rstats/rstats.c b/release/src/router/rstats/rstats.c index 5f35b28788..916d62d782 100644 --- a/release/src/router/rstats/rstats.c +++ b/release/src/router/rstats/rstats.c @@ -54,7 +54,7 @@ #define MAX_NDAILY 62 #define MAX_NMONTHLY 25 #define MAX_SPEED_IF 10 -//#define MAX_ROLLOVER (225 * M) //not needed anymore +#define MAX_ROLLOVER (225 * M) #define MAX_COUNTER 2 #define RX 0 @@ -601,9 +601,6 @@ static void calc(void) int n; char *exclude; - int wanup = 0; // 0 = FALSE, 1 = TRUE - long wanuptime = 0; // wanuptime in seconds - now = time(0); exclude = nvram_safe_get("rstats_exclude"); @@ -661,14 +658,8 @@ static void calc(void) c = counter[i]; sc = sp->last[i]; if (c < sc) { - wanup = check_wanup(); // router/shared/misc.c - wanuptime = check_wanup_time(); // router/shared/misc.c - diff = ((0xFFFFFFFFUL) - sc + 1) + c; - if(wanup && (wanuptime < (INTERVAL + 10))) diff = 0; - // if (diff > MAX_ROLLOVER) diff = 0; // 225 Mbyte / 120 sec => 15 MBit/s only with rollover - // If a rollover AND a reconnect within the last 130 sec (INTERVAL + 10) happend, set diff to 0 - // this will prevent traffic peaks, for example with ADSL/PPPoE - // see https://www.linksysinfo.org/index.php?threads/tomato-toastmans-releases.36106/page-39#post-281722 + diff = (0xFFFFFFFF - sc) + c; + if (diff > MAX_ROLLOVER) diff = 0; } else { diff = c - sc; -- 2.11.4.GIT