iplink_can: add CAN XL TMS PWM configuration support
This is the iproute2 counterpart of Linux kernel's commit
46552323fa67
("can: netlink: add PWM netlink interface").
When the TMS is switched on, the node uses PWM (Pulse Width Modulation)
during the data phase instead of the classic NRZ (Non Return to Zero)
encoding.
PWM is configured by three parameters:
- PWMS: Pulse Width Modulation Short phase
- PWML: Pulse Width Modulation Long phase
- PWMO: Pulse Width Modulation Offset time
For each of these parameters, the CAN netlink interface defines three IFLA
symbols:
- IFLA_CAN_PWM_PWM*_MIN: the minimum allowed value.
- IFLA_CAN_PWM_PWM*_MAX: the maximum allowed value.
- IFLA_CAN_PWM_PWM*: the runtime value.
This results in a total of nine IFLA symbols which are all nested in a
parent IFLA_CAN_XL_PWM symbol.
Add the "pwms", "pwml" and "pwmo" options to iplink_can which controls the
IFLA_CAN_PWM_PWM* runtime values.
Add the logic to query and print all those IFLA values. Update
print_usage() accordingly.
Example using the dummy_can driver:
# modprobe dummy_can
# ip link set can0 type can bitrate
1000000 xl on xbitrate
20000000 tms on
$ ip --details link show can0
5: can0: <NOARP> mtu 2060 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0 allmulti 0 minmtu 76 maxmtu 2060
can <XL,TMS> state STOPPED restart-ms 0
bitrate
1000000 sample-point 0.750
tq 6 prop-seg 59 phase-seg1 60 phase-seg2 40 sjw 20 brp 1
dummy_can CC: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1
dummy_can FD: dtseg1 2..256 dtseg2 2..128 dsjw 1..128 dbrp 1..512 dbrp_inc 1
tdco 0..127 tdcf 0..127
xbitrate
20000000 xsample-point 0.625
xtq 6 xprop-seg 2 xphase-seg1 2 xphase-seg2 3 xsjw 1 xbrp 1
pwms 2 pwml 6 pwmo 0
dummy_can XL: xtseg1 2..256 xtseg2 2..128 xsjw 1..128 xbrp 1..512 xbrp_inc 1
xtdco 0..127 xtdcf 0..127
pwms 1..8 pwml 2..24 pwmo 0..16
clock
160000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>