linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SocketCAN over Ethernet
@ 2014-04-03 11:52 Daniel Boström
  2014-04-03 16:51 ` Max S.
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel Boström @ 2014-04-03 11:52 UTC (permalink / raw)
  To: linux-can

Hello,

I am going to try to explain our scenario briefly.

We want to setup a simulation environment for our system running on Ubuntu 
so that we can use it together with our Windows based simulation tool 
suite. Currently we are running Ubuntu in a virtual machine using 
VirtualBox on a Windows host. In Ubuntu we use SocketCAN and we would like 
to continue to do so but instead of using real CAN hardware somehow setup 
CAN communication over Ethernet to the Windows host.

I am new to CAN on Linux but I have been reading about SocketCAN and was 
wondering if we could use virtual can (vcan) somehow?

I appreciate any help clarifying if, and if so, how SocketCAN over 
Ethernet could be achieved. If you need additional information about our 
scenario please let me know.

Best regards
Daniel
 


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

* Re: SocketCAN over Ethernet
  2014-04-03 11:52 SocketCAN over Ethernet Daniel Boström
@ 2014-04-03 16:51 ` Max S.
  2014-04-04 19:17   ` Michal Sojka
  2014-04-03 19:42 ` Oliver Hartkopp
  2014-04-03 20:54 ` François
  2 siblings, 1 reply; 9+ messages in thread
From: Max S. @ 2014-04-03 16:51 UTC (permalink / raw)
  To: Daniel Boström; +Cc: linux-can

Hello,

I don't know of a direct way of hooking up two socket can interfaces
over eth.

If this is just a quick fix or development crutch and not for production
you could try the following: Create a VCAN interface on both machines.
Create a simple userspace program (perhaps in C) to listen to the VCAN
interface, and transmit the frames read, via UDP (or TCP), to the other
machine. Create another program to listen to the UDP traffic and dumps
it into the VCAN interface on the other host. invert the roles and
you've got duplex.

If the arch of the two hosts is binary compatible you don't even need to
encode data.

I have done this while I was working on a display software, It allowed
me to work on the laptop on the sofa using live can data aggregated by
sensors and a server elsewhere.

Regards,
Maximilian Schneider.

On Thu, 2014-04-03 at 11:52 +0000, Daniel Boström wrote:
> Hello,
> 
> I am going to try to explain our scenario briefly.
> 
> We want to setup a simulation environment for our system running on Ubuntu 
> so that we can use it together with our Windows based simulation tool 
> suite. Currently we are running Ubuntu in a virtual machine using 
> VirtualBox on a Windows host. In Ubuntu we use SocketCAN and we would like 
> to continue to do so but instead of using real CAN hardware somehow setup 
> CAN communication over Ethernet to the Windows host.
> 
> I am new to CAN on Linux but I have been reading about SocketCAN and was 
> wondering if we could use virtual can (vcan) somehow?
> 
> I appreciate any help clarifying if, and if so, how SocketCAN over 
> Ethernet could be achieved. If you need additional information about our 
> scenario please let me know.
> 
> Best regards
> Daniel
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

* Re: SocketCAN over Ethernet
  2014-04-03 11:52 SocketCAN over Ethernet Daniel Boström
  2014-04-03 16:51 ` Max S.
@ 2014-04-03 19:42 ` Oliver Hartkopp
  2014-04-04  7:08   ` Daniel Boström
  2014-04-03 20:54 ` François
  2 siblings, 1 reply; 9+ messages in thread
From: Oliver Hartkopp @ 2014-04-03 19:42 UTC (permalink / raw)
  To: Daniel Boström, linux-can

Hello Daniel,

On 03.04.2014 13:52, Daniel Boström wrote:

> Currently we are running Ubuntu in a virtual machine using 
> VirtualBox on a Windows host. In Ubuntu we use SocketCAN and we would like 
> to continue to do so but instead of using real CAN hardware somehow setup 
> CAN communication over Ethernet to the Windows host.

Don't know if I understand you correctly:

Do you want the CAN interfaces to be attached to the Windows host and access
these interfaces from Linux ... or the other way around?

Maybe a look at the JAVA tool Kayak (http://kayak.2codeornot2code.org/) might
be interesting for you.

Kayak uses the socketcand (https://github.com/dschanoeh/socketcand/) which
runs on Linux and provides the CAN interfaces via IP-sockets (to whatever client).

Regards,
Oliver


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

* Re: SocketCAN over Ethernet
  2014-04-03 11:52 SocketCAN over Ethernet Daniel Boström
  2014-04-03 16:51 ` Max S.
  2014-04-03 19:42 ` Oliver Hartkopp
@ 2014-04-03 20:54 ` François
  2 siblings, 0 replies; 9+ messages in thread
From: François @ 2014-04-03 20:54 UTC (permalink / raw)
  To: Daniel Boström, linux-can

Hello Daniel,

Have a look at socketcand :
https://github.com/dschanoeh/socketcand

It might be exactly what you are looking for...

F. Beaulier

Le 03/04/2014 13:52, Daniel Boström a écrit :
> Hello,
>
> I am going to try to explain our scenario briefly.
>
> We want to setup a simulation environment for our system running on Ubuntu
> so that we can use it together with our Windows based simulation tool
> suite. Currently we are running Ubuntu in a virtual machine using
> VirtualBox on a Windows host. In Ubuntu we use SocketCAN and we would like
> to continue to do so but instead of using real CAN hardware somehow setup
> CAN communication over Ethernet to the Windows host.
>
> I am new to CAN on Linux but I have been reading about SocketCAN and was
> wondering if we could use virtual can (vcan) somehow?
>
> I appreciate any help clarifying if, and if so, how SocketCAN over
> Ethernet could be achieved. If you need additional information about our
> scenario please let me know.
>
> Best regards
> Daniel
>   
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: SocketCAN over Ethernet
  2014-04-03 19:42 ` Oliver Hartkopp
@ 2014-04-04  7:08   ` Daniel Boström
  2014-04-04 11:59     ` Daniel Boström
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Boström @ 2014-04-04  7:08 UTC (permalink / raw)
  To: linux-can

Oliver Hartkopp <socketcan <at> hartkopp.net> writes:

> 
> Hello Daniel,
> 
> On 03.04.2014 13:52, Daniel Boström wrote:
> 
> > Currently we are running Ubuntu in a virtual machine using 
> > VirtualBox on a Windows host. In Ubuntu we use SocketCAN and we would 
like 
> > to continue to do so but instead of using real CAN hardware somehow 
setup 
> > CAN communication over Ethernet to the Windows host.
> 
> Don't know if I understand you correctly:
> 
> Do you want the CAN interfaces to be attached to the Windows host and 
access
> these interfaces from Linux ... or the other way around?
> 
> Maybe a look at the JAVA tool Kayak (http://kayak.2codeornot2code.org/) 
might
> be interesting for you.
> 
> Kayak uses the socketcand (https://github.com/dschanoeh/socketcand/) 
which
> runs on Linux and provides the CAN interfaces via IP-sockets (to 
whatever client).
> 
> Regards,
> Oliver
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

Thank you everyone for the replies.

I will try to explain a bit more what we are trying to do.

Our simulation software (used for testing our system without real 
hardware) on Windows listens for incoming TCP connections
from our system to test (using SocketCAN) running on the Ubuntu VM. So we 
would like a way to setup CAN communication over Ethernet (TCP) between 
the Windows and Ubuntu VM. In other words we want to send and receive can 
messages on both Windows and Ubuntu. socketcand sounds very interesting I 
will have a look at it.

We have run a similar simulation before but on Windows only and would like 
to be able to include an ubuntu machine in the simulation as well.

/Daniel


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

* Re: SocketCAN over Ethernet
  2014-04-04  7:08   ` Daniel Boström
@ 2014-04-04 11:59     ` Daniel Boström
  2014-04-07 14:14       ` Daniel Boström
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Boström @ 2014-04-04 11:59 UTC (permalink / raw)
  To: linux-can

I created a vcan interface, built and started the socketcand daemon on the 
Ubuntu vm and finally installed Kayak on Windows. I had to edit 
socketcand.conf a bit but now CAN messages sent using cansend from Ubuntu 
show up in Kayak. I think this is a great start, thanks again for the help.


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

* Re: SocketCAN over Ethernet
  2014-04-03 16:51 ` Max S.
@ 2014-04-04 19:17   ` Michal Sojka
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Sojka @ 2014-04-04 19:17 UTC (permalink / raw)
  To: Max S., Daniel Boström; +Cc: linux-can

Hi,

On Thu, Apr 03 2014, Max S. wrote:
> I don't know of a direct way of hooking up two socket can interfaces
> over eth.

This won't probably help Daniel, but some time ago, we implemented
an in-kernel CAN-UDP gateway.

Kernel patch is available at
https://rtime.felk.cvut.cz/gitweb/can-eth-gw-linux.git/commit/3f7fc0265e9555dea75cef7709720e62d8da37d8

The commit message says:
> CAN-Ethernet gateway - kernel part
>  
> This patch implements CAN-Ethernet (or more precisely CAN-UDP) gateway.
> The code here is only responsible for routing the messages in kernel
> space. Initial configuration and setup of the involved sockets is done
> in user space with cegw utility.
>  
> Currently, the gateway support IPv4 and IPv6.  CAN_FD frames are note
> supported.

The user-space counterpart is at
https://rtime.felk.cvut.cz/gitweb/can-utils.git/blob/refs/heads/cegw:/cegw.c

Probably, the only reason, why the gateway should be implemented in the
kernel is performance. We measured that the kernel gateway is 12% faster
than an user space one (which is not much).

If somebody is interested in more details, let me know.

-Michal

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

* Re: SocketCAN over Ethernet
  2014-04-04 11:59     ` Daniel Boström
@ 2014-04-07 14:14       ` Daniel Boström
  2014-04-08  7:21         ` Daniel Boström
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Boström @ 2014-04-07 14:14 UTC (permalink / raw)
  To: linux-can

Daniel Boström <daniel.bostrom <at> maximatecc.com> writes:

> 
> I created a vcan interface, built and started the socketcand daemon on 
the 
> Ubuntu vm and finally installed Kayak on Windows. I had to edit 
> socketcand.conf a bit but now CAN messages sent using cansend from 
Ubuntu 
> show up in Kayak. I think this is a great start, thanks again for the 
help.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

Unfortunately when I tried the same setup today and use sendcan in Ubuntu 
Kayak does not show the message when I check the raw view. BusStatistics 
is however updated each time I send a message. I also noticed I am unable 
to send a message from Kayak and see it in Ubuntu using candump. Does 
anyone have an idea why it is not working anymore?



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

* Re: SocketCAN over Ethernet
  2014-04-07 14:14       ` Daniel Boström
@ 2014-04-08  7:21         ` Daniel Boström
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Boström @ 2014-04-08  7:21 UTC (permalink / raw)
  To: linux-can

Daniel Boström <daniel.bostrom <at> maximatecc.com> writes:

> 
> Unfortunately when I tried the same setup today and use sendcan in 
Ubuntu 
> Kayak does not show the message when I check the raw view. BusStatistics 
> is however updated each time I send a message. I also noticed I am 
unable 
> to send a message from Kayak and see it in Ubuntu using candump. Does 
> anyone have an idea why it is not working anymore?
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


Ignore this post, I did not read the Kayak tutorial carefully, it works 
now.


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

end of thread, other threads:[~2014-04-08  7:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 11:52 SocketCAN over Ethernet Daniel Boström
2014-04-03 16:51 ` Max S.
2014-04-04 19:17   ` Michal Sojka
2014-04-03 19:42 ` Oliver Hartkopp
2014-04-04  7:08   ` Daniel Boström
2014-04-04 11:59     ` Daniel Boström
2014-04-07 14:14       ` Daniel Boström
2014-04-08  7:21         ` Daniel Boström
2014-04-03 20:54 ` François

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).