Oliver Hartkopp wrote: > Hi all, > > beginning with 2.6.33 there will be the functionality to detect dropped > CAN frames that had not be consumed by the userspace application in time: > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3b885787ea4112eaa80945999ea0901bf742707f > > By enabling the socket option SO_RXQ_OVFL a new control message can be passed > to the application that tells how many packets have been dropped in the > specific(!) sockets receive path until the last received CAN frame. > > I added this functionality to the latest candump in the SocketCAN SVN rev 1111 > and moved the formerly recvfrom() to recvmsg() to read CAN frames together > with the control-messages (cmsg) from the socket. See the diffs in: > > http://svn.berlios.de/viewcvs/socketcan/trunk/can-utils/candump.c?r1=968&r2=1111 > > To check the functionality on your own, you can follow this example: > > - use a 2.6.33-rcX Linux Kernel > - run e.g. 'cangen -g4 vcan0' on a separate console > - run 'candump -ta -d any' ('-d' is the new dropcount option) > - CAN traffic on vcan0 will show up > - type CTRL-Z to stop the candump process (will cause packets to drop) > - wait 3-5 seconds to surely overflow the sockets rx queue > - type 'fg <RETURN>' to (re)start candump and *directly* after that: CTRL-C > > When you scroll up in the terminal, you'll see something like this: > > ... > (1263646787.527205) vcan1 2AB [8] 7F C0 27 00 C3 BA DE 18 > (1263646787.532330) vcan1 38 [8] 7B FC EF 62 BC F4 DC 25 > (1263646787.537472) vcan1 5BA [8] CE BD B4 64 C6 3C 1D 56 > DROPCOUNT: dropped 67 CAN frames on 'any' socket (total drops 67) > (1263646787.892871) vcan1 7B6 [6] 60 54 0D 41 45 D8 > (1263646787.897970) vcan1 16E [8] AA AA D6 64 3A CD 40 1C > (1263646787.903048) vcan1 3FD [8] C2 A5 A0 13 3E A8 E7 6C > ... > > I think this new functionality is a great improvement for CAN users to make > things inside the kernel transparent to the userspace application.
Cool stuff, indeed. Wolfgang. _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
