From patchwork Fri Apr 9 08:59:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1464230 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=Kag5vtp0; 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 4FGsbK4YtFz9sWC for ; Fri, 9 Apr 2021 19:02:36 +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=BV2sy9xZf8wXagyHRi4Rh0P01nv1gMslGPEEljMAIZU=; b=Kag5vtp0LLeyLEqFaEYuFlPm1n /4NB7x0C+f+T6LKqMuxzIOgr/1yI/85ctXJSbnb2b6yFu+1oGFizBYGyQ+wzK5oT77avn76npBtfQ Yzi3NyAqFohOwT635TNpqKJVqi64OPxzbG4xwOHbbQC6ScC0OhgBAIbGsS+vbN94GzRRJBoT/KGzY s9wtyiiBrLWYOEl6y9R3SFu1b/qWM9CRQj4aAwpPP6PgSUJKp/fFj7hGGle/UzVHUGk15EAShd264 EAS0HpzoXHW3Ta4Ka5zDc3rRBFovip/kZ1L5xlMxcXhHvU9ZSK22vqTSBsfhCRFySdqxTCAG6I8lQ ccZPkbTg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUmzd-0008xs-Gt; Fri, 09 Apr 2021 08:59:58 +0000 Received: from mxout70.expurgate.net ([194.37.255.70]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUmzK-0008sw-Vv for openwrt-devel@lists.openwrt.org; Fri, 09 Apr 2021 08:59:41 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1lUmzG-0003S3-3a; Fri, 09 Apr 2021 10:59:34 +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 1lUmzF-00050Y-AX; Fri, 09 Apr 2021 10:59:33 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id AE42C240041; Fri, 9 Apr 2021 10:59:32 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 4D509240040; Fri, 9 Apr 2021 10:59:32 +0200 (CEST) Received: from feckert.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id AF5B820043; Fri, 9 Apr 2021 10:59:31 +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 v4 1/1] ltq-vdsl-app: extent dsl metrics with power_level and state_detail Date: Fri, 9 Apr 2021 10:59:19 +0200 Message-ID: <20210409085919.11870-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-type: clean X-purgate-ID: 151534::1617958773-000013F7-C575FF22/0/0 X-purgate: clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_095939_525510_7A4ABF7E X-CRM114-Status: GOOD ( 11.90 ) 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 adds the missing information to the J [...] 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 adds the missing information to the JSON output. * additional JSON output for state_detail: "state_detail": { "exception": false, "idle": false, "silent": false, "handshake": false, "full-init": false, "showtime-without-sync": false, "showtime-with-sync": true, "resync": false, "not-initialized": false, }, * additinal JSON output for power_level: "power_level": , Possible values are if the information is available: 0: L0 1: L1 2: L2 3: L3 Signed-off-by: Florian Eckert --- .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) 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..d8ebbb584c 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) + + if (str) { m_str("state", str); + c = blobmsg_open_table(&b, "state_detail"); + 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); + blobmsg_close_table(&b, c); + } m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC); } @@ -388,8 +402,24 @@ static void g997_power_management_status(int fd) { str = NULL; break; }; - if (str) + + if (str) { m_str("power_state", str); + switch (out.data.nPowerManagementStatus) { + case DSL_G997_PMS_L0: + m_u32("power_level", 0); + break; + case DSL_G997_PMS_L1: + m_u32("power_level", 1); + break; + case DSL_G997_PMS_L2: + m_u32("power_level", 2); + break; + case DSL_G997_PMS_L3: + m_u32("power_level", 3); + break; + } + } } static void g997_xtu_system_enabling(int fd, standard_t *standard) {