Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp156112pxy; Sat, 14 Aug 2021 03:22:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLK60Rfb2y/RziIJew+w9LCXYbAgggDpvybNfiq183j8wWDgzspqBhWImKLRuFnDUFfpOF X-Received: by 2002:a50:9e8b:: with SMTP id a11mr4568877edf.124.1628936527370; Sat, 14 Aug 2021 03:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628936527; cv=none; d=google.com; s=arc-20160816; b=DWKzuAb7Istiilwso/4YaID4k+0nCix1VvukNH0T0qOMjN2J0IP1M2WNvnAYIcjUzC wZ9zuBRBC9Vd+YtWQw1/CN3xxgXrgzRIlvsZwVWUPvXKhtjUlOK4GM6BbSH8YIIcsXH/ 2mUZmUZ8eO4FJCGNA5WQYE44kj9BAxhpQT5sCyMpCaw6KBdulRiY5HDEknKDJebLHFFG qERT8UU9YWaF1Qo05AagkW7zuRsJojX//jS43BztoYlmbt3nTchou+NWSQ2VvQsoVrCF N64InkvCZ0coXYLKXiuF1Tdz93y3rsvPIG0Ztla6OPlZSq6XvuOounvDIL++MDqgMxe1 oWSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hP7MCvUynzIsaS/7aKCSathMaEr3YWgKtDwQlECWLEI=; b=FoXtWX4Y2r6RlmuPqlVPcXmibCWN5TefeChIJ8eJUSj1yImtQ/5IjwSQsahiuPpbxx 52+h+Zk1qDBqjo85Srdu6FdxMCagS2vxPRB8X8vseDKc9ILyQ0/I6tsStqskML0sY9zf RwTJIv0y7sN5P/cKFVGKgBr45TjhG5Dzq+WM2UQQj+RLBOezeJcRTptMw342iX7GZOZG IMd3h+zdE4cY3amm3JmOEa7wsiIPV/1OnL+1d1VfWxzlp3K4SbfC1ppaCfO3AyOAQVBB Ao99QnOoBOHednw9EwFQAc4Bp1Ua2VbDF0+o1lHoplUkk032WBtw0vVMBQPXj3lOMRfi YFdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si4245821edu.581.2021.08.14.03.21.44; Sat, 14 Aug 2021 03:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237940AbhHNKSt (ORCPT + 99 others); Sat, 14 Aug 2021 06:18:49 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:28269 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238000AbhHNKSp (ORCPT ); Sat, 14 Aug 2021 06:18:45 -0400 Received: from tomoyo.flets-east.jp ([114.149.34.46]) by mwinf5d19 with ME id hNHf2500A0zjR6y03NJDks; Sat, 14 Aug 2021 12:18:15 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sat, 14 Aug 2021 12:18:15 +0200 X-ME-IP: 114.149.34.46 From: Vincent Mailhol To: Marc Kleine-Budde , Stephen Hemminger , linux-can@vger.kernel.org Cc: =?UTF-8?q?Stefan=20M=C3=A4tje?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH v5 3/4] iplink_can: print brp and dbrp bittiming variables Date: Sat, 14 Aug 2021 19:17:27 +0900 Message-Id: <20210814101728.75334-4-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210814101728.75334-1-mailhol.vincent@wanadoo.fr> References: <20210814101728.75334-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Report the value of the bit-rate prescaler (brp) for both the nominal and the data bittiming. Currently, only the constant brp values (brp_{min,max,inc}) are being reported. Also, brp is the only member of struct can_bittiming not being reported. Noticeably, brp is not used as an input for bittiming calculation and although it could be calculated by hand from the other bittiming parameters with below formula: brp = clock * tq / 1000000000 with clock in hertz and tq in nano second (thus the need of a 1 billion factor to convert it back to second). But because above formula is not so trivial to remember and is subjected to rounding errors, it makes sense to directly output {d,}bpr. Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 52ba3d12..e438e416 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -336,6 +336,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) print_uint(PRINT_ANY, "phase_seg2", " phase-seg2 %u", bt->phase_seg2); print_uint(PRINT_ANY, "sjw", " sjw %u", bt->sjw); + print_uint(PRINT_ANY, "brp", " brp %u", bt->brp); close_json_object(); } @@ -411,6 +412,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) print_uint(PRINT_ANY, "phase_seg2", " dphase-seg2 %u", dbt->phase_seg2); print_uint(PRINT_ANY, "sjw", " dsjw %u", dbt->sjw); + print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp); close_json_object(); } -- 2.31.1