PCAN linux driver 8.1 with netdev and RTNL interface

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
F.Benad
Posts: 5
Joined: Tue 21. Jun 2016, 09:23

PCAN linux driver 8.1 with netdev and RTNL interface

Post by F.Benad » Tue 21. Jun 2016, 11:21

Hello,

We have problems to configure the new peak linux driver V. 8.1 compiled in netdev/SocketCAN mode with the RTNETLINK interface. For some reasons we want to use the Linux SocketCAN interface for our CAN environment. We use SUSE Linux Enterprise Server 11 SP2-SP4 with kernel 3.0. This kernel version has no internal drivers for our PEAK PCIe and USB adapters. That's why we have to use the PCAN driver. As per point 4.8.2 driver user manual, the new driver is now configurable with iproute2.

Some information's of our system:

Code: Select all

test2:~ # uname -a
Linux test2 3.0.101-71-default #1 SMP Thu Mar 3 12:56:15 UTC 2016 (7bdad2e) x86_64 x86_64 x86_64 GNU/Linux

test2:~ # cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20160608_n (8.1.0) Jun 16 2016 09:04:48 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 1 interfaces @ major 248 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0    pci   can0 f8110000 032 0x001c 00000000 00000000 00000000 00000000 0x0000

test2:~ # cat /proc/net/dev | grep can
  can0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

test2:~ # ip -V
ip utility, iproute2-ss160111

test2:~ # ip link show can0
6: can0: <NOARP> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/can
If we try to configure the driver with some rtnl options, we got errors:

Code: Select all

test2:~ # /sbin/ip link set up can0 type can bitrate 1000000
RTNETLINK answers: Operation not supported
test2:~ # /sbin/ip link set up can0 type can restart-ms 100
RTNETLINK answers: Operation not supported
A standard configuration works well and the adapter is normal usable with the SocketCAN interface.

Code: Select all

test2:~ # /sbin/ip link set up can0 type can
test2:~ #
What are we doing wrong?

Regards,
F.Benad

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by M.Maidhof » Tue 21. Jun 2016, 17:46

Hi,

please use:

ip link set can0 up type can bitrate 1000000

regards

Michael

F.Benad
Posts: 5
Joined: Tue 21. Jun 2016, 09:23

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by F.Benad » Wed 22. Jun 2016, 08:36

Code: Select all

test2:~ # ip link set can0 up type can bitrate 1000000
RTNETLINK answers: Operation not supported 
Hmm :?

regards
F.Benad

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by S.Grosjean » Wed 22. Jun 2016, 11:02

Hi,

AFAIK,Kernel 3.0 is able to handle bittimings specs... Is your iproute2 package able too?

Stéphane
— Stéphane

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by S.Grosjean » Wed 22. Jun 2016, 12:43

Hi again,

Because of internal changes regarding arrival of CAN-FD in linux-can, playing with bitrates and pcan v8.1 is only possible with Kernels >= 3.8.

Our documentation will be upgraded accordingly.

Regards,

Stéphane
— Stéphane

F.Benad
Posts: 5
Joined: Tue 21. Jun 2016, 09:23

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by F.Benad » Fri 24. Jun 2016, 11:35

Hi,

fortunately it is still possible to set the CAN baudrate by using:
echo "i 0x0014 e" > /dev/pcan0
No option for setting bitrates would make the new pcan driver unusable for us.

But about the "restart-ms" option. It is also only available for newer kernels? We miss this option sadly, because we don't know other way to reset a BUS-OFF state CAN adapter from userspace. We have to use a ip link set down/up cycle as superuser (sometimes a driver reload is necessary).

Regards,
F.Benad

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by O.Hartkopp » Thu 30. Jun 2016, 19:37

F.Benad wrote:But about the "restart-ms" option. It is also only available for newer kernels? We miss this option sadly, because we don't know other way to reset a BUS-OFF state CAN adapter from userspace. We have to use a ip link set down/up cycle as superuser (sometimes a driver reload is necessary).
The restart-ms option is only provided by the Linux mainline driver.
The PEAK Linux 8.x driver does not provide all 'ip' functionalities you can get from the mainline drivers.

Have you ever thought about backporting the entire CAN subsystem in linux/net/can and linux/drivers/net/can (and the includes) to your ancient 3.0.x Kernel? Most of it should be easy to move/copy, as the CAN subsystem is not coupled very strong to the rest of the networking stack. But you would need a recent iproute2 package to use the new features with the 'ip' tool.

Regards,
Oliver

F.Benad
Posts: 5
Joined: Tue 21. Jun 2016, 09:23

Re: PCAN linux driver 8.1 with netdev and RTNL interface

Post by F.Benad » Tue 5. Jul 2016, 11:20

The restart-ms option is only provided by the Linux mainline driver.
The PEAK Linux 8.x driver does not provide all 'ip' functionalities you can get from the mainline drivers.
Ok. I assumed driver 8.1 was now able to support all. But, as Stéphane always said, the documentation will be updated at this point.
Have you ever thought about backporting the entire CAN subsystem in linux/net/can and linux/drivers/net/can (and the includes) to your ancient 3.0.x Kernel?
Yes, indeed. Some time ago we asked SUSE for enabling the SocketCAN drivers for their (at this time) upcoming SLE12 products. SUSE was developing a backport of sja1000/peak_pci as preview and later this backport was integrated into SLE11 SP3/4 (FATE#317131), but unfortunately only enabled for their realtime kernel (SLERTE 11). Based on this backport I was extracting a patch for building peak_pci for other kernels. But sadly this driver shows some strange CAN read latencies up to 250ms on our production system. I wasn’t able to solve this quickly and so our decision was to use always the PCAN driver.

Thanks Oliver, Stéphane and Michael for some clarification!

Best regards
F.Benad

Post Reply