TCP/IP Architecture

In this topic:

Overview

The wRTOS TCP/IP Stack implements the Network and Transport layers of the OSI model as shown below:

The TCP/IP Stack runs in an RTSS process that relies on the Network Link Layer (NL2) to send and receive Ethernet packets on the network.

You can configure the TCP/IP Stack in wRTOS Settings.

The TCP/IP Stack process runs the following threads:

Notes

Exported APIs

The TCP/IP Stack exports three API sets to TCP/IP-Enabled RTSS Processes:

In addition to the APIs exported by the TCP/IP Stack, RTSS Processes that link with RttcpipApi.rtdll, whether they link with the Stack itself or not, get a different set of APIs to control the TCP/IP Stack (start, stop, get running status and get licensing status).

Network Link Layer (NL2) Communication

The TCP/IP Stack uses the NL2’s shared queue method to send and receive packets. It does not take exclusive control of any hardware queue. This allows other NL2 applications to send and receive through the same queues as the TCP/IP Stack. This is especially useful when the network interface has only one transmit and one receive queue. By default, the Stack uses the first Transmit Queue and the first Receive Queue of each interface.

Buffer Management System and Memory Requirement

The TCP/IP Stack has an internal buffer system that statically allocates a fixed memory block during Stack startup for performance reasons. This memory block, specified by the Memory allocated for the TCP/IP Stack heap setting configured in wRTOS Settings, stores the Stack’s internal information, such as packet buffers and various control information. The Stack’s packet buffers operate independently of NL2 buffers. During send and receive operations, they copy data from/to the Stack buffers to/from the NL2 buffers.

The Stack’s memory requirements vary based on the amount of memory available on the system and the expected level of network traffic. Key factors influencing this requirement include:

Most of the memory pre-allocated by the Stack is used for application data. Internally, the TCP/IP Stack uses minimal data.

If you are unsure how much memory should be allocated for the Stack, use a large value, such as 10,000. Fatal errors can occur when not enough memory is allocated to the TCP/IP Stack. The TCP/IP Stack will return WSAENOBUFS to an application when memory reserves have been exhausted. This indicates that they should increase this value.

Virtual Network

The wRTOS Virtual Network is a virtual point-to-point connection between Windows and wRTOS. The network interface to this virtual network on the Windows side is called the Windows Virtual wRTOS Ethernet Adapter. The network interface to this virtual network on the wRTOS side is referred to as the wRTOS Virtual Network Interface (NIC). The Stack can take advantage of the virtual network to provide socket-based communication between a Windows application and a wRTOS application.

The wRTOS Virtual NIC is provided by default if you install the Virtual Network feature. It sets up a default IP address and is associated with the RtndVnic.rtdll NL2 driver. The wRTOS Virtual NIC driver represents the RTSS component of the point-to-point Virtual Network connection.

The Windows Virtual wRTOS Ethernet Adapter is associated with the NL2 plug-and-play NDIS driver (wRTOSNL2PnpNet.sys) loaded by the Windows Stack.

Related topics:

Ethernet Filter Driver

Each TCP/IP-enabled interface can be associated with an Ethernet Filter Driver. A filter driver intercepts all incoming and outgoing frames and can modify them on the fly. It can also generate new network traffic.

Loopback

The Loopback interface provides a socket-based communication feature between two wRTOS applications. The TCP/IP Stack entirely manages the Loopback interface; the traffic sent and received remains inside the Stack, it doesn’t go through the NL2. This must not be confused with the Virtual NIC, which connects a wRTOS application with a Windows application and utilizes the NL2. For more information on this feature, see the Multicast sample.

See Also: