From patchwork Tue Apr 6 12:49:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1462841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=BbE46OiF; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 ozlabs.org (Postfix) with ESMTPS id 4FF6qx4M47z9sW1 for ; Tue, 6 Apr 2021 22:52:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=6/ZZdzsUpi/mvq4cjValAQ/oRO1uo45F376jJkHesyg=; b=BbE46OiFimsY4Xyn11etpqHulP cg/hL3Maz+0tcpT3+g4LDV/rXY5K/vDYSDAKMygPY2yL6kqT5UCfXeiKWL+RjvO20M/EiEUdegF7p Ky4ltNzg2bdq9X/ueCU/rhO8x+lUf2xsLX25V/u3sDQdas9NOrwFofJMO/MFbNi1tHr4RCO18KroY XIbgz34+5agEJdzkTCeEOV/wm1434z42bexQDg2d9KBYT9T5DeRunUj4+/MIJDtbLRgqwi7pnmiKE uFoFko2ViwePTwkjvRItwR4P43ic6m58E3M7ieHxtikHCfDd3NE4m9mWT1lDzW+QO2zKwhsrCFSwH O3leQP7g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTl9h-002d5o-3j; Tue, 06 Apr 2021 12:50:05 +0000 Received: from mxout70.expurgate.net ([194.37.255.70]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lTl9b-002d4x-G4 for openwrt-devel@lists.openwrt.org; Tue, 06 Apr 2021 12:50:01 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1lTl9U-0000Ia-S7; Tue, 06 Apr 2021 14:49:52 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90) (envelope-from ) id 1lTl9U-0005jT-2N; Tue, 06 Apr 2021 14:49:52 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id A9DE1240041; Tue, 6 Apr 2021 14:49:51 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 4BF2B240040; Tue, 6 Apr 2021 14:49:51 +0200 (CEST) Received: from feckert.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 8D29120282; Tue, 6 Apr 2021 14:49:50 +0200 (CEST) From: Florian Eckert To: Eckert.Florian@googlemail.com, a.heider@gmail.com, dev@kresin.me Cc: openwrt-devel@lists.openwrt.org Subject: [PATCH v3 1/1] ltq-vdsl-app: extent dsl metrics with boolean power and line states Date: Tue, 6 Apr 2021 14:49:45 +0200 Message-ID: <20210406124945.6314-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de X-purgate: clean X-purgate-ID: 151534::1617713392-0000483E-A8A11051/0/0 X-purgate-type: clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210406_134959_664562_50CD0C20 X-CRM114-Status: GOOD ( 12.41 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: With the old ubus dsl API, the numbers for the individual line_states and power_states were also returned. These were not ported to the new DSL C-API. This commit changes the following JSON output. Instead of outputting the "line_state" and "power_state" numbers directly, the values is now printed as boolean. This has the advantage that the internal numbers are not shown, which can change in the [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [194.37.255.70 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 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 With the old ubus dsl API, the numbers for the individual line_states and power_states were also returned. These were not ported to the new DSL C-API. This commit changes the following JSON output. Instead of outputting the "line_state" and "power_state" numbers directly, the values is now printed as boolean. This has the advantage that the internal numbers are not shown, which can change in the future. * current JSON output for state: "state": "Showtime with TC-Layer sync" * new JSON output for state: "line_state": { "exception": false, "idle": false, "silent": false, "handshake": false, "full-init": false, "showtime-without-sync": false, "showtime-with-sync": true, "resync": false, "not-initialized": false, "string": "Showtime with TC-Layer sync" }, * current JSON output for power_state: "power_state": "L0 - Synchronized" * new JSON outpug for power_state: "power_state": { "NA": false, "L0": true, "L1": false, "L2": false, "L3": false, "string": "L0 - Synchronized" } Signed-off-by: Florian Eckert --- package/network/config/ltq-vdsl-app/Makefile | 2 +- .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/package/network/config/ltq-vdsl-app/Makefile b/package/network/config/ltq-vdsl-app/Makefile index 0823a0e7e9..f5c561078d 100644 --- a/package/network/config/ltq-vdsl-app/Makefile +++ b/package/network/config/ltq-vdsl-app/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-app PKG_VERSION:=4.17.18.6 -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_BASE_NAME:=dsl_cpe_control PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@OPENWRT diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c index 8eefdfe4d5..2ab35ac056 100644 --- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c +++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c @@ -306,6 +306,7 @@ static void version_information(int fd) { static void line_state(int fd) { IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET) + void *c; const char *str; switch (out.data.nLineState) { STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized") @@ -351,8 +352,21 @@ static void line_state(int fd) { str = NULL; break; }; - if (str) - m_str("state", str); + + if (str) { + c = blobmsg_open_table(&b, "line_state"); + m_bool("exception", out.data.nLineState == DSL_LINESTATE_EXCEPTION); + m_bool("idle", out.data.nLineState == DSL_LINESTATE_IDLE); + m_bool("silent", out.data.nLineState == DSL_LINESTATE_SILENT); + m_bool("handshake", out.data.nLineState == DSL_LINESTATE_HANDSHAKE); + m_bool("full-init", out.data.nLineState == DSL_LINESTATE_FULL_INIT); + m_bool("showtime-without-sync", out.data.nLineState == DSL_LINESTATE_SHOWTIME_NO_SYNC); + m_bool("showtime-with-sync", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC); + m_bool("resync", out.data.nLineState == DSL_LINESTATE_RESYNC); + m_bool("not-initialized", out.data.nLineState == DSL_LINESTATE_NOT_INITIALIZED); + m_str("string", str); + blobmsg_close_table(&b, c); + } m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC); } @@ -377,6 +391,7 @@ static void g997_line_inventory(int fd) { static void g997_power_management_status(int fd) { IOCTL(DSL_G997_PowerManagementStatus_t, DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET) + void *c; const char *str; switch (out.data.nPowerManagementStatus) { STR_CASE(DSL_G997_PMS_NA, "Power management state is not available") @@ -388,8 +403,17 @@ static void g997_power_management_status(int fd) { str = NULL; break; }; - if (str) - m_str("power_state", str); + + if (str) { + c = blobmsg_open_table(&b, "power_state"); + m_bool("NA", out.data.nPowerManagementStatus == DSL_G997_PMS_NA); + m_bool("L0", out.data.nPowerManagementStatus == DSL_G997_PMS_L0); + m_bool("L1", out.data.nPowerManagementStatus == DSL_G997_PMS_L1); + m_bool("L2", out.data.nPowerManagementStatus == DSL_G997_PMS_L2); + m_bool("L3", out.data.nPowerManagementStatus == DSL_G997_PMS_L3); + m_str("string", str); + blobmsg_close_table(&b, c); + } } static void g997_xtu_system_enabling(int fd, standard_t *standard) {