linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: linux-can@vger.kernel.org, "Stefan Mätje" <Stefan.Maetje@esd.eu>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 5/7] can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC)
Date: Sat, 14 Aug 2021 13:12:43 +0200	[thread overview]
Message-ID: <20210814111243.biquurwkyzmhmsad@pengutronix.de> (raw)
In-Reply-To: <20210814091750.73931-6-mailhol.vincent@wanadoo.fr>

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

On 14.08.2021 18:17:48, Vincent Mailhol wrote:
[...]

>  static int can_changelink(struct net_device *dev, struct nlattr *tb[],
>  			  struct nlattr *data[],
>  			  struct netlink_ext_ack *extack)
>  {
>  	struct can_priv *priv = netdev_priv(dev);
> +	u32 tdc_mask = 0;
>  	int err;
>  
>  	/* We need synchronization with dev->stop() */
> @@ -107,6 +179,7 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
>  		struct can_ctrlmode *cm;
>  		u32 ctrlstatic;
>  		u32 maskedflags;
> +		u32 tdc_flags;
>  
>  		/* Do not allow changing controller mode while running */
>  		if (dev->flags & IFF_UP)
> @@ -138,7 +211,18 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
>  			dev->mtu = CAN_MTU;
>  			memset(&priv->data_bittiming, 0,
>  			       sizeof(priv->data_bittiming));
> +			memset(&priv->tdc, 0, sizeof(priv->tdc));
> +			priv->ctrlmode &= ~CAN_CTRLMODE_TDC_MASK;
>  		}
> +
> +		tdc_flags = cm->flags & CAN_CTRLMODE_TDC_MASK;
> +		/* CAN_CTRLMODE_TDC_{AUTO,MANUAL} are mutually exclusive */
> +		if (tdc_flags == CAN_CTRLMODE_TDC_MASK)
> +			return -EOPNOTSUPP;
> +		/* If one of CAN_CTRLMODE_TDC_* is set then TDC must be set */
> +		if (tdc_flags && !data[IFLA_CAN_TDC])
> +			return -EOPNOTSUPP;

These don't need information form the can_priv, right? So these checks
can be moved to can_validate()?

> +		tdc_mask = cm->mask & CAN_CTRLMODE_TDC_MASK;
>  	}

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

  reply	other threads:[~2021-08-14 11:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14  9:17 [PATCH v4 0/7] add the netlink interface for CAN-FD Transmitter Delay Compensation (TDC) Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 1/7] can: netlink: allow user to turn off unsupported features Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 2/7] can: bittiming: allow TDC{V,O} to be zero and add can_tdc_const::tdc{v,o,f}_min Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 3/7] can: bittiming: change unit of TDC parameters to clock periods Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 4/7] can: dev: add can_tdc_get_relative_tdco() helper function Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 5/7] can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC) Vincent Mailhol
2021-08-14 11:12   ` Marc Kleine-Budde [this message]
2021-08-15  3:38     ` Vincent MAILHOL
2021-08-14  9:17 ` [PATCH v4 6/7] can: netlink: add can_priv::do_get_auto_tdcv() to retrieve tdcv from device Vincent Mailhol
2021-08-14  9:17 ` [PATCH v4 7/7] can: etas_es58x: clean-up documentation of struct es58x_fd_tx_conf_msg Vincent Mailhol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210814111243.biquurwkyzmhmsad@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=Stefan.Maetje@esd.eu \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).