lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOoeyxVF9baa8UKJKWcbTLzvMo3Ma=GRCbdnBSoGOw0Lk5j4sA@mail.gmail.com>
Date: Wed, 26 Mar 2025 10:37:11 +0800
From: Ming Yu <a0282524688@...il.com>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: tmyu0@...oton.com, lee@...nel.org, linus.walleij@...aro.org, brgl@...ev.pl, 
	andi.shyti@...nel.org, mailhol.vincent@...adoo.fr, andrew+netdev@...n.ch, 
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, 
	wim@...ux-watchdog.org, linux@...ck-us.net, jdelvare@...e.com, 
	alexandre.belloni@...tlin.com, linux-kernel@...r.kernel.org, 
	linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org, 
	linux-can@...r.kernel.org, netdev@...r.kernel.org, 
	linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org, 
	linux-rtc@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH v8 4/7] can: Add Nuvoton NCT6694 CANFD support

Marc Kleine-Budde <mkl@...gutronix.de> 於 2025年3月17日 週一 下午8:01寫道:
>
...
> > +static const struct can_bittiming_const nct6694_can_bittiming_nominal_const = {
> > +     .name = DRVNAME,
> > +     .tseg1_min = 2,
> > +     .tseg1_max = 256,
> > +     .tseg2_min = 2,
> > +     .tseg2_max = 128,
> > +     .sjw_max = 128,
> > +     .brp_min = 1,
> > +     .brp_max = 511,
> > +     .brp_inc = 1,
> > +};
> > +
> > +static const struct can_bittiming_const nct6694_can_bittiming_data_const = {
> > +     .name = DRVNAME,
> > +     .tseg1_min = 1,
> > +     .tseg1_max = 32,
> > +     .tseg2_min = 1,
> > +     .tseg2_max = 16,
> > +     .sjw_max = 16,
> > +     .brp_min = 1,
> > +     .brp_max = 31,
> > +     .brp_inc = 1,
> > +};
>
> [...]
>
> > +static int nct6694_can_start(struct net_device *ndev)
> > +{
> > +     struct nct6694_can_priv *priv = netdev_priv(ndev);
> > +     const struct can_bittiming *d_bt = &priv->can.data_bittiming;
> > +     const struct can_bittiming *n_bt = &priv->can.bittiming;
> > +     struct nct6694_can_setting *setting __free(kfree) = NULL;
> > +     const struct nct6694_cmd_header cmd_hd = {
> > +             .mod = NCT6694_CAN_MOD,
> > +             .cmd = NCT6694_CAN_SETTING,
> > +             .sel = ndev->dev_port,
> > +             .len = cpu_to_le16(sizeof(*setting))
> > +     };
> > +     int ret;
> > +
> > +     setting = kzalloc(sizeof(*setting), GFP_KERNEL);
> > +     if (!setting)
> > +             return -ENOMEM;
> > +
> > +     setting->nbr = cpu_to_le32(n_bt->bitrate);
> > +     setting->dbr = cpu_to_le32(d_bt->bitrate);
>
> I just noticed one thing that needs clarification/documentation.
>
> You have nct6694_can_bittiming_nominal_const and
> nct6694_can_bittiming_data_const, but only pass the bit rates to your
> device.
>
> Do the bit timing const really reflect the HW limitations of your
> device?
>
> Are you sure your device uses the same algorithm as the kernel and
> calculates the same bit timing parameters as the kernel, so that the
> values given to the user space reflects the bit timing parameter chosen
> by your device?
>

Originally, I only intended to provide NBR and DBR for user
configuration. In the next patch, I will add code to configure
NBTP(Nominal Bit Timing Prescaler) and DBTP(Data Bit Timing Prescaler)
based on the setting of nct6694_can_bittiming_nominal_const and
nct6694_can_bittiming_data_const.

Thanks,
Ming

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ