Modifying a BSP to support io-sock
If QNX does not provide a BSP that supports io-sock for your target hardware, you need to create one. To simplify the process, QNX recommends that you start with the io-sock-compatible BSP provided by QNX that most closely matches your target's specifications.
For detailed information on building a BSP, see the documentation for your BSP and the
Working with QNX BSPs
chapter in Building Embedded Systems.
The following guidelines are for migrating from a system that uses the QNX SDP 7.1 io-pkt networking stack to one that uses the QNX SDP 8.0 High-Performance Networking Stack (io-sock).
Networking applications
Include the following networking applications and files, from the specified locations.
The list includes the following optional utilities, which are useful for debugging tasks:
|
|
...
/sbin/dhcpcd=dhcpcd
/sbin/dhcpcd-run-hooks=${QNX_TARGET}/sbin/dhcpcd-run-hooks
/sbin/dhcpcd-hooks/20-resolv.conf=${QNX_TARGET}/sbin/dhcpcd-hooks/20-resolv.conf
/sbin/ifconfig=ifconfig
/sbin/io-sock=io-sock
/sbin/pfctl=pfctl
[uid=0 gid=0 perms=4755] /sbin/ping=ping
/sbin/route=route
/sbin/sysctl=sysctl
/usr/bin/netstat=netstat
/usr/bin/sockstat=sockstat
/usr/bin/vmstat=vmstat
/usr/sbin/arp=arp
/usr/sbin/devctl=devctl
/usr/sbin/devinfo=devinfo
/usr/sbin/fs-nfs3=fs-nfs3
/usr/sbin/ifmcstat=ifmcstat
/usr/sbin/ip6addrctl=ip6addrctl
/usr/sbin/ndp=ndp
/usr/lib/libedit.so=libedit.so
/usr/lib/libexpat.so=libexpat.so
/usr/lib/libfdt.so=libfdt.so
/usr/lib/librpc.so.2=librpc.so.2
/usr/lib/libxo.so.0=libxo.so.0
/lib/libsocket.so=libsocket.so
/lib/libjail.so=libjail.so
/usr/sbin/tcpdump=tcpdump
[uid=0 gid=0 perms=4755] /usr/sbin/traceroute=traceroute
[uid=0 gid=0 perms=4755] /usr/sbin/traceroute6=traceroute6
/etc/dhcpcd.conf=${QNX_TARGET}/etc/dhcpcd.conf
/etc/hosts=${QNX_TARGET}/etc/hosts
/etc/netconfig=${QNX_TARGET}/etc/netconfig
/etc/protocols=${QNX_TARGET}/etc/protocols
/etc/services=${QNX_TARGET}/etc/services
The dhcpcd utility requires the following utilities, provided via the toybox package shipped with QNX SDP 8.0, for building /etc/resolv.conf:
- cat
- chmod
- mkdir
- printf
- rm
For instructions on how to enable toybox utilities, see the toybox entry in the QNX OS Utilities Reference.
The dhcpcd utility also requires the directories
/var/db and /var/run. (An example of
adding these directories is included in the example PAM configuration in
Networking utilities
in the Board Support Packages
section.)
Required networking services
See Networking utilities
in the Board Support Packages
section.
Adding modules, drivers, and libraries
Include one or more of the io-sock network drivers. Most drivers require a driver for the device type (for example, devs-axe.so requires and mods-usb.so). See the entry for each driver in the Utilities Reference for the specific requirements.
- PHY:
- mods-phy.so (Ethernet PHY)
- mods-phy_fdt.so (Ethernet FDT PHY; AArch64 only)
- PCI:
- mods-pci.so (PCI bus)
- devs-em.so (Intel PRO/1000 Gigabit Ethernet adapter)
- devs-igc.so (Intel Ethernet Controller I225)
- devs-ix.so (Intel 10Gb Ethernet)
- devs-ixl.so (Intel Ethernet 700 Series Driver)
- devs-re.so (RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter)
- devs-rt.so (RealTek 8125/8126 PCI/PCIe Ethernet adapter)
- devs-vmx.so (VMware VMXNET3 Ethernet)
- devs-vtnet_pci.so (VirtIO PCI Ethernet)
- USB:
- mods-usb.so (USB bus)
- devs-axe.so (ASIX Electronics AX88x7x/760 USB Ethernet)
- devs-axge.so (ASIX Electronics AX88178A/AX88179 USB Gigabit Ethernet)
- devs-cdce.so (USB Communication Device Class Ethernet)
- devs-smsc.so (USB SMSC LAN9xxx Fast Ethernet)
- devs-urndis.so (USB RNDIS-Ethernet)
- FDT:
- mods-fdt.so (FDT bus)
- devs-cpsw-processor.so (TI CPSW J7/AM62)
- devs-cgem.so (Cadence Gigabit Ethernet MAC (GEM) controller)
- devs-dwc.so (DWC Gigabit Ethernet Controller)
- devs-dwceqos.so (Synopsys DWC Ethernet-Quality-of-Service MAC controller)
- devs-ffec.so (Freescale Fast Ethernet Controller)
- devs-genet.so (Raspberry Pi 4 Gigabit Ethernet)
- devs-vtnet_mmio.so (VirtIO MMIO Ethernet driver)
- Other:
- mods-vdevpeer-net.so (vdevpeer-net to interconnect with QVM)
To support: | Include: |
---|---|
ifconfig | libexpat.so |
arp, vmstat, or netstat | libxo.so |
USB network drivers | libusbdci.so |
PCI network drivers | libpci.so and PCI libraries (see example below) |
FDT network drivers | libfdt.so |
CPSW network drivers | libti-pdk.so,
libti-sciclient.so,
libti-udmalld.so,
libtiudma-usr.so These libraries are not included with QNX SDP 8.0. For instructions on how to obtain them, see the user guide for your BSP. |
For example, if your target has PCI and USB interfaces:
################################################################################################
## Network driver files
################################################################################################
/lib/dll/devs-ffec.so=devs-ffec.so
/lib/dll/devs-em.so=devs-em.so
/lib/dll/devs-ix.so=devs-igc.so
/lib/dll/devs-ix.so=devs-ix.so
/lib/dll/devs-re.so=devs-re.so
/lib/dll/devs-axe.so=devs-axe.so
/lib/dll/devs-axge.so=devs-axge.so
/lib/dll/devs-cdce.so=devs-cdce.so
/lib/dll/devs-smsc.so=devs-smsc.so
################################################################################################
## Network module shared libraries
################################################################################################
/lib/dll/mods-fdt.so=mods-fdt.so
/lib/dll/mods-pci.so=mods-pci.so
/lib/dll/mods-usb.so=mods-usb.so
/lib/dll/mods-phy.so=mods-phy.so
/lib/dll/mods-phy_fdt.so=mods-phy_fdt.so
################################################################################################
## USB device shared libraries
################################################################################################
/lib/libusbdci.so=libusbdci.so
################################################################################################
## PCI driver HW Modules and configuration file
################################################################################################
/lib/dll/pci/pci_hw-nxp-imx8-cpu.so=pci/pci_hw-nxp-imx8-cpu.so
[uid=0 gid=0 perms=0444] /etc/system/config/pci/pci_hw-imx8-cpu.conf = {
###################################### S E C T I O N #########################################
##
[NXP_IMX8]
##
## imx PCIe HW module configuration
## ----------------------------------------------------------------------------------------------
##
## Specify PCIe lanes number per PCIe controller (<PCIeA>:<PCIeB>),
## value 0 disables PCIe controller (applicable for PCIeB controller only)
## Possible lane configuration:
## 2:1 - PCIeA dual lanes, PCIeB single lane.
## 2:0 - PCIeA dual lanes, one single lane SATA.
## 1:1 - PCIeA and PCIeB single lane, one single lane SATA.
## 1:0 - PCIeA single lane, one single lane SATA.
## 0:1 - PCIeB single lane, one single lane SATA.
NUMBER_LANES=1:1
## Enable/disable PCIe 100MHz reference clock generation from MCU (available values: yes or no)
INTERNAL_REF_CLOCK=no
## EP link status check period, fix of RC BARs registers which are reset during EP power cycle.
## (value in ms, 0 = disable EP link status check, default value is 200).
#LINK_STATUS_CHECK_PERIOD=200
## PCIe max. generation speed a colon (:) separated per PCIe controller (PCIeA:PCIeB:...).
#MAX_GEN_SPEED=3:3
## PCIe PERST PAD configuration.
## Expected format: PCI_PERST_PAD_CONFIGURATION = A,B,C:D,E,F etc.
## where:
## A = PCI0 GPIO base address in HEX,
## B = PCI0 PAD index (0..31),
## C = PCI0 active_level (0, 1)
## :
## D = PCI1 GPIO base address in HEX,
## E = PCI1 PAD index (0..31),
## F = PCI1 active_level (0, 1)
#PERST_PAD_CONFIGURATION=0x5F170000,5,0:0x5F170000,3,0
## PCIe PERST active time in milisecond a colon (:) separated per PCIe controller. Default value is 200 ms.
## Expected format: <PCIe0 PERST_active_time_in_ms>:<PCIe1 PERST_active_time_in_ms>:... e.g. 200:200:...
#PERST_PAD_ACTIVE_TIME=200:200
}
################################################################################################
## PCIe driver shared libraries
################################################################################################
/lib/libpci.so=libpci.so
/lib/dll/pci/pci_bkwd_compat.so=pci/pci_bkwd_compat.so
/lib/dll/pci/pci_cap-0x01.so=pci/pci_cap-0x01.so
/lib/dll/pci/pci_cap-0x04.so=pci/pci_cap-0x04.so
/lib/dll/pci/pci_cap-0x05.so=pci/pci_cap-0x05.so
/lib/dll/pci/pci_cap-0x07.so=pci/pci_cap-0x07.so
/lib/dll/pci/pci_cap-0x09-ffffffff.so=pci/pci_cap-0x09-ffffffff.so
/lib/dll/pci/pci_cap-0x0d.so=pci/pci_cap-0x0d.so
/lib/dll/pci/pci_cap-0x10-16c3abcd.so=pci/pci_cap-0x10-16c3abcd.so
/lib/dll/pci/pci_cap-0x10-19570400.so=pci/pci_cap-0x10-19570400.so
/lib/dll/pci/pci_cap-0x10.so=pci/pci_cap-0x10.so
/lib/dll/pci/pci_cap-0x11-ffffffff.so=pci/pci_cap-0x11-ffffffff.so
/lib/dll/pci/pci_cap-0x11.so=pci/pci_cap-0x11.so
/lib/dll/pci/pci_cap-0x12.so=pci/pci_cap-0x12.so
/lib/dll/pci/pci_cap-0x13.so=pci/pci_cap-0x13.so
/lib/dll/pci/pci_debug.so=pci/pci_debug.so
/lib/dll/pci/pci_debug2.so=pci/pci_debug2.so
/lib/dll/pci/pci_server-buscfg-generic.so=pci/pci_server-buscfg-generic.so
/lib/dll/pci/pci_server-buscfg-hotplug.so=pci/pci_server-buscfg-hotplug.so
/lib/dll/pci/pci_server-buscfg2-generic.so=pci/pci_server-buscfg2-generic.so
/lib/dll/pci/pci_server-buscfg2-hotplug.so=pci/pci_server-buscfg2-hotplug.so
/lib/dll/pci/pci_server-enable_features.so=pci/pci_server-enable_features.so
/lib/dll/pci/pci_server-event_handler.so=pci/pci_server-event_handler.so
/lib/dll/pci/pci_server-namespace.so=pci/pci_server-namespace.so
/lib/dll/pci/pci_slog.so=pci/pci_slog.so
/lib/dll/pci/pci_slog2.so=pci/pci_slog2.so
/lib/dll/pci/pci_strings.so=pci/pci_strings.so
/lib/dll/pci/pcie_xcap-0x0001.so=pci/pcie_xcap-0x0001.so
/lib/dll/pci/pcie_xcap-0x0003.so=pci/pcie_xcap-0x0003.so
/lib/dll/pci/pcie_xcap-0x000b-ffffffff.so=pci/pcie_xcap-0x000b-ffffffff.so
/lib/dll/pci/pcie_xcap-0x0015.so=pci/pcie_xcap-0x0015.so
Default interface names
In some cases, io-sock uses different default device or interface names than io-pkt.
io-pkt | io-sock | ||
---|---|---|---|
Driver | Default device/interface name | Driver name | Default device/interface name |
devnp-asix.so (100 Mb/s) | ax0 | devs-axe.so | axe0 |
devnp-asix.so (1 Gb/s) | ax0 | devs-axge.so | axge0 |
devnp-dwceqos.so | dwc0 | devs-dwceqos.so | dwceqos0 |
devnp-dwcmac.so | dwc0 | devs-dwc.so | dwc0 |
devnp-e1000.so | wm0 | devs-em.so | em0 or igb0 |
devnp-genet.so | genet0 | devs-genet.so | genet0 |
devnp-ixgbe.so | ix0 | devs-ix.so | ix0 |
devnp-rtl8169.so | rt0 | devs-re.so | re0 |
devnp-mx8xp.so | mx8xp0 | devs-ffec.so | ffec0 |
devnp-smsc9500.so | sc0 | devs-smsc.so | smsc0 |
devnp-usbdnet.so (device mode) | ecm0, ncm0 | devs-cdce.so | cdce0 |
rndis0 | Currently not supported | N/A | |
devnp-usbnet.so (host mode) | ecm0, ncm0 | devs-cdce.so | cdce0 |
rndis0 | devs-urndis.so | urndis0 | |
mbim0, iph0 | Currently not supported | N/A | |
devnp-virtio.so | vt0 | devs-vtnet_pci.so | vtnet0 |
devs-vtnet_mmio.so | vtnet0 | ||
devnp-vmxnet3.so | vx0 | devs-vmx.so | vmx0 |
Starting io-sock and bringing up the interfaces
Start io-sock with all networking interfaces. For example, if your target has PCI and USB interfaces and supports FDT:
io-sock -m fdt -m phy -m phy_fdt -d ffec -m pci -d em -d igc -d ix -d re -m usb -d axe \
-d axge -d cdce -d smsc
Start dhcpcd to detect all active interfaces, and to monitor dynamic interfaces for address changes and static interfaces for carrier changes. For example:
dhcpcd -bqq
For simple static network configurations, you can use if_up to wait for an interface to be ready for configuration. For example:
io-sock -d em
if_up -p em0
ifconfig em0 192.0.2.1/24
Although waitfor is often used for synchronization tasks, it is not reliable to use it on networking resources such as /dev/socket or /dev/io-sock/devs-em.so/em0 to determine if the interface is ready.
Use dhcpcd.conf to assign a static address to the interface. For example:
interface em0
static ip_address=192.0.2.1/24