From patchwork Mon Apr 25 19:52:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1622094 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=zKaUyx74; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=Nuwyhspx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KnG40580Qz9s75 for ; Tue, 26 Apr 2022 05:56:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DOa2maL5pcAsRWOvPWq5+zQruYVEHljKK3BUO5HuuwI=; b=zKaUyx74M1UqbC RyAsurM2w/dcX9+b5kL9l3CZNxKfNyPNhhrInC/ZCyMzJ5v8lZQxzgQ9edWuX5MtG4XUc1u+BnILQ 4mmGw0AemSFfdaHAFJiPJ1ARPNDjXTcgowfOcGem0x0OosKNhnSOQjCjQkH29gQLdcNvsIU968v5/ GoCRFPJM4ZrcWvDp7dDuY08D4+O7+H/zOZBNnfrScAubPGmwiq01gBkFF6EmVC/hef/uwjSy3Gpev TlzYbhuHYVgb8BVV51xcEEqp7z6DxEs+DHypyroWYRdiUXwTfAvC6e8aa1YNqLINGtsqITdN16viX WAlWdoco4zGGKuzVS8DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj4lc-00B86t-Fa; Mon, 25 Apr 2022 19:53:04 +0000 Received: from srv4.3e8.eu ([2001:67c:12a0:200::2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj4lW-00B85x-Mk for openwrt-devel@lists.openwrt.org; Mon, 25 Apr 2022 19:53:02 +0000 Received: from localhost.localdomain (p200300c6cf0bcda0690c5f3ae20a695a.dip0.t-ipconnect.de [IPv6:2003:c6:cf0b:cda0:690c:5f3a:e20a:695a]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id 9716D600E8; Mon, 25 Apr 2022 21:52:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1650916376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qNP0WViJKJWo+jVyU1FDTtFbKwSE8VEePd/Z+DCLuaE=; b=NuwyhspxNJN5797nkN0Bc4EOHn70ASF3WSemP84CGgXeFWL2ltY6MO5mYxZSSwK352NbaU ndCuujjyW7dIqsT2xJbORmv/zJfv/QhsKVebDWA94gojTwRh6I3Wuh1zFhi1DvTLaSBC/w NQlvN90x4tKcZajomvOUCVk6NK+wyIKZYTwTiw9uFOBVF7drS5l/YvGgKVM1d+jzdV4t9T mhyT3r0F1gHEerhUCyrz+3b3dXFcQNTW6HR6whnEp6uKHenG/LpoE5zEilzRU6Yy6Rd3vN urSkxIqao/QrO6IEtHCSI/tSHqkXHWgHQXuSCzsL9j1TpvIZPOCCohlpIz+7Bw== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Jan Hoffmann Subject: [PATCH] ltq-vdsl/ltq-adsl: fix elapsed time calculation Date: Mon, 25 Apr 2022 21:52:39 +0200 Message-Id: <20220425195239.1228052-1-jan@3e8.eu> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220425_125259_078309_535C2E50 X-CRM114-Status: GOOD ( 17.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The driver maintains elapsed times by repeatedly accumulating the time since the previous update in a loop. For the elapsed showtime time, the time difference is truncated to seconds before adding it, [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The driver maintains elapsed times by repeatedly accumulating the time since the previous update in a loop. For the elapsed showtime time, the time difference is truncated to seconds before adding it, leading to a sizable error over time. Move the truncation to before calculation of the time difference in order to remove this error. Also maintain the total elapsed time in the same way in full seconds, to prevent the unsigned 32-bit counter from wrapping around after about 50 days. Testing on a VR9 device shows that the reported line uptime now matches the actual elapsed wall time. The ADSL variant is only compile-tested, but it should also work as the relevant code is identical. Signed-off-by: Jan Hoffmann Tested-by: Martin Blumenstingl --- package/kernel/lantiq/ltq-adsl/Makefile | 2 +- .../patches/200-fix-elapsed-time.patch | 122 ++++++++++++++++++ package/kernel/lantiq/ltq-vdsl/Makefile | 2 +- .../patches/200-fix-elapsed-time.patch | 122 ++++++++++++++++++ 4 files changed, 246 insertions(+), 2 deletions(-) create mode 100644 package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch create mode 100644 package/kernel/lantiq/ltq-vdsl/patches/200-fix-elapsed-time.patch diff --git a/package/kernel/lantiq/ltq-adsl/Makefile b/package/kernel/lantiq/ltq-adsl/Makefile index 31874acaca4e..ac9667493386 100644 --- a/package/kernel/lantiq/ltq-adsl/Makefile +++ b/package/kernel/lantiq/ltq-adsl/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-adsl PKG_VERSION:=3.24.4.4 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=drv_dsl_cpe_api_danube-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/ltq-dsl-$(BUILD_VARIANT)/drv_dsl_cpe_api-$(PKG_VERSION) PKG_SOURCE_URL:=@OPENWRT diff --git a/package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch b/package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch new file mode 100644 index 000000000000..42ec21437155 --- /dev/null +++ b/package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch @@ -0,0 +1,122 @@ +--- a/src/include/drv_dsl_cpe_pm_core.h ++++ b/src/include/drv_dsl_cpe_pm_core.h +@@ -1525,9 +1525,9 @@ typedef struct + DSL_boolean_t bShowtimeProcessingStart; + /** Showtime reached flag*/ + DSL_boolean_t bShowtimeInvTrigger; +- /** Current Showtime synchronization time to be used, (msec) */ ++ /** Current Showtime synchronization time to be used, (sec) */ + DSL_uint32_t nCurrShowtimeTime; +- /** Showtime synchronization time to be used, (msec) */ ++ /** Showtime synchronization time to be used, (sec) */ + DSL_uint32_t nElapsedShowtimeTime; + /** Actual Line state*/ + DSL_LineStateValue_t nLineState; +--- a/src/pm/drv_dsl_cpe_api_pm.c ++++ b/src/pm/drv_dsl_cpe_api_pm.c +@@ -1445,7 +1445,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersTo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -1501,7 +1501,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersEx + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL_EXT(pCounters->nChannel); + +@@ -2418,7 +2418,7 @@ DSL_Error_t DSL_DRV_PM_DataPathCountersT + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pDpCounters = DSL_DRV_PM_PTR_DATAPATH_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -3190,7 +3190,7 @@ DSL_Error_t DSL_DRV_PM_DataPathFailureCo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pDpCounters = DSL_DRV_PM_PTR_DATAPATH_FAILURE_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -3950,7 +3950,7 @@ DSL_Error_t DSL_DRV_PM_LineSecCountersTo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLineCounters = DSL_DRV_PM_PTR_LINE_SEC_COUNTERS_TOTAL(pCounters->nDirection); + +@@ -4602,7 +4602,7 @@ DSL_Error_t DSL_DRV_PM_LineInitCountersT + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLinitCounters = DSL_DRV_PM_PTR_LINE_INIT_COUNTERS_TOTAL(); + +@@ -5131,7 +5131,7 @@ DSL_Error_t DSL_DRV_PM_LineEventShowtime + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLfCounters = DSL_DRV_PM_PTR_LINE_EVENT_SHOWTIME_COUNTERS_TOTAL(pCounters->nDirection); + +@@ -5670,7 +5670,7 @@ DSL_Error_t DSL_DRV_PM_ReTxCountersTotal + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pReTxCounters = DSL_DRV_PM_PTR_RETX_COUNTERS_TOTAL(pCounters->nDirection); + +--- a/src/pm/drv_dsl_cpe_pm_core.c ++++ b/src/pm/drv_dsl_cpe_pm_core.c +@@ -61,6 +61,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + { + DSL_Error_t nErrCode = DSL_SUCCESS; + DSL_uint32_t msecTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE, ++ secTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE/DSL_PM_MSEC, + nCurrMsTime = 0; + #ifdef INCLUDE_DSL_CPE_PM_HISTORY + DSL_uint32_t nCurrSysTime = 0, nPrevElapsedTime = 0; +@@ -100,10 +101,13 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + { + /* Get elapsed time [msec] since the last entry*/ + msecTimeFrame = nCurrMsTime - DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck; ++ ++ /* Get elapsed time [sec] since the last entry*/ ++ secTimeFrame = (nCurrMsTime/DSL_PM_MSEC) - (DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck/DSL_PM_MSEC); + } + + /* Get Total Elapsed Time Since the PM module startup*/ +- DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += msecTimeFrame; ++ DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += secTimeFrame; + + /* Set last time check to the current time*/ + DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck = nCurrMsTime; +@@ -141,7 +145,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + else + { + /* Update current showtime elapsed time*/ +- DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += (msecTimeFrame/DSL_PM_MSEC); ++ DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += secTimeFrame; + DSL_DRV_PM_CONTEXT(pContext)->nElapsedShowtimeTime = + DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime; + } diff --git a/package/kernel/lantiq/ltq-vdsl/Makefile b/package/kernel/lantiq/ltq-vdsl/Makefile index 248615fb5993..da924e861e61 100644 --- a/package/kernel/lantiq/ltq-vdsl/Makefile +++ b/package/kernel/lantiq/ltq-vdsl/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr9 PKG_VERSION:=4.17.18.6 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_BASE_NAME:=drv_dsl_cpe_api PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz diff --git a/package/kernel/lantiq/ltq-vdsl/patches/200-fix-elapsed-time.patch b/package/kernel/lantiq/ltq-vdsl/patches/200-fix-elapsed-time.patch new file mode 100644 index 000000000000..3ec85460b243 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl/patches/200-fix-elapsed-time.patch @@ -0,0 +1,122 @@ +--- a/src/include/drv_dsl_cpe_pm_core.h ++++ b/src/include/drv_dsl_cpe_pm_core.h +@@ -1552,9 +1552,9 @@ typedef struct + DSL_boolean_t bShowtimeProcessingStart; + /** Showtime reached flag*/ + DSL_boolean_t bShowtimeInvTrigger; +- /** Current Showtime synchronization time to be used, (msec) */ ++ /** Current Showtime synchronization time to be used, (sec) */ + DSL_uint32_t nCurrShowtimeTime; +- /** Showtime synchronization time to be used, (msec) */ ++ /** Showtime synchronization time to be used, (sec) */ + DSL_uint32_t nElapsedShowtimeTime; + /** Actual Line state*/ + DSL_LineStateValue_t nLineState; +--- a/src/pm/drv_dsl_cpe_api_pm.c ++++ b/src/pm/drv_dsl_cpe_api_pm.c +@@ -1475,7 +1475,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersTo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -1535,7 +1535,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersEx + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL_EXT(pCounters->nChannel); + +@@ -2518,7 +2518,7 @@ DSL_Error_t DSL_DRV_PM_DataPathCountersT + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pDpCounters = DSL_DRV_PM_PTR_DATAPATH_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -3352,7 +3352,7 @@ DSL_Error_t DSL_DRV_PM_DataPathFailureCo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pDpCounters = DSL_DRV_PM_PTR_DATAPATH_FAILURE_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection); + +@@ -4130,7 +4130,7 @@ DSL_Error_t DSL_DRV_PM_LineSecCountersTo + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLineCounters = DSL_DRV_PM_PTR_LINE_SEC_COUNTERS_TOTAL(pCounters->nDirection); + +@@ -4787,7 +4787,7 @@ DSL_Error_t DSL_DRV_PM_LineInitCountersT + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLinitCounters = DSL_DRV_PM_PTR_LINE_INIT_COUNTERS_TOTAL(); + +@@ -5240,7 +5240,7 @@ DSL_Error_t DSL_DRV_PM_LineEventShowtime + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pLfCounters = DSL_DRV_PM_PTR_LINE_EVENT_SHOWTIME_COUNTERS_TOTAL(pCounters->nDirection); + +@@ -5720,7 +5720,7 @@ DSL_Error_t DSL_DRV_PM_ReTxCountersTotal + } + + /* Fill Total Counters elapsed time*/ +- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC; ++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime; + + pReTxCounters = DSL_DRV_PM_PTR_RETX_COUNTERS_TOTAL(pCounters->nDirection); + +--- a/src/pm/drv_dsl_cpe_pm_core.c ++++ b/src/pm/drv_dsl_cpe_pm_core.c +@@ -60,6 +60,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + { + DSL_Error_t nErrCode = DSL_SUCCESS; + DSL_uint32_t msecTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE, ++ secTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE/DSL_PM_MSEC, + nCurrMsTime = 0; + #ifdef INCLUDE_DSL_CPE_PM_HISTORY + DSL_uint32_t nCurrSysTime = 0, nPrevElapsedTime = 0; +@@ -99,10 +100,13 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + { + /* Get elapsed time [msec] since the last entry*/ + msecTimeFrame = nCurrMsTime - DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck; ++ ++ /* Get elapsed time [sec] since the last entry*/ ++ secTimeFrame = (nCurrMsTime/DSL_PM_MSEC) - (DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck/DSL_PM_MSEC); + } + + /* Get Total Elapsed Time Since the PM module startup*/ +- DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += msecTimeFrame; ++ DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += secTimeFrame; + + /* Set last time check to the current time*/ + DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck = nCurrMsTime; +@@ -140,7 +144,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp + else + { + /* Update current showtime elapsed time*/ +- DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += (msecTimeFrame/DSL_PM_MSEC); ++ DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += secTimeFrame; + DSL_DRV_PM_CONTEXT(pContext)->nElapsedShowtimeTime = + DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime; + }