[etherlab-users] How to only use one adapter for EtherCAT??

Fredrik Viksten etherlab at viksten.org
Thu Feb 27 14:34:25 CET 2014


Hi all!


New user and first post here :) Hi all! And thanks for this EtherCAT
implementation!

The problem / question:
How would I go about setting the system up so I can A) use NIC eth0 for
normal network traffic and B) use an EtherCAT-optimized kernel driver for
NIC eth1 when they are both using the same chipset?

Some background:
I've been poking around with the EtherCAT master on and off during the
last few weeks. I'm still on a regular kernel (3.5.0-45-generic #68-Ubuntu
SMP x86_64) under Linux Mint 14 Nadia (i.e. no RT extensions).
I've been successful in communicating with a Beckhoff EK1100 and some DIO
and relays attached using a program I wrote. This I have managed to do
using both the generic driver of EtherCAT master 1.5.2 and using a native
driver (I merged the EtherCAT-specifics of the r8169 module for 3.4 into
the kernel driver for 3.5, which I attach here if someone else wants to
use it. I can not guarantee that this is working though!).

>From what I understand it should be possible to have more than one
Ethernet NIC installed and have EtherCAT only reserve one of thoes through
setting in /etc/sysconfig/ethercat ??? Is this true also for two NICs
using the same chip/driver? I'm guessing it is, what is otherwise the use
of the MASTER0_DEVICE setting in /etc/sysconfig/ethercat?

Anyway, I'm using two r8169 NICs in my system. NIC eth0 is managed by
NetworkManager and eth1 is not managed by NM. NIC eth0 has hw-address
00:24:1d:bf:c8:9f and eth1 has hw-address 00:e0:4c:68:17:62. When I set
MASTER0_DEVICE="00:e0:4c:68:17:62" and DEVICE_MODULES="generic" the
EtherCAT master only uses eth1 and I can still read email, surf the web
etc through my primary eth0 interface. IF however, I change to
DEVICE_MODULES="r8169" the EtherCAT communication will still work through
eth1 but my normal network connection through eth0 gets dropped since the
EtherCAT master steals this interface too! Is this supposed to happen?


This is the relevant part of /var/log/syslog for the case of
DEVICE_MODULES="r8169" after running "sudo /etc/init.d/ethercat start":

Feb 27 14:08:06 bumblebee kernel: [  285.271658] EtherCAT: Master driver
1.5.2 2eff7c993a63
Feb 27 14:08:06 bumblebee kernel: [  285.271807] EtherCAT: 1 master
waiting for devices.
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): carrier now
OFF (device state 100, deferring action for 4 seconds)
Feb 27 14:08:06 bumblebee dhclient: receive_packet failed on eth0: Network
is down
Feb 27 14:08:06 bumblebee NetworkManager[879]:    SCPlugin-Ifupdown:
devices removed (path:
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/eth0, iface: eth0)
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): now unmanaged
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): device state
change: activated -> unmanaged (reason 'removed') [100 10 36]
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): deactivating
device (reason 'removed') [36]
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): canceled
DHCP transaction, DHCP client pid 2264
Feb 27 14:08:06 bumblebee NetworkManager[879]: <warn> (6) failed to find
interface name for index
Feb 27 14:08:06 bumblebee NetworkManager[879]:
nm_system_iface_flush_routes: assertion `iface != NULL' failed
Feb 27 14:08:06 bumblebee NetworkManager[879]: <warn> (6) failed to find
interface name for index
Feb 27 14:08:06 bumblebee NetworkManager[879]: <warn> DNS: plugin dnsmasq
update failed
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> ((null)): removing
resolv.conf from /sbin/resolvconf
Feb 27 14:08:06 bumblebee dnsmasq[1378]: setting upstream servers from DBus
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> (eth0): cleaning up...
Feb 27 14:08:06 bumblebee NetworkManager[879]: <warn> (6) failed to find
interface name for index
Feb 27 14:08:06 bumblebee NetworkManager[879]:
(nm-system.c:769):nm_system_iface_get_flags: runtime check failed: (iface
!= NULL)
Feb 27 14:08:06 bumblebee NetworkManager[879]: <error> [1393506486.624702]
[nm-system.c:771] nm_system_iface_get_flags(): (unknown): failed to get
interface link object
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> Unmanaged Device
found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889)
Feb 27 14:08:06 bumblebee NetworkManager[879]: <info> Unmanaged Device
found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889)
Feb 27 14:08:06 bumblebee dbus[767]: [system] Activating service
name='org.freedesktop.nm_dispatcher' (using servicehelper)
Feb 27 14:08:06 bumblebee dbus[767]: [system] Successfully activated
service 'org.freedesktop.nm_dispatcher'
Feb 27 14:08:07 bumblebee NetworkManager[879]:    SCPlugin-Ifupdown:
devices removed (path:
/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth1, iface: eth1)
Feb 27 14:08:07 bumblebee NetworkManager[879]:    Ifupdown: get unmanaged
devices count: 0
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): now managed
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): device state
change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Feb 27 14:08:07 bumblebee NetworkManager[879]: <warn> (5) failed to find
interface name for index
Feb 27 14:08:07 bumblebee NetworkManager[879]:
(nm-system.c:769):nm_system_iface_get_flags: runtime check failed: (iface
!= NULL)
Feb 27 14:08:07 bumblebee NetworkManager[879]: <error> [1393506487.658396]
[nm-system.c:771] nm_system_iface_get_flags(): (unknown): failed to get
interface link object
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): bringing up
device.
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): deactivating
device (reason 'managed') [2]
Feb 27 14:08:07 bumblebee NetworkManager[879]: <warn> (5) failed to find
interface name for index
Feb 27 14:08:07 bumblebee NetworkManager[879]:
nm_system_iface_flush_routes: assertion `iface != NULL' failed
Feb 27 14:08:07 bumblebee NetworkManager[879]: <warn> (5) failed to find
interface name for index
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): now unmanaged
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth1): device state
change: unavailable -> unmanaged (reason 'removed') [20 10 36]
Feb 27 14:08:07 bumblebee NetworkManager[879]: <warn> (5) failed to find
interface name for index
Feb 27 14:08:07 bumblebee NetworkManager[879]:
(nm-system.c:769):nm_system_iface_get_flags: runtime check failed: (iface
!= NULL)
Feb 27 14:08:07 bumblebee NetworkManager[879]: <error> [1393506487.663503]
[nm-system.c:771] nm_system_iface_get_flags(): (unknown): failed to get
interface link object
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> Unmanaged Device
found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889)
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> Unmanaged Device
found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889)
Feb 27 14:08:07 bumblebee kernel: [  286.587558] ec_r8169 Gigabit Ethernet
driver 2.3LK-NAPI loaded
Feb 27 14:08:07 bumblebee kernel: [  286.587673] ec_r8169 0000:02:00.0:
irq 43 for MSI/MSI-X
Feb 27 14:08:07 bumblebee kernel: [  286.587698] EtherCAT: Accepting
00:E0:4C:68:17:62 as main device for master 0.
Feb 27 14:08:07 bumblebee kernel: [  286.587706] ec_r8169 0000:02:00.0:
(unregistered net_device): RTL8168c/8111c at 0xffffc90000614000,
00:e0:4c:68:17:62, XID 1c4000c0 IRQ 43
Feb 27 14:08:07 bumblebee kernel: [  286.587710] ec_r8169 0000:02:00.0:
(unregistered net_device): jumbo features [frames: 6128 bytes, tx
checksumming: ko]
Feb 27 14:08:07 bumblebee kernel: [  286.595747] EtherCAT 0: Starting
EtherCAT-IDLE thread.
Feb 27 14:08:07 bumblebee kernel: [  286.595855] ec_r8169 Gigabit Ethernet
driver 2.3LK-NAPI loaded
Feb 27 14:08:07 bumblebee kernel: [  286.595980] ec_r8169 0000:03:00.0:
irq 44 for MSI/MSI-X
Feb 27 14:08:07 bumblebee kernel: [  286.600181] ec_r8169 0000:03:00.0:
eth0: RTL8168c/8111c at 0xffffc90000650000, 00:24:1d:bf:c8:9f, XID
1c4000c0 IRQ 44
Feb 27 14:08:07 bumblebee kernel: [  286.600188] ec_r8169 0000:03:00.0:
eth0: jumbo features [frames: 6128 bytes, tx checksumming: ko]
Feb 27 14:08:07 bumblebee kernel: [  286.603182] genirq: Flags mismatch
irq 0. 00000000 (eth0) vs. 00015a20 (timer)
Feb 27 14:08:07 bumblebee NetworkManager[879]:    SCPlugin-Ifupdown:
devices added (path:
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/eth0, iface: eth0)
Feb 27 14:08:07 bumblebee NetworkManager[879]:    SCPlugin-Ifupdown:
device added (path:
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/eth0, iface: eth0):
no ifupdown configuration found.
Feb 27 14:08:07 bumblebee NetworkManager[879]: <warn> failed to allocate
link cache: (-10) Operation not supported
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): carrier is OFF
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): new Ethernet
device (driver: 'ec_r8169' ifindex: 7)
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): exported as
/org/freedesktop/NetworkManager/Devices/5
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): now managed
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): device state
change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): bringing up
device.
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> (eth0): deactivating
device (reason 'managed') [2]
Feb 27 14:08:07 bumblebee kernel: [  286.607050] IPv6:
ADDRCONF(NETDEV_UP): eth0: link is not ready
Feb 27 14:08:07 bumblebee NetworkManager[879]: <info> Added default wired
connection 'Wired connection 2' for
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/eth0
Feb 27 14:08:09 bumblebee kernel: [  288.584997] EtherCAT 0: Link state of
ecm0 changed to UP.
Feb 27 14:08:09 bumblebee kernel: [  288.589019] EtherCAT 0: 3 slave(s)
responding on main device.
Feb 27 14:08:09 bumblebee kernel: [  288.589022] EtherCAT 0: Slave states
on main device: PREOP.
Feb 27 14:08:09 bumblebee kernel: [  288.589073] EtherCAT 0: Scanning bus.
Feb 27 14:08:09 bumblebee kernel: [  288.801674] EtherCAT 0: Bus scanning
completed in 212 ms.
Feb 27 14:08:09 bumblebee kernel: [  288.801678] EtherCAT 0: Using slave 0
as DC reference clock.


Please help!

Cheers
Fredrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r8169-3.5-ethercat.c
Type: text/x-csrc
Size: 166281 bytes
Desc: not available
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20140227/2d725430/attachment-0003.c>


More information about the Etherlab-users mailing list