On 06/02/2010 05:35 PM, Navaneethan P wrote: >>> I commented IFF_ECHO and also commented the can_get/put_echo_skb, now, >>> without enabling the loopback itself, the data is looped back. > >> OK, enabling the hardware loopback does not make sense anyway. See > below. > > I understood this behaviour. Loopback is enabled by default in > net/can/raw.c:raw_init function. > http://lxr.linux.no/#linux+v2.6.34/net/can/raw.c#L270 > > >> If you set IFF_ECHO, your driver *must* support local loopback by using >> can_get/put_echo_skb. It will not work otherwise. And again, forget the >> hardware loopback. > Thanks. I understood this behaviour also . I saw the source code > drivers/net/can/dev.c:can_put_echo_skb() > http://lxr.linux.no/#linux+v2.6.34/drivers/net/can/dev.c#L266 > > > >> How do you test if CAN_RAW_RECV_OWN_MSGS is working? > I am using the attached code. > > > #ip link set can0 up type can bitrate 125000 > #candump can0 -> in one terminal > #./can_rcvownmsg ->in another terminal . This is the compiled output of > sockcan.c. > socket s:3 > ifindex: 3 > bind successful > (not returning to console. Means it is struck at the recvfrom.) > > Also, I expect the data to be received at can0 ("candump can0" terminal). > But that is also not happening. > > I can see from the net/can/raw.c, recv_own_msgs, member of the struct > raw_sock is set when setsockoptions(CAN_RAW_RECV_OWN_MSGS) is called. > But I think, it is not used to make the recv own msgs functionality. (I > may be wrong. It may be done at a different place also.) > http://lxr.linux.no/#linux+v2.6.34/net/can/raw.c
CAN_RAW_RECV_OWN_MSG will *not* work, if CAN_RAW_LOOPBACK is disabled., which is the case in your test program. > Has anybody tested the recv own msgs functionality in linux-2.6.31? (Just > for confirmation). I will do some testing later thihs week. Wolfgang. _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
