3. Device Assigment

Hint

All user inputs should be done in a Terminal, or in case a file is edited in an editor.

3.1. Ethernet device identification

There are several ways to detect the desired network adapter, which should be assigned to the rtos part. This tutorial will presents 2 different ways to detect the desired network adapter.

  1. Connect the desired Ethernet port with a network cable (to the network) and disconnect all other ports from the other network adapters.

List all available adapters:

ifconfig -a

The output will be similar to the following output. The adapter, which is connect to the network will contain a <link> entry. This adapter is the seached one.

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 172.17.10.53  netmask 255.255.0.0  broadcast 172.17.255.255
    inet6 2a02:590:801:2c00:96b0:b8a:2c58:6c91  prefixlen 64  scopeid 0x0<global>
    inet6 fe80::fe6f:c5f8:c5cd:e3cd  prefixlen 64  scopeid 0x20<link>
    inet6 2a02:590:801:2c00:a5de:6755:9045:d0c8  prefixlen 64  scopeid 0x0<global>
    ether 90:1b:0e:18:c9:83  txqueuelen 1000  (Ethernet)
    RX packets 147818  bytes 18746372 (18.7 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 52733  bytes 372725428 (372.7 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In this example the name of the desired network adapter is enp2s0.

  1. A well-known MAC-ID by user

In this example the adapter owns the following MAC-ID: 90:1b:0e:18:c9:83

List all available adapters:

ifconfig -a

Identify the entry with the well-known MAC-ID:

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 172.17.10.53  netmask 255.255.0.0  broadcast 172.17.255.255
    inet6 2a02:590:801:2c00:96b0:b8a:2c58:6c91  prefixlen 64  scopeid 0x0<global>
    inet6 fe80::fe6f:c5f8:c5cd:e3cd  prefixlen 64  scopeid 0x20<link>
    inet6 2a02:590:801:2c00:a5de:6755:9045:d0c8  prefixlen 64  scopeid 0x0<global>
    ether 90:1b:0e:18:c9:83  txqueuelen 1000  (Ethernet)
    RX packets 147818  bytes 18746372 (18.7 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 52733  bytes 372725428 (372.7 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 74:ea:3a:81:4b:1d  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 241  bytes 16996 (16.9 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 241  bytes 16996 (16.9 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=99<UP,BROADCAST,NOTRAILERS,RUNNING>  mtu 1500
    inet 192.168.157.1  netmask 255.255.255.0  broadcast 192.168.157.255
    ether 00:60:c8:00:00:00  txqueuelen 1000  (Ethernet)
    RX packets 19  bytes 1418 (1.4 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 95  bytes 19831 (19.8 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In our example the name of the desired network adapter is enp2s0. The well-known MAC-ID is found in the ether field of the output.

3.2. Ethernet device assignment

Important

This section only applies for PCIe devices. Legacy devices are handled in the next chapter. See Legacy Ethernet PCI devices.

In the previous section the detected name of the adapter is enp2s0. This name will be given as first parameter of the ./addeth.sh shell script. The second parameter (mandatory) is the rtos device name. Third parameter is a sequential number for each assigned device, starting with 1.

sudo ./addeth.sh enp2s0 rtos_eth 1

Additional network card (device):

sudo ./addeth.sh [DETECTED_NAME] rtos_eth2 2

Important

The script creates 2 files located in /hv/config: rtos_eth.sh, rtos_eth.config.

Hint

The RTOS device name is mandatory. This parameter must be a unique name that is used to identify the device. This name will also be used in filenames that are created by the addeth.sh script. In this tutorial the default name used is rtos_eth.

3.3. Legacy Ethernet PCI devices

If you have legacy PCI device (not PCIe) it will be required to assign device in another way. A fourth, optional parameter of addeth.sh script shall be used then.

sudo ./addeth.sh [DETECTED_NAME] rtos_eth 1 <interrupt type>

Possible values of <interrupt type> are legacy or no_interrupt. If this parameter is not provided, standard MSI interrupt is configured.

3.4. Adjust main configuration file

After creating the device configuration file <RTOS device name>.config, it needs to be included in the main configuration file. In our tutorial we use rtos_eth as the unique <RTOS device name>.

  • RTOS-32:

cd /hv/rtos-32
gedit ./realtimedemo.config
  • LxWin:

cd /hv/lx
gedit ./hv.sh

Add the corresponding rtos_eth.config entry to the includes section of the file. The files contains a commented-out entry with this name. Comment-in the entry and save the file. To comment-in the line remove the .config comment sign ‘;’.

The following example shows the ‘modified’ LxWin .config file:

;-----------------------------------------------------------------------
; includes
;-----------------------------------------------------------------------
#include "../config/membase.config"
#include "../config/memory.config"
#include "../config/cpu.config"
#include "../config/hwbase.config"
#include "../config/hwdevbase.config"
#include "../config/vmf.config"
#include "../config/debug.config"
#include "../config/windowsvm.config"
;#include "../config/pcidev1.config"
;#include "../config/pcidev2.config"
#include "../config/rtos_eth.config"
#include "linux.config"

3.5. Adjust system startup script /etc/rc.local

The device assignment scripts <RTOS device name>.sh usually shall be executed automatically on system startup. To accomplish this, add the respective <RTOS device name>.sh calls in the file /etc/rc.local. In our tutorial we use rtos_eth as the unique <RTOS device name>, as mentioned earlier.

sudo gedit /etc/rc.local

The rc.local file should contain at least the following string after editing: source /hv/config/rtos_eth.sh add

The example below shows, how the device with the unique name rtos_eth is assigned.

#!/bin/bash
source /hv/config/rtos_eth.sh add

Please reboot the system to make the change effective.

sudo reboot

3.6. Verification

With the RTOS-32Demo it’s possible to verify, if the assigned netwok adapter is visible to the rtos part:

cd /hv/rtos-32
sudo ./rtos32demo.sh

The output will looks like this for the used network adapter (8086:1533) in this tutorial:

PCI BIOS Information

Vendor Device Bus Dev Func Class  Int IRQ TLat MSI Type
-------------------------------------------------------
FFFE   FFFE     0   0   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0   2   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  20   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  22   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  26   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  27   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  28   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  29   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  30   0  000000  -    0    0  -  Invalid class code
FFFE   FFFE     0  31   0  000000  -    0    0  -  Invalid class code
8086   1533     1   0   0  020000  A    5    0  X  Network controller
FFFE   FFFE     2   0   0  000000  -    0    0  -  Invalid class code
10EC   8169     3   5   0  020000  A    4   64  -  Network controller
Current Date/time: 01/01/2018 00:00:00
Current Date/time: 01/01/2018 00:00:01
Current Date/time: 01/01/2018 00:00:02
Current Date/time: 01/01/2018 00:00:03
Current Date/time: 01/01/2018 00:00:04

List of threads:
Name            Prio State      R.Del FStck  MStck Scheds  CTime  CT%
---------------------------------------------------------------------
Main Task          5 Current          63060  61276     11  -      -
Idle Task          0 Ready             2164   2164    526  -      -
Comm               5 Delaying       1 32832  31724    527  -      -
IPTASK             6 BlckdWait         4128   3940      2  -      -
IPTIMER            6 Delaying      11  4120   3940     44  -      -

Interrupts:
 IRQ    Calls  FreeStack  Doubles  Time
-------------------------------------------
   0      526        744        0  -

Network:
 Ping will respond at IP address 192.168.157.2