From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83AA736D503; Mon, 1 Dec 2025 22:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629789; cv=none; b=V4865d/gZ2PyrKWMhigkcVX7kmm8lPNyBn4wDPiXj7Zhwl9BnCH6we6g0pvoikBpYgbemXt7AlCCZJPtu5tNRLTr4xcbpK18mKQo61zJE0CqfXO2+CRBbV7xMhnZgkxWkgOpj78LcQgRoCEK3A+DymnuPwviD2d9873FCcnW2j0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629789; c=relaxed/simple; bh=buB36Y5Sf5MgYfsXtNeJpE7oy9ZCXNnymdj5sOX4Nkg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BNdE7ynwX8f0/pr6xasFjjGp//ZqV/m3eiHnvQoQqwMFxFrPdoKsYvAKrN8hYOtT5ZMyA6niNT5voNYjs0ZdQZfEansrVWqRA1M8Fw1Y3MnpRdJSTX937fK5L8RD0oSdI9CTS6S8KLSCm/JsyBAMTGb63VDF8KjAjloZK5hjzBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sUqz3B+9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sUqz3B+9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 858FAC4CEF1; Mon, 1 Dec 2025 22:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629789; bh=buB36Y5Sf5MgYfsXtNeJpE7oy9ZCXNnymdj5sOX4Nkg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sUqz3B+9WKgA3fk70gaTlgNKhVnJjQdzbonKejSdP4Da/9Cg+hckBrTVWKjwdHBpj xfwdCxiLlaYKfw4Ysl20mGUD80FGfDA+cKS24puHtOFg/eF3swOPdU1yItkBoIpaGO 0TmZdKX03qM38Q9ACOi3LXakzTSgF/vrgTXS/9p+u7p2VSAHMkxmy6LvKXTr0US9JS MwW87f0dzTmZHuBshb3MGuuCqkQWGBWc+Qly7AIBUB9i9rO5KRssgjITiAHfw0z/K7 CuxkUiM7IskElBXFJ+UKq5Lf0eR34fjLAbcnWBiqx7pqylFKw5Y3s8FCxE04ZZbLt3 sB0E/H6tnoK0w== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:09 +0100 Subject: [PATCH iproute2-next v2 1/7] iplink_can: print_usage: fix the text indentation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-1-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2576; i=mailhol@kernel.org; h=from:subject:message-id; bh=buB36Y5Sf5MgYfsXtNeJpE7oy9ZCXNnymdj5sOX4Nkg=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6Mv9kdRec/qvQ/Sz3X/6NpR9DAo/GFt+28Uk2eDm5n OGOaIpQRykLgxgXg6yYIsuyck5uhY5C77BDfy1h5rAygQxh4OIUgImUxjD8L915YVGu0HsZ6ZKG BO5/hzdrzU9WmfZWuHRJrjDTNq9bbYwMn/dH5jaW95z9e/Hytp27jiwT/J2Xe2nNhBT/3L3vfIL +MAMA X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 The description of the BITRATE variable is not correctly aligned with the other ones. Put it on a new line with the same indentation as the other variables. This done, reindent everything to only one tabulation (was one tabulation and two spaces before). Before this patch...: $ ip link help can Usage: ip link set DEVICE type can (...) Where: BITRATE :=3D { NUMBER in bps } SAMPLE-POINT :=3D { 0.000..0.999 } TQ :=3D { NUMBER in ns } PROP-SEG :=3D { NUMBER in tq } PHASE-SEG1 :=3D { NUMBER in tq } PHASE-SEG2 :=3D { NUMBER in tq } SJW :=3D { NUMBER in tq } TDCV :=3D { NUMBER in tc } TDCO :=3D { NUMBER in tc } TDCF :=3D { NUMBER in tc } RESTART-MS :=3D { 0 | NUMBER in ms } ...and after: $ ip link help can Usage: ip link set DEVICE type can (...) Where: BITRATE :=3D { NUMBER in bps } SAMPLE-POINT :=3D { 0.000..0.999 } TQ :=3D { NUMBER in ns } PROP-SEG :=3D { NUMBER in tq } PHASE-SEG1 :=3D { NUMBER in tq } PHASE-SEG2 :=3D { NUMBER in tq } SJW :=3D { NUMBER in tq } TDCV :=3D { NUMBER in tc } TDCO :=3D { NUMBER in tc } TDCF :=3D { NUMBER in tc } RESTART-MS :=3D { 0 | NUMBER in ms } Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 1afdf088..f3640fe0 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -48,17 +48,18 @@ static void print_usage(FILE *f) "\n" "\t[ termination { 0..65535 } ]\n" "\n" - "\tWhere: BITRATE :=3D { NUMBER in bps }\n" - "\t SAMPLE-POINT :=3D { 0.000..0.999 }\n" - "\t TQ :=3D { NUMBER in ns }\n" - "\t PROP-SEG :=3D { NUMBER in tq }\n" - "\t PHASE-SEG1 :=3D { NUMBER in tq }\n" - "\t PHASE-SEG2 :=3D { NUMBER in tq }\n" - "\t SJW :=3D { NUMBER in tq }\n" - "\t TDCV :=3D { NUMBER in tc }\n" - "\t TDCO :=3D { NUMBER in tc }\n" - "\t TDCF :=3D { NUMBER in tc }\n" - "\t RESTART-MS :=3D { 0 | NUMBER in ms }\n" + "\tWhere:\n" + "\t BITRATE :=3D { NUMBER in bps }\n" + "\t SAMPLE-POINT :=3D { 0.000..0.999 }\n" + "\t TQ :=3D { NUMBER in ns }\n" + "\t PROP-SEG :=3D { NUMBER in tq }\n" + "\t PHASE-SEG1 :=3D { NUMBER in tq }\n" + "\t PHASE-SEG2 :=3D { NUMBER in tq }\n" + "\t SJW :=3D { NUMBER in tq }\n" + "\t TDCV :=3D { NUMBER in tc }\n" + "\t TDCO :=3D { NUMBER in tc }\n" + "\t TDCF :=3D { NUMBER in tc }\n" + "\t RESTART-MS :=3D { 0 | NUMBER in ms }\n" ); } =20 --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86FA336D503; Mon, 1 Dec 2025 22:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629792; cv=none; b=StW29uhbfAqBA1PES4i2GIwvvvvQUiflRjFdkkNVGBvpRxPcSpt+KIC3qDJ6K8fWOks1xxHQE5UKrXH3sEFZz7ExVWe//OKHNURPw3NCCDkv9CWmDz9b900IKLmzaNCz3Emdytdcf2+3bsPgDWFACB3e1Xb5HTruiQUJ4UPKqtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629792; c=relaxed/simple; bh=M4KKHo72Z25bXFP51FFH0SkrJdmV0dkgh6ZN6tjjy80=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K+Xw3Ij+/waaqpR9TOAVaEEXGCalj03ztDvGNkkWxxzBtuCY2LnxIYBKGVJQVL1Gg5VgGRC6lvzHvi25X6Vq3f8ZsD9wzJxZCKCXWgVTJR2ukE/SR7NqBdbzLMKat3uO43EIhkK+5TiuKoSMkd7Slzf8JB4IE90tkmE4Wyi4YII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+v5xh8Y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+v5xh8Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B50C9C4CEF1; Mon, 1 Dec 2025 22:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629792; bh=M4KKHo72Z25bXFP51FFH0SkrJdmV0dkgh6ZN6tjjy80=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g+v5xh8YVzALLkgHv79stU08f4QBSdLTdL94G7yp4y3YcfQFQnb1gi6Sj2UzvGZS/ YzhjApyQBInEJ4inDZRAoDRClqQhBPSxskYvQBpGoSfWRHxAHBh4QsN7aAhdHgLoXT ZAuv14PygV2OTcAC4nvNSaYz0K0YcJml6mD44N1easrgC0Yz33Ew122pwFpxAL0OLH l3z5f5yCYKAmcsWR29SttNXNbF5BcAt1I1aEtdykEXOY+gQhNxXElCzfSeg2sOTFEW JI/ByfxyhpDxN/UB0e1EdCthCryYcvVTRW/sRHYkMrOG9BcbJ079wEoEoK98UIKc1M 0dDReCxbFrzCA== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:10 +0100 Subject: [PATCH iproute2-next v2 2/7] iplink_can: print_usage: change unit for minimum time quanta to mtq Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-2-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1309; i=mailhol@kernel.org; h=from:subject:message-id; bh=M4KKHo72Z25bXFP51FFH0SkrJdmV0dkgh6ZN6tjjy80=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6soyMF3Z+q/7h2n7k0MFnjI8NFTPULilPkvpbYZv4t Cjhpr5VRykLgxgXg6yYIsuyck5uhY5C77BDfy1h5rAygQxh4OIUgImICTEybHrn92arrZG76rED x1i7dRYH8m6X4j4c+U622WHVpuWcaYwMa/zPuOiX7OYqPZS6/NO2oESZ/jkhkzfs2W2S/3qbQko LCwA= X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 In the vast majority of the available CAN datasheets, the minimum time quanta is abbreviated as "mtq". Note that the ISO standard uses "tqmin" (with the "min" part as a subscript). One fact is that no one seems to be using "tc". I was actually the one who initially proposed to use "tc", but I can not recall anymore the reasoning behind that. Change the minimum time quanta unit from "tc" to "mtq" to follow what the majority of the industry does. Fixes: 0c263d7c36ff ("iplink_can: add new CAN FD bittiming parameters: Tran= smitter Delay Compensation (TDC)") Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index f3640fe0..ee27659c 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -56,9 +56,9 @@ static void print_usage(FILE *f) "\t PHASE-SEG1 :=3D { NUMBER in tq }\n" "\t PHASE-SEG2 :=3D { NUMBER in tq }\n" "\t SJW :=3D { NUMBER in tq }\n" - "\t TDCV :=3D { NUMBER in tc }\n" - "\t TDCO :=3D { NUMBER in tc }\n" - "\t TDCF :=3D { NUMBER in tc }\n" + "\t TDCV :=3D { NUMBER in mtq }\n" + "\t TDCO :=3D { NUMBER in mtq }\n" + "\t TDCF :=3D { NUMBER in mtq }\n" "\t RESTART-MS :=3D { 0 | NUMBER in ms }\n" ); } --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B905836D503; Mon, 1 Dec 2025 22:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629795; cv=none; b=Cyl7S/Kd4ViFQ1/QVg7DOlDM92BqtTOr/773pHhTSe51CMz3iXloA4tqZV+TiIY1+jiA+XC3/4I3lukSxqgDcSuggphkye443EC/it4m22XNv3SS2uq8RWMUCQ9RoFLThWV7JxWrn0arKQcXOYbbZjrJRoTsJCQeU4MxWN+BQ6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629795; c=relaxed/simple; bh=zu63/HO5H/XHn2gNqdSfG3m9HFKZrZ/TNJWqStmwIjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jy5E8BcIPYObkLHYiInYb8yq+PmwURPq8fV+h4gwHCuCSEVz/+M88js398LaYGwk8vsFN5X7nB3T0vGxAQ3iEoeICBJV1eQJQ5hiV5JRlv6mY4VxrthhwWG/NfmqkpfZQIp0WzwirEtFVfNw1xAv+yeZfALR5edrKkJOtBxt0VQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V0i5jrNw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V0i5jrNw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8916C116D0; Mon, 1 Dec 2025 22:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629795; bh=zu63/HO5H/XHn2gNqdSfG3m9HFKZrZ/TNJWqStmwIjw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V0i5jrNwyipNBR0LaCYl+n5qx6SuUPyBcM0Yc6TnLc+5sQ31LExGHPLMzZP4HUU/8 G/zKEk1MItTj7ORKYffBXVGDY3wPvMkro1r5REhm8b0fcZemIKwzBOQ+kk3I6d8lsg WAbmSSsYG+mMjv8OpH40sFrJtnOqmbTzpCbl2mfMGWSY3EbvyYM0zIlTmv6qnmKiza GZh4TCGTWg7mK0ZPo0zyskws2UTMMVh8vD9GycBXsRn/9IA62+Zb3ygD7ScZV/i+E7 DK+XuNlfq6rWCtVkpD7ZKC1/ZgyNdyWOWHROhTqUJRKGRkKKgfjaECJZIz1tC2jgj1 lXbxGFiKDjrwg== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:11 +0100 Subject: [PATCH iproute2-next v2 3/7] iplink_can: print_usage: describe the CAN bittiming units Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-3-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1030; i=mailhol@kernel.org; h=from:subject:message-id; bh=zu63/HO5H/XHn2gNqdSfG3m9HFKZrZ/TNJWqStmwIjw=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6siyvkyQ5v0/VSpYwe35wjruuuPjaVRUJDj6J+SECU emTzK50lLAwiHExyIopsiwr5+RW6Cj0Djv01xJmDisTyBAGLk4BmEisDsP3uiQGUen/0e9L3+yJ 1z4T4c4xYYXi/P7Vp1g0pTTKgs8wMlySLZ269v7h9dsuJ382tHB3N+6x/+8rU1Nc/2tLULrEY24 A X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 While the meaning of "bps" or "ns" may be relatively easy to understand, some of the CAN specific units such as "mtq" (minimum time quanta) may be harder to understand. Add a new paragraph to the help menu which describes all the different units used for the CAN bittiming parameters. Signed-off-by: Vincent Mailhol --- Changelog v1 -> v2: - "s/mili second/milisecond/g" and "s/nano second/nanosecond/g" --- ip/iplink_can.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index ee27659c..d5abc43a 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -60,6 +60,13 @@ static void print_usage(FILE *f) "\t TDCO :=3D { NUMBER in mtq }\n" "\t TDCF :=3D { NUMBER in mtq }\n" "\t RESTART-MS :=3D { 0 | NUMBER in ms }\n" + "\n" + "\tUnits:\n" + "\t bps :=3D bit per second\n" + "\t ms :=3D millisecond\n" + "\t mtq :=3D minimum time quanta\n" + "\t ns :=3D nanosecond\n" + "\t tq :=3D time quanta\n" ); } =20 --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4B482BE620; Mon, 1 Dec 2025 22:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629798; cv=none; b=CqXVcbd4+nzibPkrbOLy+AlCuEqgpc0b052YZ8e0XZ57nhmSjFDW/n1brRBIeBvicUbD2BHsxg7JOKSXwSlosF7PN968tNvNZT2d3AGtHeejzGmF2L5Z/jZYvvgOh9rmHE+5CCLszlnUVWk3YDnB6Z57hQIoUN0PSw+/jo5uUwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629798; c=relaxed/simple; bh=QYZzNQBvCFLI2EZ4rvf8uqgFG68QjGj40iNCH+8qleg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ge51qykoCVvazJMUA9qZ4WtT4SGw9Q/sBUtFaodyb3J58in2H8ZE6PoqCFxNtv+njtveIWBypmv3IfqRzNex61mDzr6/HDh31K6v7/LMwQIpGsMdVBR7VfGC1iMBkOmhlebkbd13ae8STPji5pl+Ku0e4EOlrzk3cUqYNKZVYwA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M95tZye8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M95tZye8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D821DC4CEF1; Mon, 1 Dec 2025 22:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629798; bh=QYZzNQBvCFLI2EZ4rvf8uqgFG68QjGj40iNCH+8qleg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=M95tZye80aXIxis+r6xfNK1/IyInnpLTHgHPyfdiiA1cy4tWltIVKyCgDdGrBwXKI 3wGX0FJNt3G72MZsqsLyU6lyMzggs/QXB9k+Hqg5nz91LAqb/7d1cDL/T5pPQ6e8U5 c1wa5q1FG99yjc1TyWVWcSYxBTAE0zjiqV4j/XAyZc/+3AiZYYnSveYK1r3htOop58 tcWYxUp5qmpfAvVjCAe3ZmoH3vaIB3MTSR3V7LjjOQ+wo4FxJRxodnAXXqDkzphPLP +Ii8yisyYCwA0NZkLhEtYXxGE6E41QRD6Dk8xv8pCstYZYY9MN/29kwVjfTeb1wGmK W7Z+wqeEAf8RA== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:12 +0100 Subject: [PATCH iproute2-next v2 4/7] iplink_can: add the "restricted" option Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-4-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2174; i=mailhol@kernel.org; h=from:subject:message-id; bh=QYZzNQBvCFLI2EZ4rvf8uqgFG68QjGj40iNCH+8qleg=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6shwuVx56bN5fzLT8QvKE3UUn0i+VfnGptuipPzpr+ w3XbXP2dZSyMIhxMciKKbIsK+fkVugo9A479NcSZg4rE8gQBi5OAZjIjliG/z7pnpc+SLEddVyj GnDHrSDK5KZq7d/sqOk5k/+du+gd94fhN9vHfQxuH3dOZq+bEsPw12Wm6yenuOYtcybteB90+dL eM9wA X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 This is the iproute2 counterpart of Linux kernel's commit 60f511f443e5 ("can: netlink: add CAN_CTRLMODE_RESTRICTED"). ISO 11898-1:2024 adds a new restricted operation mode. This mode is added as a mandatory feature for nodes which support CAN XL and is retrofitted as optional for legacy nodes (i.e. the ones which only support Classical CAN and CAN FD). The restricted operation mode is nearly the same as the listen only mode: the node can not send data frames or remote frames and can not send dominant bits if an error occurs. The only exception is that the node shall still send the acknowledgment bit. Add the "restricted" option to iplink_can which controls the CAN_CTRLMODE_RESTRICTED flag of the netlink interface. Signed-off-by: Vincent Mailhol --- Changelog: v1 -> v2: - s/matches/strcmp/g in can_parse_opt() --- ip/iplink_can.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index d5abc43a..0ba86550 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -42,6 +42,7 @@ static void print_usage(FILE *f) "\t[ presume-ack { on | off } ]\n" "\t[ cc-len8-dlc { on | off } ]\n" "\t[ tdc-mode { auto | manual | off } ]\n" + "\t[ restricted { on | off } ]\n" "\n" "\t[ restart-ms TIME-MS ]\n" "\t[ restart ]\n" @@ -116,6 +117,7 @@ static void print_ctrlmode(enum output_type t, __u32 fl= ags, const char *key) print_flag(t, &flags, CAN_CTRLMODE_CC_LEN8_DLC, "CC-LEN8-DLC"); print_flag(t, &flags, CAN_CTRLMODE_TDC_AUTO, "TDC-AUTO"); print_flag(t, &flags, CAN_CTRLMODE_TDC_MANUAL, "TDC-MANUAL"); + print_flag(t, &flags, CAN_CTRLMODE_RESTRICTED, "RESTRICTED"); =20 if (flags) print_hex(t, NULL, "%x", flags); @@ -257,6 +259,9 @@ static int can_parse_opt(struct link_util *lu, int argc= , char **argv, invarg("\"tdc-mode\" must be either of \"auto\", \"manual\" or \"off\"= ", *argv); } + } else if (strcmp(*argv, "restricted") =3D=3D 0) { + NEXT_ARG(); + set_ctrlmode("restricted", *argv, &cm, CAN_CTRLMODE_RESTRICTED); } else if (matches(*argv, "restart") =3D=3D 0) { __u32 val =3D 1; =20 --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CC4629A30E; Mon, 1 Dec 2025 22:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629802; cv=none; b=noM9eSGo4rmPaRroFQLlywa6EFhYJh/if6xoUayTl1wYi8/iP2R9dPEdZUw/9gt02me5w1yCt1tcNZlZxQEYSFXlcLnMxoLUvXiweqx5SlURfCRyZIbMGTSl5BWXvEAsXPi2zNWTjfJFWF3hyckS1rtcYaVA04X7QeQ8U8lfajc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629802; c=relaxed/simple; bh=WDm/6jydCmsKOoJStQcJZf6BZlCA4xVb7bgorazBgDA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FxOfaoT9Qg+n87FUE5in30xMIte+d7ZmbUNUykjPohIFfLdelK0wfqyZG9biQ/aAO5WXeZcznDAjXXNwJaQzjanUqXfxOEOXovjdyGEUzQTyD7TJGX4xqs++5hrBvi/LqIoyWBvCX2PCuwmiJCLUrq2rj+ANPrxjyBkJ1DiVtGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MS5beBiz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MS5beBiz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13AA6C116C6; Mon, 1 Dec 2025 22:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629802; bh=WDm/6jydCmsKOoJStQcJZf6BZlCA4xVb7bgorazBgDA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MS5beBiziqpdgMJX/uMBC1lZp2Lo8BGfZ7/RcaZ5b8Gkf4QC0k+dsnlQCNvoSDi3u 2v8zBao5xO0QkVeLegL6C5xlVHgfpgQulWGRCZyQ2QgHvC3HoJpatpGotD/4zVlzoO sMVkPndtJfihybH+4t7Mn8kOtqS1LgUTCKBGvu3YawTs15NAcyvlkWjqM0B92BLyGS TcNdrVf3GwmD8M4jJBMATRNmjul13uF45++xo7ICkwxAxSon9jVyemwrUnezwE3SCZ dVZVaUgn1L35OwyaxjXAjdH0Sp/neOHD1HnOTULA8fu6ptCx2tlq8C42fLb8eeNj/s 1yUUu8bhzheTA== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:13 +0100 Subject: [PATCH iproute2-next v2 5/7] iplink_can: add initial CAN XL interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-5-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=15425; i=mailhol@kernel.org; h=from:subject:message-id; bh=WDm/6jydCmsKOoJStQcJZf6BZlCA4xVb7bgorazBgDA=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6sjy6O659dQrMWta08uzt4/o+HoHpM/X+y584vjNjS f6+7g7vjlIWBjEuBlkxRZZl5ZzcCh2F3mGH/lrCzGFlAhnCwMUpABMpOcnwP/DCo7nL+4/f379a 9r7kbuOkSfcZZn/eMu+O6NGOcyJdVocY/ql6VnqtOZszuXz70RNrXmX+DDdvYcyLbJ98nN9yPst VPTYA X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 This is the iproute2 counterpart of Linux kernel's commit e63281614747 ("can: netlink: add initial CAN XL support"). CAN XL uses bittiming parameters different from Classical CAN and CAN FD. Thus, all the data bittiming parameters, including TDC, need to be duplicated for CAN XL. Add the "xl" option to iplink_can which controls the CAN_CTRLMODE_XL flag of the netlink interface. Then add the "xbitrate", "xsample-point", "xtq", "xprop-seg", "xphase-seg1", "xphase-seg2", "xsjw", "xtdcv", "xtdco", "xtdcf" and "xtdc-mode" which are all sub options of "xl". Add the logic to query and print all those values. Update print_usage() accordingly. All these options behave similarly to their CAN FD equivalent. The new options which are specific to CAN XL (i.e. not inherited from CAN FD) will be added in a subsequent change. Example using the dummy_can driver: # modprobe dummy_can # ip link set can0 type can bitrate 500000 fd on dbitrate 2000000 xl on x= bitrate 8000000 $ ip --details link show can0 5: can0: mtu 2060 qdisc noop state DOWN mode DEFAULT group defaul= t qlen 10 link/can promiscuity 0 allmulti 0 minmtu 76 maxmtu 2060 can state STOPPED restart-ms 0 bitrate 500000 sample-point 0.875 tq 12 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 10 brp 2 dummy_can CC: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1 dbitrate 2000000 dsample-point 0.750 dtq 6 dprop-seg 29 dphase-seg1 30 dphase-seg2 20 dsjw 10 dbrp 1 tdco 60 tdcf 0 dummy_can FD: dtseg1 2..256 dtseg2 2..128 dsjw 1..128 dbrp 1..512 dbrp= _inc 1 tdco 0..127 tdcf 0..127 xbitrate 8000000 xsample-point 0.750 xtq 6 xprop-seg 7 xphase-seg1 7 xphase-seg2 5 xsjw 2 xbrp 1 xtdco 15 xtdcf 0 dummy_can XL: xtseg1 2..256 xtseg2 2..128 xsjw 1..128 xbrp 1..512 xbrp= _inc 1 xtdco 0..127 xtdcf 0..127 clock 160000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max= _segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ip= v4_max_size 65536 gro_ipv4_max_size 65536 Signed-off-by: Vincent Mailhol --- Changelog: v1 -> v2: - s/matches/strcmp/g in can_parse_opt() --- ip/iplink_can.c | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++= ---- 1 file changed, 195 insertions(+), 13 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 0ba86550..be31e7fc 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -32,6 +32,10 @@ static void print_usage(FILE *f) "\t[ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1\n \t dphase-seg2 = PHASE-SEG2 [ dsjw SJW ] ]\n" "\t[ tdcv TDCV tdco TDCO tdcf TDCF ]\n" "\n" + "\t[ xbitrate BITRATE [ xsample-point SAMPLE-POINT] ] |\n" + "\t[ xtq TQ xprop-seg PROP_SEG xphase-seg1 PHASE-SEG1\n \t xphase-seg2 = PHASE-SEG2 [ xsjw SJW ] ]\n" + "\t[ xtdcv TDCV xtdco TDCO xtdcf TDCF ]\n" + "\n" "\t[ loopback { on | off } ]\n" "\t[ listen-only { on | off } ]\n" "\t[ triple-sampling { on | off } ]\n" @@ -43,6 +47,8 @@ static void print_usage(FILE *f) "\t[ cc-len8-dlc { on | off } ]\n" "\t[ tdc-mode { auto | manual | off } ]\n" "\t[ restricted { on | off } ]\n" + "\t[ xl { on | off } ]\n" + "\t[ xtdc-mode { auto | manual | off } ]\n" "\n" "\t[ restart-ms TIME-MS ]\n" "\t[ restart ]\n" @@ -118,6 +124,9 @@ static void print_ctrlmode(enum output_type t, __u32 fl= ags, const char *key) print_flag(t, &flags, CAN_CTRLMODE_TDC_AUTO, "TDC-AUTO"); print_flag(t, &flags, CAN_CTRLMODE_TDC_MANUAL, "TDC-MANUAL"); print_flag(t, &flags, CAN_CTRLMODE_RESTRICTED, "RESTRICTED"); + print_flag(t, &flags, CAN_CTRLMODE_XL, "XL"); + print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_AUTO, "XL-TDC-AUTO"); + print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_MANUAL, "XL-TDC-MANUAL"); =20 if (flags) print_hex(t, NULL, "%x", flags); @@ -128,9 +137,10 @@ static void print_ctrlmode(enum output_type t, __u32 f= lags, const char *key) static int can_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { - struct can_bittiming bt =3D {}, fd_dbt =3D {}; + struct can_bittiming bt =3D {}, fd_dbt =3D {}, xl_dbt =3D {}; struct can_ctrlmode cm =3D { 0 }; struct can_tdc fd =3D { .tdcv =3D -1, .tdco =3D -1, .tdcf =3D -1 }; + struct can_tdc xl =3D { .tdcv =3D -1, .tdco =3D -1, .tdcf =3D -1 }; =20 while (argc > 0) { if (matches(*argv, "bitrate") =3D=3D 0) { @@ -208,6 +218,52 @@ static int can_parse_opt(struct link_util *lu, int arg= c, char **argv, NEXT_ARG(); if (get_u32(&fd.tdcf, *argv, 0)) invarg("invalid \"tdcf\" value", *argv); + } else if (strcmp(*argv, "xl") =3D=3D 0) { + NEXT_ARG(); + set_ctrlmode("xl", *argv, &cm, CAN_CTRLMODE_XL); + } else if (strcmp(*argv, "xbitrate") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.bitrate, *argv, 0)) + invarg("invalid \"xbitrate\" value", *argv); + } else if (strcmp(*argv, "xsample-point") =3D=3D 0) { + float sp; + + NEXT_ARG(); + if (get_float(&sp, *argv)) + invarg("invalid \"xsample-point\" value", *argv); + xl_dbt.sample_point =3D (__u32)(sp * 1000); + } else if (strcmp(*argv, "xtq") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.tq, *argv, 0)) + invarg("invalid \"xtq\" value", *argv); + } else if (strcmp(*argv, "xprop-seg") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.prop_seg, *argv, 0)) + invarg("invalid \"xprop-seg\" value", *argv); + } else if (strcmp(*argv, "xphase-seg1") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.phase_seg1, *argv, 0)) + invarg("invalid \"xphase-seg1\" value", *argv); + } else if (strcmp(*argv, "xphase-seg2") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.phase_seg2, *argv, 0)) + invarg("invalid \"xphase-seg2\" value", *argv); + } else if (strcmp(*argv, "xsjw") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl_dbt.sjw, *argv, 0)) + invarg("invalid \"xsjw\" value", *argv); + } else if (strcmp(*argv, "xtdcv") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl.tdcv, *argv, 0)) + invarg("invalid \"xtdcv\" value", *argv); + } else if (strcmp(*argv, "xtdco") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl.tdco, *argv, 0)) + invarg("invalid \"xtdco\" value", *argv); + } else if (strcmp(*argv, "xtdcf") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&xl.tdcf, *argv, 0)) + invarg("invalid \"xtdcf\" value", *argv); } else if (matches(*argv, "loopback") =3D=3D 0) { NEXT_ARG(); set_ctrlmode("loopback", *argv, &cm, @@ -262,6 +318,21 @@ static int can_parse_opt(struct link_util *lu, int arg= c, char **argv, } else if (strcmp(*argv, "restricted") =3D=3D 0) { NEXT_ARG(); set_ctrlmode("restricted", *argv, &cm, CAN_CTRLMODE_RESTRICTED); + } else if (strcmp(*argv, "xtdc-mode") =3D=3D 0) { + NEXT_ARG(); + if (strcmp(*argv, "auto") =3D=3D 0) { + cm.flags |=3D CAN_CTRLMODE_XL_TDC_AUTO; + cm.mask |=3D CAN_CTRLMODE_XL_TDC_AUTO; + } else if (strcmp(*argv, "manual") =3D=3D 0) { + cm.flags |=3D CAN_CTRLMODE_XL_TDC_MANUAL; + cm.mask |=3D CAN_CTRLMODE_XL_TDC_MANUAL; + } else if (strcmp(*argv, "off") =3D=3D 0) { + cm.mask |=3D CAN_CTRLMODE_XL_TDC_AUTO | + CAN_CTRLMODE_XL_TDC_MANUAL; + } else { + invarg("\"xtdc-mode\" must be either of \"auto\", \"manual\" or \"off\= "", + *argv); + } } else if (matches(*argv, "restart") =3D=3D 0) { __u32 val =3D 1; =20 @@ -296,6 +367,8 @@ static int can_parse_opt(struct link_util *lu, int argc= , char **argv, addattr_l(n, 1024, IFLA_CAN_BITTIMING, &bt, sizeof(bt)); if (fd_dbt.bitrate || fd_dbt.tq) addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &fd_dbt, sizeof(fd_dbt)); + if (xl_dbt.bitrate || xl_dbt.tq) + addattr_l(n, 1024, IFLA_CAN_XL_DATA_BITTIMING, &xl_dbt, sizeof(xl_dbt)); if (cm.mask) addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm)); =20 @@ -311,6 +384,18 @@ static int can_parse_opt(struct link_util *lu, int arg= c, char **argv, addattr32(n, 1024, IFLA_CAN_TDC_TDCF, fd.tdcf); addattr_nest_end(n, tdc); } + if (xl.tdcv !=3D -1 || xl.tdco !=3D -1 || xl.tdcf !=3D -1) { + struct rtattr *tdc =3D addattr_nest(n, 1024, + IFLA_CAN_XL_TDC | NLA_F_NESTED); + + if (xl.tdcv !=3D -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCV, xl.tdcv); + if (xl.tdco !=3D -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCO, xl.tdco); + if (xl.tdcf !=3D -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCF, xl.tdcf); + addattr_nest_end(n, tdc); + } =20 return 0; } @@ -341,58 +426,67 @@ can_print_timing_min_max(const char *json_attr, const= char *fp_attr, close_json_object(); } =20 -static void can_print_tdc_opt(struct rtattr *tdc_attr) +static void can_print_tdc_opt(struct rtattr *tdc_attr, bool is_xl) { struct rtattr *tb[IFLA_CAN_TDC_MAX + 1]; =20 parse_rtattr_nested(tb, IFLA_CAN_TDC_MAX, tdc_attr); if (tb[IFLA_CAN_TDC_TDCV] || tb[IFLA_CAN_TDC_TDCO] || tb[IFLA_CAN_TDC_TDCF]) { - open_json_object("tdc"); + const char *tdc =3D is_xl ? "xtdc" : "tdc"; + + open_json_object(tdc); can_print_nl_indent(); if (tb[IFLA_CAN_TDC_TDCV]) { + const char *tdcv_fmt =3D is_xl ? " xtdcv %u" : " tdcv %u"; __u32 *tdcv =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCV]); =20 - print_uint(PRINT_ANY, "tdcv", " tdcv %u", *tdcv); + print_uint(PRINT_ANY, "tdcv", tdcv_fmt, *tdcv); } if (tb[IFLA_CAN_TDC_TDCO]) { + const char *tdco_fmt =3D is_xl ? " xtdco %u" : " tdco %u"; __u32 *tdco =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCO]); =20 - print_uint(PRINT_ANY, "tdco", " tdco %u", *tdco); + print_uint(PRINT_ANY, "tdco", tdco_fmt, *tdco); } if (tb[IFLA_CAN_TDC_TDCF]) { + const char *tdcf_fmt =3D is_xl ? " xtdcf %u" : " tdcf %u"; __u32 *tdcf =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCF]); =20 - print_uint(PRINT_ANY, "tdcf", " tdcf %u", *tdcf); + print_uint(PRINT_ANY, "tdcf", tdcf_fmt, *tdcf); } close_json_object(); } } =20 -static void can_print_tdc_const_opt(struct rtattr *tdc_attr) +static void can_print_tdc_const_opt(struct rtattr *tdc_attr, bool is_xl) { + const char *tdc =3D is_xl ? "xtdc" : "tdc"; struct rtattr *tb[IFLA_CAN_TDC_MAX + 1]; =20 parse_rtattr_nested(tb, IFLA_CAN_TDC_MAX, tdc_attr); - open_json_object("tdc"); + open_json_object(tdc); can_print_nl_indent(); if (tb[IFLA_CAN_TDC_TDCV_MIN] && tb[IFLA_CAN_TDC_TDCV_MAX]) { __u32 *tdcv_min =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCV_MIN]); __u32 *tdcv_max =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCV_MAX]); + const char *tdcv =3D is_xl ? " xtdcv" : " tdcv"; =20 - can_print_timing_min_max("tdcv", " tdcv", *tdcv_min, *tdcv_max); + can_print_timing_min_max("tdcv", tdcv, *tdcv_min, *tdcv_max); } if (tb[IFLA_CAN_TDC_TDCO_MIN] && tb[IFLA_CAN_TDC_TDCO_MAX]) { __u32 *tdco_min =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCO_MIN]); __u32 *tdco_max =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCO_MAX]); + const char *tdco =3D is_xl ? " xtdco" : " tdco"; =20 - can_print_timing_min_max("tdco", " tdco", *tdco_min, *tdco_max); + can_print_timing_min_max("tdco", tdco, *tdco_min, *tdco_max); } if (tb[IFLA_CAN_TDC_TDCF_MIN] && tb[IFLA_CAN_TDC_TDCF_MAX]) { __u32 *tdcf_min =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCF_MIN]); __u32 *tdcf_max =3D RTA_DATA(tb[IFLA_CAN_TDC_TDCF_MAX]); + const char *tdcf =3D is_xl ? " xtdcf" : " tdcf"; =20 - can_print_timing_min_max("tdcf", " tdcf", *tdcf_min, *tdcf_max); + can_print_timing_min_max("tdcf", tdcf, *tdcf_min, *tdcf_max); } close_json_object(); } @@ -546,7 +640,7 @@ static void can_print_opt(struct link_util *lu, FILE *f= , struct rtattr *tb[]) print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp); =20 if (tb[IFLA_CAN_TDC]) - can_print_tdc_opt(tb[IFLA_CAN_TDC]); + can_print_tdc_opt(tb[IFLA_CAN_TDC], false); =20 close_json_object(); } @@ -570,7 +664,7 @@ static void can_print_opt(struct link_util *lu, FILE *f= , struct rtattr *tb[]) print_uint(PRINT_ANY, "brp_inc", " dbrp_inc %u", dbtc->brp_inc); =20 if (tb[IFLA_CAN_TDC]) - can_print_tdc_const_opt(tb[IFLA_CAN_TDC]); + can_print_tdc_const_opt(tb[IFLA_CAN_TDC], false); =20 close_json_object(); } @@ -609,6 +703,94 @@ static void can_print_opt(struct link_util *lu, FILE *= f, struct rtattr *tb[]) close_json_array(PRINT_ANY, " ]"); } =20 + /* data bittiming is irrelevant if fixed bitrate is defined */ + if (tb[IFLA_CAN_XL_DATA_BITTIMING] && + !tb[IFLA_CAN_XL_DATA_BITRATE_CONST]) { + struct can_bittiming *dbt =3D + RTA_DATA(tb[IFLA_CAN_XL_DATA_BITTIMING]); + char dsp[6]; + + open_json_object("xl_data_bittiming"); + can_print_nl_indent(); + print_uint(PRINT_ANY, "bitrate", " xbitrate %u", dbt->bitrate); + snprintf(dsp, sizeof(dsp), "%.3f", dbt->sample_point / 1000.); + print_string(PRINT_ANY, "sample_point", " xsample-point %s", + dsp); + can_print_nl_indent(); + print_uint(PRINT_ANY, "tq", " xtq %u", dbt->tq); + print_uint(PRINT_ANY, "prop_seg", " xprop-seg %u", + dbt->prop_seg); + print_uint(PRINT_ANY, "phase_seg1", " xphase-seg1 %u", + dbt->phase_seg1); + print_uint(PRINT_ANY, "phase_seg2", " xphase-seg2 %u", + dbt->phase_seg2); + print_uint(PRINT_ANY, "sjw", " xsjw %u", dbt->sjw); + print_uint(PRINT_ANY, "brp", " xbrp %u", dbt->brp); + + if (tb[IFLA_CAN_XL_TDC]) + can_print_tdc_opt(tb[IFLA_CAN_XL_TDC], true); + + close_json_object(); + } + + /* data bittiming const is irrelevant if fixed bitrate is defined */ + if (tb[IFLA_CAN_XL_DATA_BITTIMING_CONST] && + !tb[IFLA_CAN_XL_DATA_BITRATE_CONST]) { + struct can_bittiming_const *dbtc =3D + RTA_DATA(tb[IFLA_CAN_XL_DATA_BITTIMING_CONST]); + + open_json_object("xl_data_bittiming_const"); + can_print_nl_indent(); + print_string(PRINT_ANY, "name", " %s:", dbtc->name); + can_print_timing_min_max("tseg1", " xtseg1", + dbtc->tseg1_min, dbtc->tseg1_max); + can_print_timing_min_max("tseg2", " xtseg2", + dbtc->tseg2_min, dbtc->tseg2_max); + can_print_timing_min_max("sjw", " xsjw", 1, dbtc->sjw_max); + can_print_timing_min_max("brp", " xbrp", + dbtc->brp_min, dbtc->brp_max); + print_uint(PRINT_ANY, "brp_inc", " xbrp_inc %u", dbtc->brp_inc); + + if (tb[IFLA_CAN_XL_TDC]) + can_print_tdc_const_opt(tb[IFLA_CAN_XL_TDC], true); + + close_json_object(); + } + + if (tb[IFLA_CAN_XL_DATA_BITRATE_CONST]) { + __u32 *dbitrate_const =3D + RTA_DATA(tb[IFLA_CAN_XL_DATA_BITRATE_CONST]); + int dbitrate_cnt =3D + RTA_PAYLOAD(tb[IFLA_CAN_XL_DATA_BITRATE_CONST]) / + sizeof(*dbitrate_const); + int i; + __u32 dbitrate =3D 0; + + if (tb[IFLA_CAN_XL_DATA_BITTIMING]) { + struct can_bittiming *dbt =3D + RTA_DATA(tb[IFLA_CAN_XL_DATA_BITTIMING]); + dbitrate =3D dbt->bitrate; + } + + can_print_nl_indent(); + print_uint(PRINT_ANY, "xl_data_bittiming_bitrate", " xbitrate %u", + dbitrate); + can_print_nl_indent(); + open_json_array(PRINT_ANY, is_json_context() ? + "data_bitrate_const" : " ["); + for (i =3D 0; i < dbitrate_cnt; ++i) { + /* This will keep lines below 80 signs */ + if (!(i % 6) && i) { + can_print_nl_indent(); + print_string(PRINT_FP, NULL, "%s", " "); + } + print_uint(PRINT_ANY, NULL, + i < dbitrate_cnt - 1 ? "%8u, " : "%8u", + dbitrate_const[i]); + } + close_json_array(PRINT_ANY, " ]"); + } + if (tb[IFLA_CAN_TERMINATION_CONST] && tb[IFLA_CAN_TERMINATION]) { __u16 *trm =3D RTA_DATA(tb[IFLA_CAN_TERMINATION]); __u16 *trm_const =3D RTA_DATA(tb[IFLA_CAN_TERMINATION_CONST]); --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E3B2C032E; Mon, 1 Dec 2025 22:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629805; cv=none; b=ov0HliYJH8xeFfiMrpd6oD4r33nZDuDJG8JzIEhVB08krf7WV4OjclH54Mcx1DOz4cB9Ogv32us6D4f3aEREcJ03zCtQcfPXEvHe3zVt9Qy7isZe7vO7scmYlxUsFgGZVdzS7oTa/3YLitYgVNv/k+XHpe3ISwpRjhvKpYCYPDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629805; c=relaxed/simple; bh=dCPnYxhpHz/lP+ip0arJ/PP+PQvM//IS7QLVfSfFwCI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WTPhBfnd/aPiRae7BjTPYCuCBSUAeykyPqGQnTkchJjuchgtSThK0FVGcFwHo2uC9/PjMCYV3+Qoy/H9KbJpWAj0IhmLoMjuIM4iNFMmADJtQN7dnBA1h58GLcW9mplCqy60bNKkOtOLb0oBncSGaBIYN78CQOl52AxgRs02zrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JvClk8QA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JvClk8QA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F1A5C19421; Mon, 1 Dec 2025 22:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629805; bh=dCPnYxhpHz/lP+ip0arJ/PP+PQvM//IS7QLVfSfFwCI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JvClk8QAeCkRO4A4o5xx23yFoJB1bWtYpMMR9ILJAR5tuVPSLrZPyEfRE9T21A41f AabwIBNVf0+SomUfcSJlZORCZ0eYcKHlAwqQxnloCBAV/vxwJOhNj5vMnM06QwkZL9 R7TFyoNoYBxezjf8j74e5KXIwGhF8DHIIrTq1t2UMMlnhpO5KHQrBjmNrZmPBdK/CS dNFA/nffb5nB/mQWchWJeKXYyWtv8zCKeB3lMdyYY40tbWbRzyY/mBfGNfSk4cOzKe gh7JR9I2aF0Cctsd1bnUmZdIyIG8qRS4RcFIHtlxBEY5M/zuWv4GL43zbKrJrrvyza Ha7ekixDnF73A== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:14 +0100 Subject: [PATCH iproute2-next v2 6/7] iplink_can: add CAN XL's "tms" option Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-6-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1995; i=mailhol@kernel.org; h=from:subject:message-id; bh=dCPnYxhpHz/lP+ip0arJ/PP+PQvM//IS7QLVfSfFwCI=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6sgKNXDKLeDf8abm4us+hZbenC/vNL7uMPl1Y5KJSJ Let+PLbjlIWBjEuBlkxRZZl5ZzcCh2F3mGH/lrCzGFlAhnCwMUpABO5r8/IMPkgu2hqE+N+jfWL b0f8nfPF+aWv20xTztIDsULXAjavWMfI0DElMyGviZe5YK1SyZa3zgsPVfl8EnJ5q76SK3jB24M 5DAA= X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 This is the iproute2 counterpart of Linux kernel's commit 233134af2086 ("can: netlink: add CAN_CTRLMODE_XL_TMS flag"). The Transceiver Mode Switching (TMS) indicates whether the CAN XL controller shall use the PWM or NRZ encoding during the data phase. The term "transceiver mode switching" is used in both ISO 11898-1 and CiA 612-2 (although only the latter one uses the abbreviation TMS). We adopt the same naming convention here for consistency. Add the "tms" option to iplink_can which controls the CAN_CTRLMODE_XL_TMS flag of the CAN netlink interface. Signed-off-by: Vincent Mailhol --- Changelog: v1 -> v2: - s/XL-TMS/TMS/g in print_ctrlmode() - s/matches/strcmp/g in can_parse_opt() --- ip/iplink_can.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index be31e7fc..d91e807b 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -49,6 +49,7 @@ static void print_usage(FILE *f) "\t[ restricted { on | off } ]\n" "\t[ xl { on | off } ]\n" "\t[ xtdc-mode { auto | manual | off } ]\n" + "\t[ tms { on | off } ]\n" "\n" "\t[ restart-ms TIME-MS ]\n" "\t[ restart ]\n" @@ -127,6 +128,7 @@ static void print_ctrlmode(enum output_type t, __u32 fl= ags, const char *key) print_flag(t, &flags, CAN_CTRLMODE_XL, "XL"); print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_AUTO, "XL-TDC-AUTO"); print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_MANUAL, "XL-TDC-MANUAL"); + print_flag(t, &flags, CAN_CTRLMODE_XL_TMS, "TMS"); =20 if (flags) print_hex(t, NULL, "%x", flags); @@ -333,6 +335,9 @@ static int can_parse_opt(struct link_util *lu, int argc= , char **argv, invarg("\"xtdc-mode\" must be either of \"auto\", \"manual\" or \"off\= "", *argv); } + } else if (strcmp(*argv, "tms") =3D=3D 0) { + NEXT_ARG(); + set_ctrlmode("tms", *argv, &cm, CAN_CTRLMODE_XL_TMS); } else if (matches(*argv, "restart") =3D=3D 0) { __u32 val =3D 1; =20 --=20 2.51.2 From nobody Sun Feb 8 00:12:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 833492C11CB; Mon, 1 Dec 2025 22:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629808; cv=none; b=J2daRZJnNuL7Dq4yWU6ILphmHxVEBH6VvEWiRLC5ppQTKwAPhFTg5BWTqyefIjxHDcgMIqp2hWc44qYKjhJ+n5GXnk40rC+oaM5KaBky0kBW6xRRAEwJyUhuGKf5ntW5k6OYmwNuphPeLmTgHv89ofXy4eSIGIaW6RpMHIq6vSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764629808; c=relaxed/simple; bh=CAqoEU5ZBw9f4vxKsNKUAmN5pLXt7BE/7ve/chDvvqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JYIBWzr1wBU5Tz8rc22STKm0ZZ3bqlX2fxtl0n+D2ievKZk3VD3I/Zm09PyeKPKbQwbVQROzqDXTjnkcDS+XKpzBLIU5V00QTzZ1LumY7BTquWJsB1osL1IoPZwHtCyl6lQ3hUbEdSg3z56geaAHvPq8VgsPdYLGd5qYsZ0a91c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Er1vY3Mz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Er1vY3Mz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDCAC116C6; Mon, 1 Dec 2025 22:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764629808; bh=CAqoEU5ZBw9f4vxKsNKUAmN5pLXt7BE/7ve/chDvvqE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Er1vY3Mz1VGG9PSA9rBZabF50+1qF+Y8N6YuXJ3lK+canho2dMOSKaW5no+g78A2/ akNj+3VFoNlHi3qKY6uuFWZLP2YCZ6ZxLT+rbn0Uj0afdcMpX/emzz7uB37CbehCku uVFBmnS9ebVqmKHHs+BkfqDx/x/3PCldDO7pXP07ZqmerL0vRwJ5hC3Kp2Ke3FnteL VMGVkKmy4wAMq2z5GpQSEIM0C7IRvCVWxDLvDz3OOg4ThYAiWlwHUhTqX4Y0YJqckl fwdDfmRBOCwq1qYJ6tHusYK0rITBuZy/PbfXoqPoEy69ker67invPQk1V9H5h/1KxK Lv86g+OMREVxQ== From: Vincent Mailhol Date: Mon, 01 Dec 2025 23:55:15 +0100 Subject: [PATCH iproute2-next v2 7/7] iplink_can: add CAN XL's PWM interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-canxl-netlink-v2-7-dadfac811872@kernel.org> References: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org> To: netdev@vger.kernel.org, Stephen Hemminger , Marc Kleine-Budde , Oliver Hartkopp , David Ahern Cc: Rakuram Eswaran , =?utf-8?q?St=C3=A9phane_Grosjean?= , linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7660; i=mailhol@kernel.org; h=from:subject:message-id; bh=CAqoEU5ZBw9f4vxKsNKUAmN5pLXt7BE/7ve/chDvvqE=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJl6ssJ9F5km20itayt/3+xzoVn3BNP/7+EXzi6RyXufd rb7ztJ1HaUsDGJcDLJiiizLyjm5FToKvcMO/bWEmcPKBDKEgYtTACYSPYfhv+trhWIps92rd5/m sec62XbBsmhJYvVj/t4Lr7f3fE99bszwTz1byOTDAaeq8On7r6s43lVKTDWLfbrsjMd670vbmfp XcAAA X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 This is the iproute2 counterpart of Linux kernel's commit 46552323fa67 ("can: netlink: add PWM netlink interface"). When the TMS is switched on, the node uses PWM (Pulse Width Modulation) during the data phase instead of the classic NRZ (Non Return to Zero) encoding. PWM is configured by three parameters: - PWMS: Pulse Width Modulation Short phase - PWML: Pulse Width Modulation Long phase - PWMO: Pulse Width Modulation Offset time For each of these parameters, the CAN netlink interface defines three IFLA symbols: - IFLA_CAN_PWM_PWM*_MIN: the minimum allowed value. - IFLA_CAN_PWM_PWM*_MAX: the maximum allowed value. - IFLA_CAN_PWM_PWM*: the runtime value. This results in a total of nine IFLA symbols which are all nested in a parent IFLA_CAN_XL_PWM symbol. Add the "pwms", "pwml" and "pwmo" options to iplink_can which controls the IFLA_CAN_PWM_PWM* runtime values. Add the logic to query and print all those IFLA values. Update print_usage() accordingly. Example using the dummy_can driver: # modprobe dummy_can # ip link set can0 type can bitrate 1000000 xl on xbitrate 20000000 tms on $ ip --details link show can0 5: can0: mtu 2060 qdisc noop state DOWN mode DEFAULT group defaul= t qlen 10 link/can promiscuity 0 allmulti 0 minmtu 76 maxmtu 2060 can state STOPPED restart-ms 0 bitrate 1000000 sample-point 0.750 tq 6 prop-seg 59 phase-seg1 60 phase-seg2 40 sjw 20 brp 1 dummy_can CC: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1 dummy_can FD: dtseg1 2..256 dtseg2 2..128 dsjw 1..128 dbrp 1..512 dbrp= _inc 1 tdco 0..127 tdcf 0..127 xbitrate 20000000 xsample-point 0.625 xtq 6 xprop-seg 2 xphase-seg1 2 xphase-seg2 3 xsjw 1 xbrp 1 pwms 2 pwml 6 pwmo 0 dummy_can XL: xtseg1 2..256 xtseg2 2..128 xsjw 1..128 xbrp 1..512 xbrp= _inc 1 xtdco 0..127 xtdcf 0..127 pwms 1..8 pwml 2..24 pwmo 0..16 clock 160000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max= _segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ip= v4_max_size 65536 gro_ipv4_max_size 65536 Signed-off-by: Vincent Mailhol --- Changelog: v1 -> v2: - Remove a double space in patch description - s/matches/strcmp/g in can_parse_opt() --- ip/iplink_can.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index d91e807b..2ce54f0a 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -34,7 +34,7 @@ static void print_usage(FILE *f) "\n" "\t[ xbitrate BITRATE [ xsample-point SAMPLE-POINT] ] |\n" "\t[ xtq TQ xprop-seg PROP_SEG xphase-seg1 PHASE-SEG1\n \t xphase-seg2 = PHASE-SEG2 [ xsjw SJW ] ]\n" - "\t[ xtdcv TDCV xtdco TDCO xtdcf TDCF ]\n" + "\t[ xtdcv TDCV xtdco TDCO xtdcf TDCF pwms PWMS pwml PWML pwmo PWMO]\n" "\n" "\t[ loopback { on | off } ]\n" "\t[ listen-only { on | off } ]\n" @@ -67,6 +67,9 @@ static void print_usage(FILE *f) "\t TDCV :=3D { NUMBER in mtq }\n" "\t TDCO :=3D { NUMBER in mtq }\n" "\t TDCF :=3D { NUMBER in mtq }\n" + "\t PWMS :=3D { NUMBER in mtq }\n" + "\t PWML :=3D { NUMBER in mtq }\n" + "\t PWMO :=3D { NUMBER in mtq }\n" "\t RESTART-MS :=3D { 0 | NUMBER in ms }\n" "\n" "\tUnits:\n" @@ -143,6 +146,7 @@ static int can_parse_opt(struct link_util *lu, int argc= , char **argv, struct can_ctrlmode cm =3D { 0 }; struct can_tdc fd =3D { .tdcv =3D -1, .tdco =3D -1, .tdcf =3D -1 }; struct can_tdc xl =3D { .tdcv =3D -1, .tdco =3D -1, .tdcf =3D -1 }; + __u32 pwms =3D -1, pwml =3D -1, pwmo =3D -1; =20 while (argc > 0) { if (matches(*argv, "bitrate") =3D=3D 0) { @@ -266,6 +270,18 @@ static int can_parse_opt(struct link_util *lu, int arg= c, char **argv, NEXT_ARG(); if (get_u32(&xl.tdcf, *argv, 0)) invarg("invalid \"xtdcf\" value", *argv); + } else if (strcmp(*argv, "pwms") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&pwms, *argv, 0)) + invarg("invalid \"pwms\" value", *argv); + } else if (strcmp(*argv, "pwml") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&pwml, *argv, 0)) + invarg("invalid \"pwml\" value", *argv); + } else if (strcmp(*argv, "pwmo") =3D=3D 0) { + NEXT_ARG(); + if (get_u32(&pwmo, *argv, 0)) + invarg("invalid \"pwmo\" value", *argv); } else if (matches(*argv, "loopback") =3D=3D 0) { NEXT_ARG(); set_ctrlmode("loopback", *argv, &cm, @@ -401,6 +417,18 @@ static int can_parse_opt(struct link_util *lu, int arg= c, char **argv, addattr32(n, 1024, IFLA_CAN_TDC_TDCF, xl.tdcf); addattr_nest_end(n, tdc); } + if (pwms !=3D -1 || pwml !=3D -1 || pwmo !=3D -1) { + struct rtattr *pwm =3D addattr_nest(n, 1024, + IFLA_CAN_XL_PWM | NLA_F_NESTED); + + if (pwms !=3D -1) + addattr32(n, 1024, IFLA_CAN_PWM_PWMS, pwms); + if (pwml !=3D -1) + addattr32(n, 1024, IFLA_CAN_PWM_PWML, pwml); + if (pwmo !=3D -1) + addattr32(n, 1024, IFLA_CAN_PWM_PWMO, pwmo); + addattr_nest_end(n, pwm); + } =20 return 0; } @@ -496,6 +524,62 @@ static void can_print_tdc_const_opt(struct rtattr *tdc= _attr, bool is_xl) close_json_object(); } =20 +static void can_print_pwm_opt(struct rtattr *pwm_attr) +{ + struct rtattr *tb[IFLA_CAN_PWM_MAX + 1]; + + parse_rtattr_nested(tb, IFLA_CAN_PWM_MAX, pwm_attr); + if (tb[IFLA_CAN_PWM_PWMS] || tb[IFLA_CAN_PWM_PWML] || + tb[IFLA_CAN_PWM_PWMO]) { + open_json_object("pwm"); + can_print_nl_indent(); + if (tb[IFLA_CAN_PWM_PWMS]) { + __u32 *pwms =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMS]); + + print_uint(PRINT_ANY, " pwms", " pwms %u", *pwms); + } + if (tb[IFLA_CAN_PWM_PWML]) { + __u32 *pwml =3D RTA_DATA(tb[IFLA_CAN_PWM_PWML]); + + print_uint(PRINT_ANY, " pwml", " pwml %u", *pwml); + } + if (tb[IFLA_CAN_PWM_PWMO]) { + __u32 *pwmo =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMO]); + + print_uint(PRINT_ANY, " pwmo", " pwmo %u", *pwmo); + } + close_json_object(); + } +} + +static void can_print_pwm_const_opt(struct rtattr *pwm_attr) +{ + struct rtattr *tb[IFLA_CAN_PWM_MAX + 1]; + + parse_rtattr_nested(tb, IFLA_CAN_PWM_MAX, pwm_attr); + open_json_object("pwm"); + can_print_nl_indent(); + if (tb[IFLA_CAN_PWM_PWMS_MAX]) { + __u32 *pwms_min =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMS_MIN]); + __u32 *pwms_max =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMS_MAX]); + + can_print_timing_min_max("pwms", " pwms", *pwms_min, *pwms_max); + } + if (tb[IFLA_CAN_PWM_PWML_MAX]) { + __u32 *pwml_min =3D RTA_DATA(tb[IFLA_CAN_PWM_PWML_MIN]); + __u32 *pwml_max =3D RTA_DATA(tb[IFLA_CAN_PWM_PWML_MAX]); + + can_print_timing_min_max("pwml", " pwml", *pwml_min, *pwml_max); + } + if (tb[IFLA_CAN_PWM_PWMO_MAX]) { + __u32 *pwmo_min =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMO_MIN]); + __u32 *pwmo_max =3D RTA_DATA(tb[IFLA_CAN_PWM_PWMO_MAX]); + + can_print_timing_min_max("pwmo", " pwmo", *pwmo_min, *pwmo_max); + } + close_json_object(); +} + static void can_print_ctrlmode_ext(struct rtattr *ctrlmode_ext_attr, __u32 cm_flags) { @@ -735,6 +819,9 @@ static void can_print_opt(struct link_util *lu, FILE *f= , struct rtattr *tb[]) if (tb[IFLA_CAN_XL_TDC]) can_print_tdc_opt(tb[IFLA_CAN_XL_TDC], true); =20 + if (tb[IFLA_CAN_XL_PWM]) + can_print_pwm_opt(tb[IFLA_CAN_XL_PWM]); + close_json_object(); } =20 @@ -759,6 +846,9 @@ static void can_print_opt(struct link_util *lu, FILE *f= , struct rtattr *tb[]) if (tb[IFLA_CAN_XL_TDC]) can_print_tdc_const_opt(tb[IFLA_CAN_XL_TDC], true); =20 + if (tb[IFLA_CAN_XL_PWM]) + can_print_pwm_const_opt(tb[IFLA_CAN_XL_PWM]); + close_json_object(); } =20 --=20 2.51.2