Method and device for performing a switching function - Patents.com
The method organizes communication into temporal cycles with distinct time slices to reduce latency in software-based switching functions, addressing high latency issues in industrial networks by ensuring uninterrupted processing of critical data frames, thus meeting stringent latency requirements without hardware-based solutions.
Patent Information
- Application Number
- JP2023559194
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-03-31
- Filing Date
- 2021-10-01
- Publication Date
- 2024-08-26
- Estimated Expiration
- 2041-10-01
AI Technical Summary
Existing industrial networks face high latency issues in software-based switching functions due to the inability of microcontroller units (MCUs) to meet very low latency requirements, especially when implementing Time Sensitive Networking (TSN) protocols like IEEE 802.1Qbv, as hardware-based solutions are costly and not feasible for all equipment.
A method for software-based switching functions on MCUs, utilizing a processing circuit with an RTOS scheduler that organizes communication into temporal cycles with distinct time slices, disabling interrupts during critical time slices to ensure a single task handles switching, and employing cut-through or store-and-forward schemes to minimize latency.
This approach reduces switching latency by ensuring uninterrupted processing of critical data frames during high-priority time slices, thereby meeting stringent latency requirements without the need for costly hardware components.
Smart Images

Figure 0007539757000002 
Figure 0007539757000003 
Figure 0007539757000004
Abstract
Description
[Technical field]
[0001] The present disclosure relates to communication systems, and more particularly, to methods and apparatus for performing switching functions. [Background technology]
[0002] In a typical industrial network, communicating devices are usually connected by a bus using a daisy-chain topology. Typically, a master device (usually a programmable logic controller (PLC)) transmits a data frame to the other devices, and each device that receives the data frame forwards it to an adjacent device if it is not the intended recipient of the received data frame. Each device may also send a data frame back to the master device. In a daisy-chain topology, data frames generated by a device at the opposite end to the master device are forwarded by all intermediate devices up to the master device.
[0003] To support this daisy-chain topology, each device has at least three ports, including two physical ports and one internal port. The physical ports of the device are connected, for example, to the respective media access control (MAC) units for communicating with the upstream and downstream devices in the daisy-chain topology (assuming the master device is the source). The internal port is the interface with the host stack of the device, for processing data frames addressed to the device and for allowing the device to transmit its own generated data frames to other devices. Each device has a switching function that allows it to forward data frames received on any physical port to another physical port (if the device is not the destination of the data frame) or to an internal port (if the device is the destination of the data frame), and to forward data frames received on an internal port from the host stack to one or more physical ports.
[0004] For example, data frames exchanged between devices may be Ethernet data frames. In industrial networks, data frames need to be exchanged with strict latency requirements. Time-Sensitive Networking (TSN) is a set of standard technologies defined in IEEE 802.1 to provide deterministic messaging over standard Ethernet protocols. The key to providing on-time delivery of time-sensitive data frames is the IEEE 802.1Qbv standard. More specifically, the IEEE 802.1Qbv standard defines a time-aware scheduler designed to separate communications on an Ethernet communication channel into repeating time cycles of fixed duration. Within these time cycles, different time slices can be configured that can be assigned to traffic classes with different priorities. Such time slices can be considered as virtual communication channels, which allow time-critical traffic to be separated from non-critical background traffic.
[0005] FIG. 1 is a schematic representation of a time diagram showing such time cycles and time slices on which the IEEE 802.1Qbv standard relies. In the example shown in FIG. 1, two time cycles are represented, denoted as "time cycle #n" and "time cycle #n+1", respectively. Each time cycle has two time slices, denoted as "time slice #1" and "time slice #2", respectively. Also, a guard band is provided after time slice #2 of each time cycle and before the start of time slice #1 of the next time cycle. For example, time slice #1 may be reserved for data frames tagged with virtual local area network (VLAN) priority 7 (defined by the IEEE 802.1Q standard), and time slice #2 may be used for data frames tagged with VLAN priorities 0 to 6.
[0006] Therefore, the IEEE 802.1Qbv standard provides for time slices on the communication channel (ie, a set of buses between pairs of devices in a daisy chain topology) that are reserved for delivery of critical data frames.
[0007] However, to ensure that critical data frames are delivered very quickly from one end of a network with a daisy-chain topology to the other, each device needs to perform the TSN switching function very quickly. In networks with very low latency requirements, the TSN switching function is performed by a hardware component, typically an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA).
[0008] Although efficient, such hardware accelerated switching techniques are costly and are not used for all types of industrial network devices. In fact, in many industrial networks, devices run on microcontroller units (MCUs) connected to or incorporating Ethernet MAC units, in which case the switching function cannot use hardware accelerated switching techniques and must be performed by software. The use of a real-time operating system (RTOS) on the MCU can reduce latency to some extent for tasks with high priority, but is not sufficient to achieve very low latency. Summary of the Invention [Problem to be solved by the invention]
[0009] The present disclosure aims to improve this situation. In particular, the present disclosure aims to overcome at least some of the limitations of the prior art discussed above by proposing a technique for reducing the latency in performing software-based switching functions. In particular, the present disclosure aims to propose a technique executed by an MCU, for example connected to an Ethernet MAC unit or preferably incorporating such a unit. [Means for solving the problem]
[0010] To this end, according to a first aspect, the present disclosure provides a method for detecting a switching device by a processing circuit of the switching device. software A method of performing a switching function, the switching device further comprising a host stack and at least two media access controller (MAC) units for communicating data frames over a communication channel; a host stack including application software that executes on the switching device; At least two MAC units are connected to the processing circuit; software the switching function includes forwarding data frames received by one of the MAC units to another one of the MAC units and / or to the host stack, and optionally forwarding data frames received from the host stack to one of the MAC units; communication on the communication channel is organized according to successive time cycles, each time cycle including at least a first time slice and a second time slice, the first time slice for communicating data frames having a higher timing constraint than data frames communicated during the second time slice; the processing circuitry executes a real-time operating system (RTOS), the RTOS including an RTOS scheduler that schedules a plurality of tasks having different priorities in normal operation; and the method includes: applying, by the processing circuitry, a first mode of operation during each first time slice, wherein in the first mode of operation: The RTOS scheduler is paused. The normal operation of the RTOS is interrupted and the processing circuitry softwareperforming a single task of performing a switching function; applying, by the processing circuitry, a second mode of operation during each second time slice, in which normal operation of the RTOS is resumed and scheduled by a task not having the highest priority of the RTOS scheduler; software A switching function is performed; and The present invention relates to a method comprising the steps of:
[0011] The switching method therefore relies on the fact that communication on a communication channel is organised according to successive time cycles, each time cycle comprising at least a first time slice and a second time slice, the first time slice for communicating data frames having higher timing constraints than data frames communicated during the second time slice. This is typically the case, for example, when using the IEEE 802.1Qbv standard discussed above. In the following, data frames communicated during the first time slice are referred to as time-sensitive (TS) data frames and data frames communicated during the second time slice are referred to as non-TS (NTS) data frames.
[0012] The processing circuit executes an RTOS having in a conventional manner an RTOS scheduler that schedules a number of tasks according to their different priorities. Some of the tasks relate to switching functions while other tasks relate to, for example, host stack functions. The second time slice is used to communicate NTS data frames such that normal operation of the RTOS, and more particularly of its RTOS scheduler, is sufficient for the timing constraints of the NTS data frames.
[0013] However, during the first time slice used to communicate TS data frames, normal operation is suspended to execute a single task performing the switching function to prevent the switching function from being interrupted by other tasks, in particular, interrupts are disabled and no interrupt service routines (ISRs) are executed in the first operating mode during the first time slice.
[0014] Thanks to the organization of communications on the communication channel, the processing circuitry of the switching device knows when the first and second time slices are scheduled and can therefore transition from applying a first operating mode to applying a second operating mode, and vice versa, based on the start and end times of the first and second time slices.
[0015] Therefore, the latency of the switching function is reduced by ensuring that a TS data frame is performed by a single task that is not interrupted by other tasks, since that task is the only task operating during the first time slice used for the TS data frame.
[0016] In the second mode of operation, during the second time slice, the task performing the switching function does not have the highest priority, allowing the high priority tasks that were prevented from operating during the first time slice to take precedence over the task performing the switching function.
[0017] In particular embodiments, the method may further comprise one or more of the following features, considered alone or in any technically possible combination:
[0018] In particular embodiments, the processing circuitry is configured to detect receipt of a forwarded data frame by repeatedly polling a status register associated with a buffer used to store data frames received from a MAC unit or from a host stack.
[0019] As discussed above, in the first mode of operation, interrupts are typically disabled during the first time slice. Therefore, to ensure that receipt of a transferred data frame is detected quickly and associated processing code is executed quickly, the status register of the buffer in which such data frame is stored upon receipt is repeatedly, e.g., periodically, polled. The latency time for detecting a transferred data frame is reduced by reducing the polling period.
[0020] In certain embodiments, In a first mode of operation, the processing circuitry applies a cut-through technique in which forwarding of a data frame by a switching function is initiated before the entire data frame is received; In the second mode of operation, the processing circuitry applies a cut-through or store-and-forward scheme, in which the switching function starts forwarding a data frame only after the entire data frame has been received.
[0021] By using a cut-through scheme at least during the first operating mode, ie during the first time cycle during which TS data frames are transferred, it is possible to further reduce the latency of the switching function.
[0022] In a particular embodiment, in the cut-through manner, each data frame received by the MAC unit is broken into multiple fragments that are stored in respective buffers of the processing circuit, the buffers having the same size, which is equal to or less than 256 bytes or equal to or less than 128 bytes for the first operating mode.
[0023] In a particular embodiment, in a cut-through manner, each data frame is broken into a number of fragments that are stored in respective buffers of the processing circuit, the buffer used for the first operating mode having a smaller size than the buffer used for the second operating mode.
[0024] In particular embodiments, the buffer used for the second mode of operation has a size of 512 bytes or greater, or 1024 bytes or greater.
[0025] In a particular embodiment, a data frame received by one of the MAC units is copied to a buffer of the processing circuit, from which the data frame is accessed by the host stack and / or by another one of the MAC units.
[0026] It is therefore not necessary to copy data frames from one buffer to another of the processing circuit, which makes it possible to reduce the amount of memory required and to avoid the latency introduced by such copying between buffers, at least if the data frames are not to be modified.
[0027] In certain embodiments, different buffers store each fragment of a data frame, and when a target fragment of a data frame is modified by deleting or inserting data, the target fragment is modified and copied into another buffer, and the other fragments are not copied into the other buffer.
[0028] Therefore, for example, if additional data (e.g. a VLAN identifier) is inserted into a data frame to be forwarded, only the target fragment of the data frame, i.e. the fragment into which the additional data is to be inserted, is copied from one buffer to another buffer, thereby limiting the latency introduced by such copying between buffers.
[0029] In a particular embodiment, when a TS data frame is generated by the host stack during the second time slice, the single task executed during the first mode of operation is configured to forward the TS data frame to one of the MAC units at the start of the next first time slice.
[0030] In certain embodiments, the tasks of the second operating mode include a processing task having a higher priority than a task performing a switching function, the processing task being used to generate a TS data frame for the host stack to be transmitted during a next first time slice and / or to extract data from a TS data frame forwarded to the host stack during a previous first time slice.
[0031] In a particular embodiment, the RTOS scheduler is configured to execute the processing task at the beginning of each second time slice within the predetermined maximum duration.
[0032] According to a second aspect, the present disclosure relates to a computer program product comprising instructions that, when executed by a processing circuit, configure the processing circuit to perform a method according to any one of the embodiments of the present disclosure.
[0033] According to a third aspect, the present disclosure relates to a computer-readable storage medium comprising instructions that, when executed by a processing circuit, configure the processing circuit to perform a method according to any one of the embodiments of the present disclosure.
[0034] According to a fourth aspect, the present disclosure relates to a switching device including at least two Medium Access Controller (MAC) units, the at least two MAC units being connected to a processing circuit, the processing circuit being configured to perform a method according to any one of the embodiments of the present disclosure.
[0035] In particular embodiments, the switching device may further comprise one or more of the following features, considered alone or in any technically possible combination:
[0036] In certain embodiments, at least two of the MAC units are Ethernet MAC units. In some cases, the Ethernet MAC units are compliant with the IEEE 802.1Qbv standard.
[0037] According to a fifth aspect, the present disclosure relates to a local area network (LAN) including a plurality of switching devices according to any one of the embodiments of the present disclosure, at least some of the switching devices being connected together according to a daisy chain topology.
[0038] The invention will be better understood on reading the following description, which is given by way of example and in no way limiting, and is made with reference to the figures. [Brief description of the drawings]
[0039] [Figure 1] FIG. 1 is a diagram illustrating an example of a time cycle and time slices according to the IEEE 802.1Qbv standard, as already described. [Diagram 2] 1 is a schematic representation of a switching device. [Diagram 3] FIG. 2 illustrates the main steps of an exemplary embodiment of a switching method. [Figure 4] FIG. 2 is a time diagram illustrating an example of switching of data frames when using the switching method; [Diagram 5] 4 is a schematic representation of a software architecture for performing a switching function according to a first example. [Figure 6] 11 is a schematic representation of a software architecture for performing a switching function according to a second example. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0040] In the figures, like reference numbers indicate like or similar elements. Elements shown are for clarity purposes and are not drawn to scale unless otherwise specified.
[0041] Figure 2 illustrates a schematic diagram of an example of a switching device 20. As shown in Figure 2, the switching device 20 includes a processing circuit 21 connected to two MAC units 22.
[0042] Each MAC unit 22 is adapted to transmit and receive data frames on a communication channel according to at least one wired communication protocol. More specifically, the MAC units 22 are connected to respective communication links, e.g., different buses, which are collectively referred to as a communication channel. The MAC units 22 are separated from each other, such that forwarding of data frames from one MAC unit 22 to another is necessarily performed via the processing circuitry 21.
[0043] As discussed above, the MAC unit 22 may apply any wired communication protocol. In a preferred embodiment, the MAC unit 22 is an Ethernet MAC unit conforming to an IEEE standard, such as the 10BASE-T / 100BASE-TX IEEE 802.3 standard. The Ethernet MAC unit 22 may support the IEEE 802.1Q standard for VLAN tag detection and / or the IEEE 1588-2008 standard for precision network clock synchronization or gigabit speeds. In a preferred embodiment, the Ethernet MAC unit 22 may support IEEE TSN extensions, such as the IEEE 802.1Qbv standard.
[0044] The processing circuit 21 performs the switching function represented by the switch 23 in Fig. 2. The processing circuit 21 includes one or more processors and storage means (magnetic hard disk, solid state disk, optical disk, electronic memory, etc.) on which a computer program product (i.e. software) in the form of a set of program code instructions that are executed to operate the switch 23 is stored. For example, the processing circuit 21 may be integrated in a microprocessor unit (MPU) or in a microcontroller unit (MCU). It should be noted that in such a case, the MAC unit 22 may be separate from the MPU or MCU, but is preferably integrated in the MPU or MCU in order to reduce the latency for exchanging data frames between the MAC unit and the MPU or MCU.
[0045] Switching device 20 also includes a host stack 24. This host stack corresponds to higher level software executed by switching device 20 and may include any protocol layers (e.g., IP, TCP, UDP, etc.), any software related to any application executed by switching device 20, etc. It should be noted that host stack 24 may be executed by processing circuitry 21 (and thus performing both the switching functions and the functions performed by host stack 24) and / or by an application processor or the like coupled to processing circuitry 21.
[0046] In the following, it is assumed, in a non-limiting manner, that the host stack 24 is at least partially executed by the processing circuitry 21, as illustrated by FIG.
[0047] 2, the switch 23 has three different ports, namely two physical ports 25 for each MAC unit 22 and one host port 26 for the host stack 24. The switching function therefore aims to forward a data frame received from any one of these three ports to one or more other of these three ports. It should be noted that the present disclosure applies with any number N≧2 physical ports and any number M≧1 host ports associated with N MAC units 22 and M host stacks 24.
[0048] The processing circuitry 21 executes a real-time operating system (RTOS). An RTOS is an operating system intended to perform real-time processing of data as it is received. Examples of RTOS are FreeRTOS™, RTEMS™, among others. A characteristic of an RTOS is the level of consistency in scheduling and completing tasks. As used herein, a task may be an operation of the operating system that is invoked by an application running on the RTOS, or by an interrupt service routine (ISR), etc.
[0049] A soft RTOS is an operating system in which missing deadlines is tolerated but can have undesirable effects, such as leading to performance degradation. In other words, a soft RTOS meets deadlines on average. For example, the Linux™ OS kernel is classified as belonging to this category because it performs FIFO (first-in-first-out) or round-robin process scheduling.
[0050] In a farm RTOS, rare missed deadlines are tolerated as long as they are spaced appropriately. A farm RTOS is, for example, a soft RTOS that has been improved to be closer to a hard RTOS. In most cases, there are no strict deadlines guaranteed by a farm RTOS. The Linux kernel with the PREEMPT_RT patch, or Xenomai, fall into this category.
[0051] A hard RTOS is an operating system where missing deadlines has critical consequences. RTOSes such as FreeRTOS or RTEMS fall into this category. In some cases, they offer a relatively small number of services, unlike an OS such as Linux, which in some cases relate to task / process scheduling and interrupts.
[0052] In this disclosure, the RTOS may be a soft RTOS, a firm RTOS, or a hard RTOS, however, the RTOS is preferably a hard RTOS because it provides reduced latency and jitter.
[0053] In a conventional implementation, an RTOS includes an RTOS scheduler that schedules tasks according to their respective priorities.
[0054] The communication on the communication channel is organized according to successive time cycles, each time cycle including at least a first time slice and a second time slice. It should be noted that the time cycle may also include additional time slices. The first time slice is used to communicate TS data frames, while the second time slice is used to communicate NTS data frames. For example, this is achieved by using the IEEE 802.1Qbv standard. In such a case, the IEEE 802.1Qbv standard may be implemented by the MAC unit 22 and / or by the processing circuit 21, for example if the MAC unit 22 does not support the IEEE 802.1Qbv standard.
[0055] FIG. 3 illustrates diagrammatically the main steps of a switching method 30 according to an exemplary embodiment, performed by the processing circuitry 21 of the switching device 20 .
[0056] As shown by Fig. 3, the switching method 30 includes a step S30 of detecting a time slice. If the detected time slice is a first time slice (reference sign S30a in Fig. 3), the switching method 30 includes a step S31 of applying, by the processing circuit 21, a first operation mode for an a priori known duration of the first time slice. On the other hand, if the detected time slice is a second time slice (reference sign S30b in Fig. 3), the switching method 30 includes a step S32 of applying, by the processing circuit 21, a second operation mode for an a priori known duration of the second time slice.
[0057] In the following, the first operation mode and the first time slice are referred to as TS (time sensitive) operation mode and TS time slice, respectively. The second operation mode and the second time slice are referred to as NTS (non-TS) operation mode and NTS time slice, respectively. It should be noted that although FIG. 3 assumes that there are only two different operation modes (respective time slices), the present disclosure may be applied with more than two different operation modes (respective time slices).
[0058] In the TS mode of operation, normal operation of the RTOS is suspended in that the RTOS scheduler is suspended. Processing circuitry 21 executes a single task performing the switching function for the entire duration of the TS time slice. In fact, interrupts may be disabled so that the single task performing the switching is not interrupted or preempted by other tasks. At the end of the TS time slice, the single task may detect that an NTS time slice is about to begin and may trigger the RTOS scheduler.
[0059] In the NTS mode of operation, normal operation of the RTOS is resumed and the RTOS scheduler schedules the tasks according to their respective priorities for the entire duration of the NTS time slice. One of the tasks scheduled by the RTOS scheduler performs a switching function, which does not have the highest priority to ensure that other tasks are executed during the NTS time slice. For example, a higher priority task performing a critical host stack 24 function may be prioritized over a task performing a switching function, which in turn may be prioritized over a lower priority task performing a non-critical host stack 24 function. For example, the tasks in the NTS mode of operation may include a processing task having a higher priority than a task performing a switching function, which is used to generate a TS data frame for the host stack 24 to be transmitted during the next TS time slice and / or to extract data from a TS data frame transferred to the host stack 24 during the first time slice that is a TS.
[0060] When interrupts are disabled in the TS operating mode, detection of receipt of a forwarded TS data frame may be performed by the processing circuit 21 by repeatedly polling a status register associated with a buffer used to store TS data frames received from the MAC unit 22 or from the host stack 24.
[0061] In practice, data frames received by the MAC unit 22 are copied, for example by a direct memory access (DMA) controller, to a buffer, i.e., to a memory space of the processing circuit 21. Once all or part of a received data frame has been copied to a buffer, the DMA controller updates a status register to indicate that the corresponding buffer has stored data for the data frame. The status register may correspond to a queue associated with the MAC unit 22, which may be implemented as a ring buffer descriptor that includes pointers to buffers that store data for the data frame. Thus, polling the status register corresponds, for example, to reading the ring buffer descriptor to detect that data has been copied to a buffer of the processing circuit 21.
[0062] Similarly, data frames generated by the host stack 24 may be copied to a buffer and the processing circuitry 21 may poll a corresponding status register to detect whether a TS data frame generated by the host stack 24 is forwarded to one of the MAC units 22. However, it is emphasized that the generation of data frames by the host, including the generation of TS data frames, is performed during an NTS time slice such that the TS data frames generated by the host stack 24 and transmitted during a TS time slice are available at the start of said TS time slice. In a preferred embodiment, a single task performed during the TS mode of operation is then configured to forward said TS data frames to one of the MAC units 22 at the start of a TS time slice. This may be done, for example, by polling a status register of a ring buffer into which the TS data frames generated by the host stack 24 are copied at the start of a TS time slice. As explained above, these status registers correspond, for example, to ring buffer descriptors read by the processing circuitry 21.
[0063] In general, the status register may be polled frequently to quickly detect receipt of a transmitted data frame. If the polling is performed periodically, the shorter the polling period, the more quickly the reception of a transmitted data frame can be detected.
[0064] To further reduce the latency for TS data frames, in the TS mode of operation, the processing circuitry 21 may in some embodiments apply a cut-through scheme. In such a cut-through scheme, the processing of the data frame by the switching function starts before the entire data frame is received. Typically, in the cut-through scheme, small buffers are used and the data frame received by the MAC unit 22 is broken down into a number of fragments that are stored in respective buffers of the processing circuitry 21. Thus, as soon as a fragment of a data frame is received, it is copied to a buffer and processed by the processing circuitry 21 before other fragments are received and copied to the buffer. Then, as soon as the fragment containing the address of the destination of the data frame is processed, the forwarding starts. Thus, the cut-through scheme allows to reduce the latency at the expense of not being able to check the integrity of the received data frame, since the Frame Check Sequence (FCS) generally appears at the end of the data frame.
[0065] Such a cut-through scheme requires the use of small buffers to store data frame fragments. In conventional systems, using small buffers increases the number of interrupts generated to receive data frames. However, in the TS mode of operation, interrupts are disabled so that small buffers can be used without affecting the operation of the RTOS.
[0066] Preferably, in the TS mode of operation the buffer used is small, for example the buffer has the same size for the TS mode of operation, 256 bytes or less or 128 bytes or less.
[0067] In the NTS mode of operation, the timing constraints are lower than in the TS mode of operation, so that it is possible to use either the cut-through or the store-and-forward scheme. In the store-and-forward scheme, a data frame is processed and forwarded only after it is completely copied into one or more buffers, thereby increasing the latency relative to the cut-through scheme. However, in the store-and-forward scheme, the integrity of the data frame is checked before forwarding the data frame, thereby making it possible to avoid forwarding a corrupted data frame.
[0068] Preferably, the NTS mode of operation uses a store-and-forward scheme. Regardless of the scheme used (cut-through or store-and-forward), the NTS mode of operation preferably uses buffers having a larger size than the buffers used in the TS mode of operation. For example, the buffers used for the NTS mode of operation have a size of 512 bytes or more, or 1024 bytes or more.
[0069] Table 1 provides examples of tasks and their associated priorities that are executed during the TS and NTS time slices. [Table 1]
[0070] In the example shown in Table 1, single task #0, which runs during the TS time slice, also performs DMA management, while DMA management is performed during another task with highest priority during the NTS time slice. DMA management includes directing the DMA controller to copy data from a buffer in processing circuitry 21 to the internal memory of MAC unit 22 and vice versa. This example also illustrates that the tasks that perform the switching functions during the TS time slice (single task #0) and the NTS time slice (task #2) are typically different.
[0071] Figure 4 shows a time diagram illustrating an example of switching of data frames when using the tasks and priorities shown in Table 1. In this example, several queues are represented diagrammatically: The Host-TS-TxQ corresponds to a queue in the host port 26 for TS data frames generated and transmitted by the host stack 24. - Host-TS-RxQ corresponds to a queue in the host port 26 for received TS data frames for the host stack 24. MAC-NTS-TxQ corresponds to a queue of the physical port 25 for NTS data frames to be transmitted by the MAC unit 22. - Host-NTS-RxQ corresponds to a queue in the host port 26 for received NTS data frames for the host stack 24.
[0072] As discussed above, these queues are preferably implemented as ring buffer descriptors that contain pointers to buffers that store data relating to TS / NTS data frames.
[0073] As shown in FIG. 4, the single task #0 is the only task operating during a TS time slice, during which the switching device 20 continuously receives three different TS data frames indicated by TS-Rx1, TS-Rx2, and TS-Rx3. In this example, the single task #0 starts by forwarding the TS data frames in the Host-TS-TxQ queue to one of the MAC units 22. In this example, there is only one TS data frame indicated by TS-Tx1 in the Host-TS-TxQ queue. The single task #0 then forwards the TS data frames received from the MAC unit 22 to the MAC unit 22 and / or to the host stack 24. In this example, the TS data frames TS-Rx1 and TS-Rx3 are retransmitted by the MAC unit 22 on the communication channel as TS data frames TS-Tx2 and TS-Tx3, respectively. As shown in Figure 4, both TS data frames TS-Rx1 and TS-Rx3 are retransmitted before being completely received due to the cut-through method used in the TS mode of operation. TS data frame TS-Rx2 is intended for the host stack 24 and is forwarded to the Host-TS-RxQ queue. It should be noted that the duration of a TS time slice may be purposely configured to ensure that all TS data frames (i.e., those in the Host-TS-TxQ and those received by the MAC unit 22 and forwarded to another MAC unit 22) are transmitted during the TS time slice.
[0074] During an NTS time slice, tasks #1-#4 are then executed according to their respective priorities. An NTS time slice begins with task #1 forwarding an NTS data frame in the MAC-NTS-TxQ queue to one of the MAC units 22. In this example, there is only one NTS data frame in the MAC-NTS-TxQ queue, indicated by NTS-Tx1.
[0075] As shown in FIG. 4, task #2 is executed at the beginning of the NTS time slice. Task #2 corresponds to the processing tasks discussed above that are responsible for generating TS data frames for the host stack 24 and extracting data from TS data frames received for the host stack 24. Basically, generating TS data frames corresponds to constructing and posting TS data frames to the Host-TS-TxQ queue. Extracting data from TS data frames received for the host stack 24 corresponds to extracting data from data frames in the Host-TS-RxQ queue. Preferably, task #2 is executed at the beginning of the NTS time slice for a predetermined maximum duration (shorter than the duration of the NTS time slice) to ensure that there is time left to execute other tasks with lower priority, including task #3, which performs the switching function. As shown in FIG. 4, the switching device 20 continuously receives four different NTS data frames, indicated by NTS-Rx1, NTS-Rx2, NTS-Rx3, and NTS-Rx4, copied by task #1 to the buffer of the processing circuit 21 during the NTS time slice. In this example, the NTS data frame NTS-Rx1 is retransmitted by task #3 (and task #1) as NTS-Tx2. Task #3 detects that the NTS data frame NTS-Rx2 is for the host stack 24 and posts it to the Host-NTS-RxQ queue for further processing by task #4. The NTS data frame NTS-Rx3 is retransmitted by task #3 (and task #1) as NTS-Tx3. The NTS data frame NTS-Rx4 should also be retransmitted by task #3, but there is not enough time left in the NTS time slice. The NTS data frame NTS-Rx4, in this example, is posted to the MAC-NTS-TxQ queue for transmission during the next NTS time slice.
[0076] Task #4 may also be executed to perform non-critical host stack functions, including, for example, generation of NTS data frames by host stack 24, extraction of data from received NTS data frames for host stack 24, such as frame NTS-Rx2, and higher level functions accomplished by host stack 24.
[0077] 5 shows a schematic representation of an example of a software architecture implemented by the processing circuitry 21 for the switch 23 performing the switching functions. As shown in FIG. 5, the software architecture includes, in this example: a data frame receiving unit 231; a data frame classification unit 232; - a data frame forwarding unit 233; - Data frame transmission unit 234 Includes.
[0078] The data frame receiver 231 processes queues for data frames received by the MAC unit 22 (mainly DMA control). It therefore instructs the DMA controller to copy data from the internal memory of the MAC unit 22 to queues in the processing circuit 21. These queues may be implemented as ring buffer descriptors, containing pointers to buffers that store data related to data frames received by the MAC unit 22. These buffers may be allocated by the data frame receiver 231.
[0079] In the example shown in FIG. 5, the MAC units 22 are assumed to support the IEEE 802.1Qbv standard, and TS and NTS data frames are sent to different queues, indicated by MAC-TS-RxQ and MAC-NTS-RxQ, respectively, for each MAC unit 22.
[0080] As discussed above, depending on whether the TS or NTS mode of operation is used, the data frame receiver 231 may detect that a data frame has been received by one of the MAC units 22 by polling a queue (to reduce latency) or by placing it in an ISR. The data frame receiver 231 dispatches received data frames to the data frame classifier 232. Depending on whether the cut-through method is used, dispatching of the data frame may begin upon reception of the first or last fragment of the data frame.
[0081] The data frame receiver 231 also processes the queues of the host port 26 using the host stack 24, which contain data frames generated by the host stack 24 to be transmitted by one or more MAC units 22. In this example there is only one queue, denoted Host-TxQ. Of course it is also possible to have more than one queue, for example one queue for TS data frames and one queue for NTS data frames, or different queues for different Quality of Service (QoS), or more generally different queues for different Traffic Classes (TC), etc.
[0082] The data frame classifier 232 checks the data frames to determine the TC of each received data frame and posts them to different internal queues respectively associated with the different TCs considered. In the example shown in FIG. 5, the considered TCs are TS data frames and NTS data frames, respectively, and the queues are indicated by Int-TS-TxQ and Int-NTS-TxQ, respectively. Since the MAC unit 22 has already classified the received data frames into TS data frames and NTS data frames, they are dispatched directly to their corresponding queues among the Int-TS-TxQ queue and the Int-NTS-TxQ queue. In this example, the data frame classifier 232 mainly classifies the data frames received in the Host-TxQ queue, and transfers the data frames classified as TS and NTS to the Int-TS-TxQ queue and the Int-NTS-TxQ queue, respectively.
[0083] The data frame forwarding unit 233 applies forwarding rules, for example based on a predefined table. Essentially, the data frame forwarding unit 233 decides whether a received data frame should be forwarded to one or more MAC units 22 or to the host port 26, i.e. to the host stack 24. Data frames for the host stack 24 are posted to two different queues, denoted by Host-TS-RxQ and Host-NTS-RxQ, respectively, in this example. Data frames to be retransmitted by the MAC unit 22 are dispatched to the data frame sending unit 234.
[0084] It should be noted that the data frame forwarding unit 233 may also modify data frames in the Int-TS-TxQ and Int-NTS-TxQ queues in some cases, for example, the data frame forwarding unit 233 may insert additional data in the frame header, such as a VLAN identifier, or replace the VLAN identifier with another one, in data frames transmitted by the MAC unit 22.
[0085] The data frame transmitter 234 processes queues for data frames to be transmitted by the MAC unit 22 (mainly DMA control). It therefore commands the DMA controller to copy data in the queues of the processing circuit 21 to the internal memory of the MAC unit 22. These queues may be implemented as ring buffer descriptors, containing pointers to buffers storing data related to data frames to be transmitted by the MAC unit 22. The data frame transmitter 234 may check the queues to check the correct transmission of data frames by the MAC unit 22, for example to free buffers allocated by the data frame receiver 231.
[0086] In the example shown in FIG. 5, the MAC units 22 are assumed to support the IEEE 802.1Qbv standard, and TS and NTS data frames are posted to different queues, indicated by MAC-TS-TxQ and MAC-NTS-TxQ, respectively, for each MAC unit 22, from where they are forwarded to the MAC units 22 by the DMA controller.
[0087] FIG. 6 illustrates diagrammatically another non-limiting example of a possible software architecture for a switch 23 executing the switching functions, executed by the processing circuitry 21.
[0088] As shown in Fig. 6, this software architecture also includes a data frame receiving unit 231, a data frame classifying unit 232, a data frame forwarding unit 233 and a data frame transmitting unit 234. Compared to the example of Fig. 5, the main difference is that the MAC unit 22 does not support the IEEE 802.1Qbv standard, which is therefore implemented by the processing circuit 21. The MAC units 22 each include one queue MAC-RxQ for received data frames (including both TS and NTS data frames) and one queue MAC-TxQ for transmitted data frames.
[0089] 6, the data frame classification unit 232 classifies data frames received from the host stack 24 and data frames received from the MAC unit 22. For example, if a received data frame includes a VLAN priority, a data frame having a VLAN priority of 7 can be posted to the Int-TS-TxQ queue, and a data frame having a VLAN priority of 0 to 6 can be posted to the Int-NTS-TxQ queue.
[0090] In turn, the data frame transmitting unit 234 preferably includes a frame scheduler implementing the IEEE 802.1Qbv standard, which therefore posts TS and NTS data frames to the MAC-TxQ queue of the MAC unit 22 according to the TS and NTS time slices of each time cycle. In this case, the MAC unit 22 supports time-based scheduling, i.e., the MAC unit 22 is capable of transmitting data frames at a given time based on, for example, a network clock (e.g., IEEE 1588-2008).
[0091] Of course, the examples shown in Figures 5 and 6 are non-limiting, and other examples are possible. For example, the data frame classifier 232 may classify the data frames into TCs that do not directly correspond to the TS and NTS traffic classes. For example, the received data frames may be classified according to their respective QoS (in which case they are dispatched to different queues associated with different QoS), according to their respective VLAN priorities (in which case they are dispatched to different queues associated with different VLAN priorities), etc. In that case, the data frame transmitter 234 and / or the data frame forwarder 233 may perform a mapping between the different TCs considered and the TS and NTS traffic classes before transmission by the MAC unit 22 (for example, a data frame with VLAN priority 7 is transmitted as a TS data frame, a data frame with VLAN priorities 0 to 6 is transmitted as an NTS data frame, etc.).
[0092] In a preferred embodiment, a data frame received by MAC unit 22 is copied to a buffer in processing circuitry 21, from which it may be accessed (via a DMA controller) by host stack 24 and / or by another of MAC units 22. Therefore, in such an embodiment, copying of data frames from one buffer in processing circuitry 21 to another is avoided as much as possible.
[0093] Considering the example shown in Fig. 5, this means that if a data frame received by a MAC unit 22 is forwarded to another MAC unit 22 without modification, the corresponding queue contains a pointer to a buffer containing this data frame (or to multiple buffers containing this data frame if the data frame is fragmented). For example, if the data frame is a TS data frame, this means that the pointers of the MAC-TS-RxQ, Int-TS-TxQ and MAC-TS-TxQ queues point to the same one or more buffers. This makes it possible to reduce the amount of memory and processing CPU power required, thereby avoiding the latency introduced by such copying between buffers, at least in cases where the data frame does not need to be modified. Similarly, for a TS data frame received by the MAC unit 22 for the host stack 24, the pointers of the MAC-TS-RxQ, Int-TS-TxQ and Host-TS-RxQ queues point to the same one or more buffers.
[0094] Therefore, the same buffer may be used by different processes and a given buffer is only released when the last process using it has finished. For example, if a data frame is forwarded to multiple MAC units 22, the corresponding buffer is only released when all MAC units 22 have completed transmitting the data frame. What such a feature can do is associate a reference counter with each buffer. This counter needs to be incremented every time a process gains a reference there (i.e. uses the buffer). This counter is decremented every time a process loses a reference to a buffer there (i.e. no longer needs to use the buffer). When the reference counter reaches zero, the associated buffer is effectively released.
[0095] If the size of a data frame needs to be modified, for example by inserting data into or deleting data from said data frame, said data frame is preferably fragmented into a number of fragments that are stored in respective buffers. The one or more fragments that need to be modified by adding or deleting data are therefore called target fragments and are the only fragments that are copied to the other buffer of processing circuit 21. The data frame is therefore not copied in its entirety from one buffer to another, but only its target fragments. Pointers to buffers containing unmodified fragments are therefore not modified, while pointers to buffers containing target fragments are modified to point to the buffers to which the modified target fragments were copied. Copying between buffers is therefore limited, if necessary, to buffers containing target fragments of a data frame, thereby reducing the latency introduced by such copying between buffers.
[0096] The switching device 20 may be used in a local area network (LAN), such as, for example, an industrial LAN. Such a LAN may include a plurality of such switching devices 20, at least some of which are connected together according to a daisy chain topology. However, it is emphasized that the switching devices 20 may also be connected together according to other network topologies.
Claims
1. 1. A method of performing a software switching function by a processing circuit of a switching device, the switching device further comprising a host stack and at least two medium access controller (MAC) units for communicating data frames on a communication channel, the host stack comprising application software executing on the switching device, the at least two MAC units being connected to the processing circuit, the software switching function comprising forwarding data frames received by one of the MAC units to another one of the MAC units and / or to the host stack and / or forwarding data frames received from the host stack to one of the MAC units, communication on the communication channel being organized according to successive time cycles, each time cycle comprising at least a first time slice and a second time slice, the first time slice for communicating data frames having a higher timing constraint than data frames communicated during the second time slice, the processing circuit executing a real-time operating system (RTOS), the RTOS comprising an RTOS scheduler for scheduling a plurality of tasks having different priorities in normal operation, the method comprising: applying, by the processing circuitry, during each first time slice, a first mode of operation, in which normal operation of the RTOS is suspended in that the RTOS scheduler is suspended and the processing circuitry performs a single task of performing the software switching function; applying, by the processing circuitry, a second mode of operation during each of the second time slices, in which normal operation of the RTOS is resumed and the software switching functions are performed by a task not having the highest priority of the RTOS scheduler; A method comprising:
2. 2. The method of claim 1, wherein the processing circuitry is configured to detect receipt of a forwarded data frame by repeatedly polling a status register associated with a buffer used to store data frames received from the MAC unit or from the host stack.
3. In the first mode of operation, the processing circuitry applies a cut-through technique in which transfer of a data frame is started before the entire data frame is received; 3. The method of claim 1, wherein in the second operating mode, the processing circuitry applies a cut-through or store-and-forward scheme, in which forwarding of a data frame is started only after the entire data frame has been received.
4. 4. The method of claim 3, wherein in the cut-through manner, each data frame received by the MAC unit is broken into a number of fragments stored in respective buffers of the processing circuit, the buffers having the same size, which is equal to or less than 256 bytes or equal to or less than 128 bytes, for the first operating mode.
5. The method of claim 4 , wherein the buffer used for the second mode of operation has a size of 512 bytes or more, or 1024 bytes or more.
6. A method according to any one of claims 1 to 5, wherein a data frame received by one of the MAC units is copied to a buffer of the processing circuit, from which the data frame is accessed by the host stack and / or by another one of the MAC units.
7. 7. The method of claim 6, wherein different buffers store each fragment of a data frame, and when a target fragment of the data frame is modified by deleting or inserting data, the target fragment is modified and copied into another buffer, and other fragments are not copied into other buffers.
8. 8. The method of claim 1, wherein if a time-sensitive data frame is generated by the host stack during a second time slice, the single task executed during the first mode of operation is configured to forward the time-sensitive data frame to one of the MAC units at the start of a next first time slice.
9. 9. The method of claim 1, wherein the tasks of the second operating mode include a processing task having a higher priority than a task performing the software switching function, the processing task being used to generate a time-sensitive data frame of the host stack to be transmitted during a next first time slice and / or to extract data from a time-sensitive data frame transferred to the host stack during a previous first time slice.
10. 10. The method of claim 9, wherein the RTOS scheduler is configured to execute the processing task at the beginning of each second time slice within a predetermined maximum duration.
11. A computer program product comprising instructions which, when executed by a processing circuit, configure said processing circuit to perform a method according to any one of claims 1 to 10.
12. A computer readable storage medium comprising instructions which, when executed by a processing circuit, configure the processing circuit to perform the method of any one of claims 1 to 10.
13. A switching device comprising at least two Medium Access Controller (MAC) units, said at least two MAC units being connected to a processing circuit, said processing circuit being configured to perform the method according to any one of claims 1 to 10.
14. The switching device according to claim 13 , wherein the at least two MAC units are Ethernet MAC units.
15. 15. A local area network (LAN) comprising a plurality of switching devices according to claim 13 or 14, at least some of the switching devices being connected together according to a daisy chain topology.
Citation Information
Patent Citations
Switching device, switching method, and program
JP2020048045A
Architecture for Converged Industrial Control and Real Time Applications
US20190044894A1
