Merge pull request #21 from yajunxiaMS/yajunxia/tsn

Yajunxia/tsn
This commit is contained in:
Stefan Wick
2024-03-27 21:17:50 -07:00
committed by GitHub
5 changed files with 1588 additions and 2 deletions

View File

@@ -1454,3 +1454,109 @@ A driver function is needed for each IP interface. Refer to [Chapter 5](chapter5
- Only TCP and UDP sockets are supported
- DHCP is usually done by underlayer TCP/IP stack not NetX Duo
- Other limitations from underlayer TCP/IP stack
## TSN Components
Time-Sensitive Networking (TSN) is a suite of standards crafted by the IEEE 802.1 working group aimed at augmenting the capabilities of Ethernet networks. These standards define mechanisms for transmitting time-sensitive data over deterministic Ethernet networks.
In this section, the TSN compents in below frame work in colour blue are described.
![Diagram of TSN Framework](./media/user-guide/tsn-framework.png)
**FIGURE 15. TSN Framework**
### Link layer
In NetxDuo, the Link Layer component offers a range of essential functionalities, These include:
VLAN Interface Creation: NetxDuo allows for the seamless creation of Virtual Local Area Network (VLAN) interfaces, enabling the segmentation of network traffic into distinct logical networks.
VLAN ID Modification: It provides the capability to modify VLAN IDs on specific VLAN interface, facilitating the customization and management of VLAN configurations to suit specific network requirements.
Raw Packet Transmission: NetxDuo provides a Raw Packet transmission interface for direct transmission of network packets at the Link Layer. This is particularly useful for specialized network communication needs, such as the direct sending of packets by MRP and ptp components using raw packet transmission.
Packet Distribution for Received Packets: The Link Layer in NetxDuo efficiently handles the reception of network packets, distributing them appropriately based on packet types. This includes the distribution of VLAN-tagged packets to the corresponding VLAN interfaces and the distribution of untagged packets to the default interface.
Above functionalities are used by TSN components to implement TSN features.
### Credit-based shaper (CBS) - IEEE 802.1Qav Forwarding and Queuing Enhancements for Time-Sensitive Stream
Credit-based shaper (CBS) is a traffic shaping mechanism that is in audio video bridge(AVB) network, to ensure/control the bandwidth of specific audio and video traffic streams. this mechanism can ensure that the data is transmitted at a constant rate and to avoid congestion in the network.
In CBS module of NetxDuo, following functionalities are provided:
- CBS shaper creation and deletion.
- The Mapping configuration of PCP on VLAN tag to related hardware queue.
- CBS parameters Setting, such as idle slope, send slope, and CBS credit limit.
By utilizing these functionalities, we can assign different SR class traffic to specific hardware queues and control the bandwidth of the traffic by setting the CBS parameters on related hardware queues.
### Time-Aware Shaper (TAS) - IEEE 802.1Qbv Enhancements to Traffic Scheduling
TAS (Time-Aware Scheduler) in TSN (Time-Sensitive Networking) is designed to ensures deterministic and prioritized communication by controlling the bandwidth allocation for high-priority streams through gate control and regulating cycles.
The IEEE 802.1Qbv time-aware scheduler orchestrates Ethernet network communication by dividing it into fixed-length, repeating time cycles. Within these cycles, customizable time slices are allocated to one or multiple of the eight Ethernet priorities. This approach enables exclusive utilization of the Ethernet transmission medium for time-sensitive traffic classes, ensuring uninterrupted transmission guarantees when needed. Operating on a time-division multiple access (TDMA) scheme, the scheduler establishes virtual communication channels for specific time periods, effectively segregating time-critical communication from non-critical background traffic.
In TAS module of NetxDuo, following functionalities are provided:
- TAS shaper creation and deletion. (Shared with CBS and FPE)
- The Mapping configuration of PCP on VLAN tag to related hardware queue.(Shared with CBS)
- TAS parameters setting. Include base time, cycle time, time slot and associated gate control settings.
By leveraging these functionalities, high-priority traffic can be directed to specific hardware queues with allocated time slots, enabling precise bandwidth control. Furthermore, through synchronized TAS settings across the entire TSN infrastructure and time synchronization facilitated by gPTP (generalized Precision Time Protocol), we can effectively manage end-to-end latency for traffic, ensuring timely and reliable communication.
### Frame preemption (FPE) - 802.1Qbu
Frame Preemption (FPE) is a TSN feature that allows high-priority frames to interrupt the transmission of lower-priority frames. This feature is particularly useful in time-sensitive applications, where the timely delivery of high-priority frames is critical. By preempting the transmission of lower-priority frames, high-priority frames can be transmitted without delay, ensuring that they are delivered within the required time frame.
In FPE module of NetxDuo, following functionalities are provided:
- FPE shaper creation and deletion. (Shared with CBS and TAS)
- FPE parameters setting. such as enable/disable the FPE verification, express queue bitmap setting, ha/ra time setting, express queue guard band enable/disable.
FPE (Frame Preemption Engine) is typically utilized in conjunction with TAS (Time-Aware Scheduler). By fragmenting preemptable frames, the guard band required for preemptable frame slots is reduced, thus increasing bandwidth utilization efficiency.
### Time synchronization(gPTP)
The gPTP (Generalized Precision Time Protocol), as described in the IEEE 1588 Precision Time Protocol standard, is utilized within Time-Sensitive Networks (TSN) to synchronize time across network devices.
In gPTP module of NetxDuo, following functionalities are provided:
- Creation and deletion of PTP client.
- Starting and stopping the PTP client.
- Retrieving and setting the PTP clock in the client.
- Acquiring master clock information and sync message details through the PTP client.
- Transmission of timestamp notifications for PTP packets.
- Implementation of a software-based PTP clock.
- Utility of computing the difference between two PTP times.
- Utility of converting a PTP time to a UTC date and time.
### Stream Registration Protocol (SRP)
SRP (Stream Reservation Protocol) is a protocol used in Time-Sensitive Networking (TSN). It allows devices to reserve resources for specific streams of data across the network. This ensures that these streams have the necessary bandwidth and can meet their time sensitivity requirements.
In SRP module of NetxDuo, following functionalities are provided:
- Initializaiton of SRP service.
- Starting and stopping the SRP talker service.
- Starting and stopping the SRP listener service.
### Multiple Stream Reservation Protocol (MSRP)
MSRP (Multiple Stream Reservation Protocol) in Time-Sensitive Networking (TSN) is an extension of the Stream Reservation Protocol (SRP). By allowing multiple stream reservations, MSRP enhances the deterministic data delivery capabilities of TSN, ensuring that data can be delivered with a guaranteed level of performance across multiple streams.
In MSRP module of NetxDuo, following functionalities are provided:
- Initialization of an MSRP instance.
- Parsing and packing of MRP Data Units (MRPDUs).
- Management of the registration and deregistration processes for a stream.
- Management of the registration and deregistration processes for an attachment to a stream.
- Handling of indications for a stream's registration and deregistration events.
- Handling of indications for an attachment's registration and deregistration events.
- Management of the registration and deregistration processes for a domain, as well as handling the indications of these events.
### Multiple vlan registration protocol (MVRP)
The Multiple VLAN Registration Protocol (MVRP) is a protocol that provides dynamic VLAN registration service. It is an MRP (Multiple Registration Protocol) application that makes use of MRP Attribute Declaration (MAD) and MRP Attribute Propagation (MAP) to provide common state machine descriptions and attribute propagation mechanisms.
MVRP provides a mechanism for dynamic maintenance of the contents of Dynamic VLAN Registration Entries for each VLAN and propagates the information they contain to other Bridges. This information allows MVRP-aware devices to dynamically establish and update their knowledge of the set of VLANs that currently have active members, and through which Ports those members can be reached.
In MVRP module of NetxDuo, following functionalities are provided to SRP/MRP components:
- Initialization of an MVRP instance.
- Parsing and packing of MRP Data Units (MRPDUs).
- Process the join or leave a VLAN request command from SRP, and trigger the corresponding VLAN registration or deregistration process.
- Handling of indications for a stream's registration and deregistration events from MRP.
### Multiple registration protocol (MRP)
The Multiple Registration Protocol (MRP) is a protocol that provides dynamic registration and deregistration of attributes in a network. It is used to manage resources in a network, such as VLANs, multicast addresses, and streams. MRP operates uses a common state machine and attribute propagation mechanisms to provide a consistent view of the network resources. MRP is used by other protocols, such as MVRP (Multiple VLAN Registration Protocol) and MSRP (Multiple Stream Registration Protocol), to provide dynamic registration of VLANs and streams, respectively.
In MRP module of NetxDuo, following functionalities are provided to MRP applications:
- Provide the interface of MRP initialization.
- Maintaining state machine for MRP applications.
- Process the event triggered by receiving different MRP messages.
- Receiveing the message from ethernet, and destribute the MRP messages to the corresponding MRP applications.
- Handle the timer event for MRP applications.

File diff suppressed because it is too large Load Diff

View File

@@ -531,3 +531,131 @@ The following driver commands are required for network interfaces with TCP/IP se
* Cleanup resources created during bind.
* For operation `NX_TCPIP_OFFLOAD_UDP_SOCKET_SEND`,
* Send data through TCP/IP offload. Be prepare to handle packet length larger than MTU or packet chain situation.
## TSN driver support
TSN shapers are a series of hardware features that can be added to an Ethernet card equipped with TSN capabilities. We will discuss implementation of the PTP driver and the three types of shapers: CBS (Credit-Based Shaper), EST (Enhanced Scheduled Traffic), and FPE (Frame Preemption).
### PTP initialize and callback function
PTP is utilized in various scenarios within the TSN system, particularly when the TAS shaper is enabled. Given the high requirements for the PTP clock, it is recommended to initialize PTP in Fine mode. Additionally, it is necessary to implement the PTP driver callbacks, which are invoked to get, set, and adjust the PTP clock.
the driver interface which is used to sychnorize ptp clock in the network.
```C
UINT nx_driver_ptp_clock_callback(NX_PTP_CLIENT *client_ptr, UINT operation,
NX_PTP_TIME *time_ptr, NX_PACKET *packet_ptr,
VOID *callback_data)
```
| operation | Description |
| ------------------------------------------- | -----------------------------------------------------------------|
| ***NX_PTP_CLIENT_CLOCK_INIT*** | A driver PTP pointer is initialized, |
| ***NX_PTP_CLIENT_CLOCK_SET*** | Set PTP clock when syncorize PTP in the network |
| ***NX_PTP_CLIENT_CLOCK_PACKET_TS_EXTRACT*** | Get timestamp from packet, |
| ***NX_PTP_CLIENT_CLOCK_GET*** | Get timestamp from PTP clock, |
| ***NX_PTP_CLIENT_CLOCK_ADJUST*** | Adjust PTP clock by PTP offset when syncorize PTP in the network,|
| ***NX_PTP_CLIENT_CLOCK_PACKET_TS_PREPARE*** | Add NX_INTERFACE_CAPABILITY_PTP_TIMESTAMP support in interface, |
| ***NX_PTP_CLIENT_CLOCK_SOFT_TIMER_UPDATE*** | update soft timer, Reserved for hardware driver, |
### Credit-based shaper (CBS) - IEEE 802.1Qav Forwarding and Queuing Enhancements for Time-Sensitive Stream
In general, a CBS works by assigning "credits" to each data packet. The number of credits a packet has determines when it can be transmitted. Packets with more credits are transmitted before packets with fewer credits. This allows the CBS to prioritize certain data streams over others, ensuring that high-priority data is transmitted first.
The CBS driver needs to be implemented to support the CBS feature. The driver entry will be invoked from the application, passing application data to configure the CBS driver.
the driver entry:
```C
UINT nx_driver_shaper_cbs_entry(NX_SHAPER_DRIVER_PARAMETER *parameter)
```
Data structure of driver entry paramter:
```C
typedef struct NX_SHAPER_DRIVER_PARAMETER_STRUCT
{
UINT nx_shaper_driver_command;
UCHAR shaper_type;
UCHAR reserved[3];
void *shaper_parameter;
NX_INTERFACE *nx_ip_driver_interface;
} NX_SHAPER_DRIVER_PARAMETER;
```
Data stucture of CBS parameter which define the necessary parameters that CBS driver needs.
```C
typedef struct NX_SHAPER_CBS_PARAMETER_STRUCT
{
INT idle_slope; /* Mbps */
INT send_slope; /* Mbps */
INT hi_credit;
INT low_credit;
UCHAR hw_queue_id;
UCHAR reserved[3];
} NX_SHAPER_CBS_PARAMETER;
```
the driver entry parameter:
| parameter -> nx_shaper_driver_command | Description |
| ------------------------------------------- | -----------------------------------------------------------------|
| ***NX_SHAPER_COMMAND_INIT*** | initialization of enabling CBS, |
| ***NX_SHAPER_COMMAND_CONFIG*** | set hardware queue priority and capablity of CBS, |
| ***NX_SHAPER_COMMAND_PARAMETER_SET*** | set parameter passed from application to driver, |
### Time-Aware Shaper (TAS) - IEEE 802.1Qbv Enhancements to Traffic Scheduling
A Time-Aware Shaper (TAS) is a mechanism used in Time-Sensitive Networking (TSN) systems to control the transmission of Ethernet frames based on the time. It's part of the IEEE 802.1Qbv standard.
The TAS works by dividing time into repeating cycles, and each cycle is further divided into time intervals, or "gates". Each gate is either open or closed, and frames can only be transmitted when the gate is open.
The TAS driver needs to be implemented to support the TAS feature. The driver entry will be invoked from the application, passing application data to configure the TAS driver.
the driver entry:
```C
UINT nx_driver_shaper_tas_entry(NX_SHAPER_DRIVER_PARAMETER *parameter)
```
Data stucture of TAS parameter which define the necessary parameters that TAS driver needs.
```C
typedef struct NX_SHAPER_TAS_PARAMETER_STRUCT
{
ULONG64 base_time;
UINT cycle_time;
UINT cycle_time_extension;
UINT gcl_length;
NX_SHAPER_TAS_GCL gcl[NX_SHAPER_GCL_LENGTH_MAX];
void *fp_parameter; /* Configured by shaper */
} NX_SHAPER_TAS_PARAMETER;
```
the driver entry parameter:
| parameter -> nx_shaper_driver_command | Description |
| ------------------------------------------- | -----------------------------------------------------------------|
| ***NX_SHAPER_COMMAND_INIT*** | initialization of enabling TAS, |
| ***NX_SHAPER_COMMAND_CONFIG*** | set hardware queue priority and capablity of TAS, |
| ***NX_SHAPER_COMMAND_PARAMETER_SET*** | set parameter passed from application to driver, |
### Frame preemption (FPE) - 802.1Qbu
In traditional Ethernet networks, once a frame starts transmitting, it must be completely sent before another frame can begin. This can cause delays for time-sensitive data if it has to wait for a large, non-time-sensitive frame to finish transmitting.
Frame Preemption addresses this issue by allowing a high-priority, time-sensitive frame to interrupt the transmission of a low-priority frame. The low-priority frame is then resumed after the high-priority frame has been sent. This ensures that time-sensitive data can be transmitted with minimal delay, even in a busy network
The FPE driver needs to be implemented to support the FPE feature. The driver entry will be invoked from the application, passing application data to configure the FPE driver.
the driver entry:
```C
UINT nx_driver_shaper_fpe_entry(NX_SHAPER_DRIVER_PARAMETER *parameter)
```
Data stucture of TAS parameter which define the necessary parameters that TAS driver needs.
```C
typedef struct NX_SHAPER_FP_PARAMETER_STRUCT
{
UCHAR verification_enable; /* Enable/Disable fp verification (Application/Driver) */
UCHAR express_queue_bitmap; /* Bitmap of express queues */
UCHAR express_guardband_enable; /* Enable/Disable guard band on express queue */
UCHAR reserved;
UINT ha; /* Hold advance time */
UINT ra; /* Release advance time */
} NX_SHAPER_FP_PARAMETER;
```
the driver entry parameter:
| parameter -> nx_shaper_driver_command | Description |
| ------------------------------------------- | -----------------------------------------------------------------|
| ***NX_SHAPER_COMMAND_INIT*** | initialization of enabling FPE, |
| ***NX_SHAPER_COMMAND_CONFIG*** | set hardware queue priority and capablity of FPE, |
| ***NX_SHAPER_COMMAND_PARAMETER_SET*** | set parameter passed from application to driver, |

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -167,7 +167,7 @@ NetX Duo supports the following HTTP/HTTPS protocols.
- User Datagram Protocol (UDP)
- Minimal 2.5 KB FLASH, 124 sockets bytes of RAM per socket
- Fast, near wirespeed TCP packet processing:
- Fast, near wirespeed UDP packet processing:
- RX 95 Mbps on 100 Mbps Ethernet, MCU @100MHz, 14% MCU utilization
- TX 94 Mbps on 100 Mbps Ethernet, MCU @100MHz, 10% MCU utilization
- UDP Fast Path™ technology