All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/1]  Introducing new CAN FD bittiming parameters: Transmission Delay Compensation (TDC)
@ 2021-03-21  7:33 Vincent Mailhol
  2021-03-21  7:33 ` [PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv Vincent Mailhol
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Mailhol @ 2021-03-21  7:33 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol

I made a silly mistake which cause the automatic tdco calculation not
to work and failed to catch it during my testing (I probably was to
focussed to test the netlink interface, and forget to test the most
obvious use case...)

One incremental patch to be applied on the v3.  The patch contains
detailed instruction after the "---" scissors.

Changes from v3:
  - do tdco calculation after data bittiming is copied to can_priv.

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 (1):
  can: netlink: do tdco calculation after data bittiming is copied to
    can_priv

 drivers/net/can/dev/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv
  2021-03-21  7:33 [PATCH v4 0/1] Introducing new CAN FD bittiming parameters: Transmission Delay Compensation (TDC) Vincent Mailhol
@ 2021-03-21  7:33 ` Vincent Mailhol
  2021-03-22  7:53   ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Mailhol @ 2021-03-21  7:33 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol

The call to can_calc_tdco() is done too early. The data_bittiming
field of can_priv is not yet updated.

Moving the call after tdco is memcopied solves the issue.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
Hi Marc,

Please squash this into below commit:
2b3d40020eca ("can: bittiming: add calculation for CAN FD Transmitter Delay Compensation (TDC)")
---
 drivers/net/can/dev/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c
index 88dc56268670..18f7beeaf7d8 100644
--- a/drivers/net/can/dev/netlink.c
+++ b/drivers/net/can/dev/netlink.c
@@ -177,7 +177,6 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
 					priv->data_bitrate_const_cnt);
 		if (err)
 			return err;
-		can_calc_tdco(dev);
 
 		if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) {
 			netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n",
@@ -187,6 +186,8 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
 
 		memcpy(&priv->data_bittiming, &dbt, sizeof(dbt));
 
+		can_calc_tdco(dev);
+
 		if (priv->do_set_data_bittiming) {
 			/* Finally, set the bit-timing registers */
 			err = priv->do_set_data_bittiming(dev);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv
  2021-03-21  7:33 ` [PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv Vincent Mailhol
@ 2021-03-22  7:53   ` Marc Kleine-Budde
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-03-22  7:53 UTC (permalink / raw)
  To: Vincent Mailhol; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

On 21.03.2021 16:33:29, Vincent Mailhol wrote:
> The call to can_calc_tdco() is done too early. The data_bittiming
> field of can_priv is not yet updated.
> 
> Moving the call after tdco is memcopied solves the issue.
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---
> Hi Marc,
> 
> Please squash this into below commit:
> 2b3d40020eca ("can: bittiming: add calculation for CAN FD Transmitter Delay Compensation (TDC)")

done

regards,
Marc

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-22  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-21  7:33 [PATCH v4 0/1] Introducing new CAN FD bittiming parameters: Transmission Delay Compensation (TDC) Vincent Mailhol
2021-03-21  7:33 ` [PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv Vincent Mailhol
2021-03-22  7:53   ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.