netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can: expected receive behavior broken
@ 2010-07-28  7:56 Matthias Fuchs
       [not found] ` <201007280956.38957.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Matthias Fuchs @ 2010-07-28  7:56 UTC (permalink / raw)
  To: Linux Netdev List; +Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w

Hi,

I just noticed that the receive behavior of CAN sockets is broken
in current net-next-2.6.
I wrote some simple code that receives messages and echos them back to
the bus. When I now trigger one single message on the bus, I get
this message received and echoed back in an endless loop.

I do not touch the sockopts CAN_RAW_LOOPBACK or CAN_RAW_RECV_OWN_MSGS in my code.
Only (!) setting CAN_RAW_LOOPBACK to 0 helps at the moment. But this behavior
actually has nothing to do with LOOPBACK but more with RECV_OWN_MSGS.

Matthias

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: can: expected receive behavior broken
       [not found] ` <201007280956.38957.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
@ 2010-07-28  8:17   ` Wolfgang Grandegger
       [not found]     ` <4C4FE7AC.4010806-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2010-07-28  8:17 UTC (permalink / raw)
  To: Matthias Fuchs; +Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Linux Netdev List

On 07/28/2010 09:56 AM, Matthias Fuchs wrote:
> Hi,
> 
> I just noticed that the receive behavior of CAN sockets is broken
> in current net-next-2.6.
> I wrote some simple code that receives messages and echos them back to
> the bus. When I now trigger one single message on the bus, I get
> this message received and echoed back in an endless loop.
> 
> I do not touch the sockopts CAN_RAW_LOOPBACK or CAN_RAW_RECV_OWN_MSGS in my code.
> Only (!) setting CAN_RAW_LOOPBACK to 0 helps at the moment. But this behavior
> actually has nothing to do with LOOPBACK but more with RECV_OWN_MSGS.

Sounds wired! What driver are you using?

Wolfgang.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: can: expected receive behavior broken
       [not found]     ` <4C4FE7AC.4010806-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
@ 2010-07-28  8:23       ` Matthias Fuchs
       [not found]         ` <201007281023.25039.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Matthias Fuchs @ 2010-07-28  8:23 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Linux Netdev List

plx_pci/sja1000 + esd_usb2

Should be easy to reproduce.

Matthias

On Wednesday 28 July 2010 10:17, Wolfgang Grandegger wrote:
> On 07/28/2010 09:56 AM, Matthias Fuchs wrote:
> > Hi,
> > 
> > I just noticed that the receive behavior of CAN sockets is broken
> > in current net-next-2.6.
> > I wrote some simple code that receives messages and echos them back to
> > the bus. When I now trigger one single message on the bus, I get
> > this message received and echoed back in an endless loop.
> > 
> > I do not touch the sockopts CAN_RAW_LOOPBACK or CAN_RAW_RECV_OWN_MSGS in my code.
> > Only (!) setting CAN_RAW_LOOPBACK to 0 helps at the moment. But this behavior
> > actually has nothing to do with LOOPBACK but more with RECV_OWN_MSGS.
> 
> Sounds wired! What driver are you using?
> 
> Wolfgang.
> 
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: can: expected receive behavior broken
       [not found]         ` <201007281023.25039.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
@ 2010-07-29  9:36           ` Oliver Hartkopp
       [not found]             ` <4C514BAE.4070201-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Hartkopp @ 2010-07-29  9:36 UTC (permalink / raw)
  To: Matthias Fuchs
  Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Linux Netdev List,
	Wolfgang Grandegger

On 28.07.2010 10:23, Matthias Fuchs wrote:
> plx_pci/sja1000 + esd_usb2
> 

Hi Matthias,

i added a test program to the SVN that checks whether the CAN_RAW_LOOPBACK and
CAN_RAW_RECV_OWN_MSGS socket options work properly (in can.ko and can-raw-ko
and vcan.ko).

So far i was only able to test it on vcan0, as i'm on a business trip and
don't have a real CAN hardware with me.

I'll enhance it to force the CAN netdev to be given on the commandline.

Regarding your request, i was able to see the bad behaviour in the latest
net-next-2.6. You need to make

    modprobe vcan echo=1

before creating vcan devices to test the loopback on driver level!

Invoking tst-rcv-own-msgs produces this output, which is far away from the
correct (wanted) output seen in the commit message below.

sockopt default
 s : 0
 t : 0
 timeout
sockopt - -
 timeout
sockopt - R
 timeout
sockopt L -
 s : 3
 t : 3
 timeout
sockopt L R
 s : 4
 t : 4
 timeout
done.

I'll check that with the latest linux-2.6 (after rebooting :-)

Thanks for the hint! I'll run the tst-rcv-own-msgs test tool on the upcoming
net-next-2.6's and also put it into LTP later on.

Regards,
Oliver

--- snip! ---

Added:
   trunk/test/tst-rcv-own-msgs.c
Modified:
   trunk/test/Makefile
Log:
Added test programm to check the correct functionality of
CAN_RAW_LOOPBACK and CAN_RAW_RECV_OWN_MSGS socket options.

It needs a vcan0 virtual CAN network interface and should produce an output
like this, when invoked:

sockopt default
 t : 0
 timeout
sockopt - -
 timeout
sockopt - R
 timeout
sockopt L -
 t : 3
 timeout
sockopt L R
 s : 4
 t : 4
 timeout
done.


> 
> On Wednesday 28 July 2010 10:17, Wolfgang Grandegger wrote:
>> On 07/28/2010 09:56 AM, Matthias Fuchs wrote:
>>> Hi,
>>>
>>> I just noticed that the receive behavior of CAN sockets is broken
>>> in current net-next-2.6.
>>> I wrote some simple code that receives messages and echos them back to
>>> the bus. When I now trigger one single message on the bus, I get
>>> this message received and echoed back in an endless loop.
>>>
>>> I do not touch the sockopts CAN_RAW_LOOPBACK or CAN_RAW_RECV_OWN_MSGS in my code.
>>> Only (!) setting CAN_RAW_LOOPBACK to 0 helps at the moment. But this behavior
>>> actually has nothing to do with LOOPBACK but more with RECV_OWN_MSGS.
>>
>> Sounds wired! What driver are you using?
>>
>> Wolfgang.
>>
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: can: expected receive behavior broken
       [not found]             ` <4C514BAE.4070201-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
@ 2010-07-29 11:16               ` Oliver Hartkopp
  0 siblings, 0 replies; 5+ messages in thread
From: Oliver Hartkopp @ 2010-07-29 11:16 UTC (permalink / raw)
  To: Matthias Fuchs
  Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Linux Netdev List,
	Wolfgang Grandegger

On 29.07.2010 11:36, Oliver Hartkopp wrote:

> Invoking tst-rcv-own-msgs produces this output, which is far away from the
> correct (wanted) output seen in the commit message below.
> 
> sockopt default
>  s : 0
>  t : 0
>  timeout
> sockopt - -
>  timeout
> sockopt - R
>  timeout
> sockopt L -
>  s : 3
>  t : 3
>  timeout
> sockopt L R
>  s : 4
>  t : 4
>  timeout
> done.
> 
> I'll check that with the latest linux-2.6 (after rebooting :-)

Grr - it is also broken in 2.6.34-rc7-05126-g278554b ...

I'll go and hunt the bad commit in 2.6.34 and will fix it.

Tnx & regards,
Oliver


> It needs a vcan0 virtual CAN network interface and should produce an output
> like this, when invoked:
> 
> sockopt default
>  t : 0
>  timeout
> sockopt - -
>  timeout
> sockopt - R
>  timeout
> sockopt L -
>  t : 3
>  timeout
> sockopt L R
>  s : 4
>  t : 4
>  timeout
> done.
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-29 11:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  7:56 can: expected receive behavior broken Matthias Fuchs
     [not found] ` <201007280956.38957.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
2010-07-28  8:17   ` Wolfgang Grandegger
     [not found]     ` <4C4FE7AC.4010806-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-07-28  8:23       ` Matthias Fuchs
     [not found]         ` <201007281023.25039.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>
2010-07-29  9:36           ` Oliver Hartkopp
     [not found]             ` <4C514BAE.4070201-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2010-07-29 11:16               ` Oliver Hartkopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).