Skip to contentSkip to conversation

Introducing new CAN FD bittiming parameters: Transmission Delay Compensation (TDC)

PATCH Superseded Vincent Mailhol 2 participants 4 messages Mar 9, 2021 CAN network drivers

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Introducing new CAN FD bittiming parameters: Transmission Delay Compensation (TDC)

A set of two incremental patches to be applied to the v2. Both patches are fully cosmetics.

Those two patches are to be squashed in linux-can-next/testing. Each patch contains detailed instruction after the "---" scissors.

Changes from v2:
- Reorder the IFLA_CAN_TDC* entries in can_policy structure
- Increase readability of the TDCO formula by introducing a temporary variable.

Changes from v1:
- Changed the commit message of the first patch of the serie to clarify the condition of when TDC is active.
- Changed the alignment style from tabulations to single space in drivers/net/can/dev/netlink.c
- Remove duplicated [IFLA_CAN_TERMINATION] entry in drivers/net/can/dev/netlink.c

Changes from the RFC:
- The RFC was a single e-mail with all comments in bulk, made this a proper patch series.
- Added the netlink interface.
- Rename the function can_set_tdc to can_calc_tdco (the formula is the same, everything around it was reworked).
- Other small miscellaneous changes.

Vincent Mailhol (2):
can: netlink: reorder IFLA_CAN_TDC* entries in can_policy structure
can: bittiming: add temporary variable to increase readability

 drivers/net/can/dev/bittiming.c | 5 +++--
 drivers/net/can/dev/netlink.c   | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

base-commit: c2cd2b376005b82a251af20900fa2c67cb001d7f
prerequisite-patch-id: c628b2ba1459ffd73489ff50639ba5a051a99263
prerequisite-patch-id: 0ce44c0600bff103810eb09cdcd42285c85d365c
prerequisite-patch-id: d5ae23ff6cf14d07ea646d33f9f0ecf3a6f9e7e1
prerequisite-patch-id: 38fd449c0a0bc7c8346f25567e974edbd5243606
prerequisite-patch-id: f40a6871ffc879f75586ba04b3056ec0b5d8590a
prerequisite-patch-id: f3244bc526a5131c9b6b689dfc1b758126a0a99f
prerequisite-patch-id: 9a1a7334fd4c337d7fc9af5c89db128a54ec9c8d
prerequisite-patch-id: a2a2a06a29ac02e4796bf8bb8bebe04aa968113e
prerequisite-patch-id: 3381611eb10fd16725435b7dcce288c16d2fcb28
prerequisite-patch-id: f01462cc6867bb197ea80f3c6a14f0c28828550d
prerequisite-patch-id: fbcf50987c0bf12599657af5ea4b8f1b72cd4dae
prerequisite-patch-id: 27f813c54fcb64781e729f30beba394cb6324101
prerequisite-patch-id: f9996d1fb2545c8b0ee39afd2db6dca0b659e811
prerequisite-patch-id: 03759de4308f541a3cd3c9eb89c4ac1bcd6c36a0
prerequisite-patch-id: 91dfc83cc1eab008eef5658a638a970be13a6d4d
prerequisite-patch-id: 6f8fc8b8d9f794bc3e039a15d5d0f752c7044f65
prerequisite-patch-id: 607cb1c602ec6ce3f36ed573e6a4c23471da934d
prerequisite-patch-id: a5060baf10c13d07812b04a059dcd0108c144dd2
prerequisite-patch-id: 946baf14dd974293570f1f2e2c8aa81780b0b22e
prerequisite-patch-id: d2db79eff80fb8aa8728a1df5adf292bdc988953
prerequisite-patch-id: cd7663a0f2c16b829eb5116d4353a20867b32c4e
prerequisite-patch-id: 99606eec325782fb50338ca09a8c08ad79832e36
prerequisite-patch-id: 09e03c5f5daf820f5337bb9340071c41f60ea6fb
prerequisite-patch-id: 5f004d320a3121d2b999b6b3088671f670370d59
prerequisite-patch-id: ceb46ad3d3d00b333ebae335762ff4f01601adb5
prerequisite-patch-id: 94e90c8ddb8696e3cc469388e27a3c142fe07b23

Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 1/2 can: netlink: reorder IFLA_CAN_TDC* entries in can_policy structure

The IFLA_CAN_TDC* entries within the can_policy structure appear in a different order than their declaration in include/uapi/linux/can/netlink.h

Reorder them to follow the same order.

---
Hi Marc,

Please squash this patch into:
5aed4df12f1b ("can: add netlink interface for CAN-FD Transmitter Delay Compensation (TDC)")

---
 drivers/net/can/dev/netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/dev/netlink.c +2 -2
index a3b71465849c..58e458dc8be2 100644
@@ -20,10 +20,10 @@ static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = {
 	[IFLA_CAN_DATA_BITTIMING_CONST]	= { .len = sizeof(struct can_bittiming_const) },
 	[IFLA_CAN_TERMINATION] = { .type = NLA_U16 },
 	[IFLA_CAN_TDCV] = { .type = NLA_U32 },
-	[IFLA_CAN_TDCV_MAX_CONST] = { .type = NLA_U32 },
 	[IFLA_CAN_TDCO] = { .type = NLA_U32 },
-	[IFLA_CAN_TDCO_MAX_CONST] = { .type = NLA_U32 },
 	[IFLA_CAN_TDCF] = { .type = NLA_U32 },
+	[IFLA_CAN_TDCV_MAX_CONST] = { .type = NLA_U32 },
+	[IFLA_CAN_TDCO_MAX_CONST] = { .type = NLA_U32 },
 	[IFLA_CAN_TDCF_MAX_CONST] = { .type = NLA_U32 },
 };
 
Signature · 1 line
2.26.2
#2 lore raw

PATCH v3 2/2 can: bittiming: add temporary variable to increase readability

In reply to Vincent Mailhol

Introduce a temporary variable sample_point_in_tq which will hold the sample point value expressed in time quanta instead of tenth of percent.

This change is only to increase readability.

---
Hi Marc,

Please squash this patch into:
c2cd2b376005 ("can: bittiming: add calculation for CAN FD Transmitter Delay Compensation (TDC)")

---
 drivers/net/can/dev/bittiming.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/dev/bittiming.c +3 -2
index 853b0ffb443c..f49170eadd54 100644
@@ -191,8 +191,9 @@ void can_calc_tdco(struct net_device *dev)
 	 */
 	if (dbt->brp == 1 || dbt->brp == 2) {
 		/* Reuse "normal" sample point and convert it to time quanta */
-		tdc->tdco = min(can_bit_time(dbt) * dbt->sample_point / 1000,
-				tdc_const->tdco_max);
+		u32 sample_point_in_tq = can_bit_time(dbt) * dbt->sample_point / 1000;
+
+		tdc->tdco = min(sample_point_in_tq, tdc_const->tdco_max);
 	} else {
 		tdc->tdco = 0;
 	}
Signature · 1 line
2.26.2
#3 lore raw
In reply to Vincent Mailhol
Quoted 2 lines · Vincent Mailhol

A set of two incremental patches to be applied to the v2. Both patches are fully cosmetics.

Squashed and updated linux-can-next/testing

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |