On Thu. 2 Feb 2023 at 18:55, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > On 01.02.2023 18:38:17, Vincent Mailhol wrote: > [...] > > > > > Maybe add a '=' between the phase_seg and the actual number: > > > > > > > > > > | Error: SJW 3 bigger than phase_seg1=6 and/or phase_seg2=2. > > > > > > > > If you ask me my preferences, I will go with column: > > > > > > > > Error: SJW: 3 bigger than phase_seg1: 6 and/or phase_seg2: 2. > > > > > > > > But I will not complain if you pick anything else. > > > > > > Period looks good. > > Now looks like this: > > | sudo ip link set flexcan0 txqueuelen 10 type can bitrate 22000000 > | Error: bitrate error: 80.5% too high. > | > | sudo ip link set flexcan0 txqueuelen 10 type can bitrate 2200000 > | Warning: bitrate error: 2.5%. > | > | sudo ip link set flexcan0 txqueuelen 10 type can bitrate 1000000 sjw 10 > | Error: sjw: 10 greater than max sjw: 4. > | > | sudo ip link set flexcan0 txqueuelen 10 type can prop-seg 3 phase-seg1 1 phase-seg2 8 tq 10 > | Error: resulting brp: 0 less than brp-min: 1. > | > | sudo ip link set flexcan0 txqueuelen 10 type can prop-seg 3 phase-seg1 4 phase-seg2 4 tq 30 sjw 5 > | Error: sjw: 5 greater than max sjw: 4. > | > | sudo ip link set flexcan0 txqueuelen 10 type can prop-seg 4 phase-seg1 3 phase-seg2 4 tq 30 sjw 4 > | Error: sjw: 4 greater than phase-seg1: 3. > | > | sudo ip link set flexcan0 txqueuelen 10 type can prop-seg 4 phase-seg1 4 phase-seg2 3 tq 30 sjw 4 > | Error: sjw: 4 greater than phase-seg2: 3. I like it. I am looking forward to seeing the patches. > > > What about the error value? Always return -EINVAL instead of a mix of > > > -EINVAL and -ERANGE? > > > > Looking at the comments from uapi/asm-generic/errno-base.h: > > > > #define EINVAL 22 /* Invalid argument */ > > #define ERANGE 34 /* Math result not representable */ > > > > We are not dealing with some non-representable math results, so > > -ERANGE is technically incorrect. I did suggest -ERANGE in the past > > because it looks natural to me: we define a min and a max, i.e. its a > > range. But the doc tells me I am wrong. Naming the error -ENAN (Error > > Not A Number) would have been more explicit, but we are not going to > > rewrite UAPI error definitions. > > > > Go with -EINVAL This answer also applies to your next message and to > > everywhere else in netlink, I guess. > > It's -EINVAL everywhere now. \o/