Re: [PATCH] net: can: maximize SJW value by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/14/2018 08:32 AM, Wolfgang Grandegger wrote:
> Hello Oliver,
> 
> Am 14.06.2018 um 07:36 schrieb Oliver Hartkopp:
>> On 06/12/2018 05:06 PM, Wolfgang Grandegger wrote:
>>
>>>>> Is tseg2 always greater than zero at this point? This depends on
>>>>> btc->tseg2_min now which is given by the CAN driver, right?
>>>>
>>>> If we ever get tseg2 equal to zero we get inconsistant configuration
>>>> anyway
>>>> because:
>>>>   1. "bt->phase_seg2 = tseg2" => Phase_Seg2 = 0
>>>>   2. if user set SJW value, we would get SJW = 0 by following code:
>>>>         if (tseg2 < bt->sjw)
>>>>               bt->sjw = tseg2;
>>>>
>>>> I can add some code to check for configuration consistancy according
>>>> to ISO 11898-1.
>>
>> see below (at the end)
>>
>>>> This should be a separate patch anyway, because while SJW value is
>>
>> right
>>
>>>> debatable there
>>>> are clear requirements on Phase_Seg1, Phase_Seg2 and SJW values at the
>>>> ISO 11898-1.
>>>>
>>>>> This comment has to be adapted or shortened and we need to make sure
>>>>> that
>>>>> sjw remains at least 1 - even when tseg2_min is zero.
>>>>
>>>> Could you please help we truncating the comment?
>>
>> I was thinking about something like this:
>>
>> (..)
>> /* set sjw at least to 1 (min tseg2) if there are no user settings */
> 
>> if (!bt->sjw)
>>      bt->sjw = tseg2;
>> (..)
> 
> We could use:
> 
>         /* check for sjw user settings */
>         if (bt->sjw && btc->sjw_max) {
>                 /* sanitize upper bound to sjw_max */
>                 if (bt->sjw > btc->sjw_max)
>                         bt->sjw = btc->sjw_max;
>                 /* bt->sjw must not be higher than tseg2 */
>                 if (tseg2 < bt->sjw)
>                         bt->sjw = tseg2;
>         }
> 	/* according to ISO 11898-1, sjw should be at least 1 */
>         if (!bt->sjw || !btc->sjw_max)
>                 bt->sjw = 1;
> 
> Kind of paranoia, because tseg2_min and sjw_max is never 0. But we
> need to check sjw anyway.

What's the status of this patch?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux