Re: Introducing packet problems to vcan interface

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

 



Hi Eric,


On 07.09.21 17:01, Eric Curtin wrote:

I'm new to CAN in general, I was running the following commands
to set up a CAN interface and send it some data to see how it
handles undesirable scenarios.

Welcome to the CAN world ;-)

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
sudo tc qdisc add dev vcan0 root netem loss 10%
sudo tc qdisc add dev vcan0 root netem duplicate 10%
sudo tc qdisc add dev vcan0 root netem corrupt 10%
sudo tc qdisc add dev vcan0 root netem loss 10%

followed by:

./j1939cat -i ../4M.bin vcan0:0x80 :0x90,0x12300

But the packet problems introduced by TC, seem to have no effect
on the cat time. Does TC work with CAN, the timing to transmit the
data is the same with TC introducing problems. Should I be
expecting retransmissions etc. to occur?


I needed to check the original documentation myself:

http://rtime.felk.cvut.cz/can/socketcan-qdisc-final.pdf

The handling of local loopbacks (IFF_ECHO) can be done in af_can.c for some CAN interfaces that do not support IFF_ECHO on driver level.

This is the default setting for vcan interfaces due to performance reasons.

To change this default, the virtual CAN driver has to expose its IFF_ECHO capabilty. This is done by providing a module parameter:

# rmmod vcan
# modprobe vcan echo=1

The PDF says:

3.3. Qdiscs and virtual CAN interface

It is possible to use qdiscs with virtual CAN interface (vcan). This can be used, for example, to roughly simulate the transmission delay of the real CAN interfaces. One only needs to insert vcan module with echo parameter set to 1.

Maybe there are other interesting details for you too.

I checked your above tests with echo=1 and it worked for me.

Best regards,
Oliver




[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