Message transmission method, equipment and medium
By storing message descriptors in the switching device and using timestamps and adjustment amounts to control the message sending time, the delay jitter and insufficient residence time problems of the switching device are solved, and deterministic forwarding and longer residence time are achieved.
Patent Information
- Application Number
- CN202410357797.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2025-10-03
AI Technical Summary
Existing switching equipment suffers from delay jitter and insufficient dwell time when forwarding delay-sensitive messages, and cannot meet determinism requirements.
By storing message descriptors instead of complete messages, and combining timestamps and preset time adjustments to accurately control message sending times, the delay jitter optimization and residence time of switching equipment are improved.
It achieves deterministic forwarding delay and longer residence time of messages, is suitable for more application scenarios, and improves the delay jitter of switching equipment.
Smart Images

Figure CN120750874A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication transmission technology, and in particular to a message transmission method, device, and medium. Background Art
[0002] In scenarios where messages are forwarded through switching devices, there are messages that have deterministic forwarding delay requirements. These messages are also called delay-sensitive messages. For example, in the Industrial Internet of Things (IIoT) scenario, if the forwarding delay of such messages is unstable, it will cause industrial control signal delays, thereby affecting industrial production. For example, in autonomous driving scenarios, if the forwarding delay of such messages is unstable, it will cause control signal delays for autonomous vehicles, which may cause traffic accidents. For example, in audio and video transmission scenarios, if the forwarding delay of such messages is unstable, it will cause audio and video quality to degrade, thereby affecting user experience and system performance. However, due to the delay jitter in the switching device, the forwarding delay of multiple messages sent by the sending device to the receiving device through the switching device is unstable. That is, the forwarding delay of the message is uncertain, and thus cannot meet the deterministic forwarding delay requirements of delay-sensitive messages.
[0003] Among some related technologies, the Institute of Electrical and Electronics Engineers (IEEE) 802.1Qbv defines a time-aware shaper (TAS), which is a time-based queue scheduling method. Its scheduling object is the queue. TAS introduces the concept of transmission gating. The gate includes two states: "open" and "closed", and a gating list is defined accordingly. The gating list includes the gate state. The queue is scheduled according to the gate state. Whether the message in the queue can be output from the queue is controlled by the gate state. The message can be output from the queue only when the gate state is open. Switching devices supporting the IEEE 802.1Qbv protocol can schedule messages in queues based on the TAS. After receiving messages from a receiving device, the switching device stores them in a queue and opens or closes the queue based on the gate status in a preconfigured gating list. When the gate status is open, the queue is opened and the message is output from the queue. By controlling the queue's on / off status, the transmission time of messages in the queue is controlled within a certain time period. This method schedules messages by scheduling queues, but cannot control the specific transmission time of each message within that time period. Some messages may reach their expected transmission time before the queue is opened, but must wait until the queue is opened before they can be sent. This method can only partially improve the switching device's latency jitter. That is, after passing through the switching device, messages still experience latency jitter, which is smaller than the switching device's actual jitter. This method is only suitable for scenarios with low latency requirements. Furthermore, due to the limited number of messages that can be stored in the queue, this method reduces the maximum retention time of messages supported by the switching device, making it only suitable for scenarios with low retention time requirements. Summary of the Invention
[0004] The present disclosure provides a message transmission method, device and medium, which are used to better improve the delay jitter of a switching device and increase the maximum residence time of a message supported by the switching device.
[0005] In a first aspect, an embodiment of the present disclosure provides a message transmission method, which is applied to a switching device and can also be applied to a structure or device set in the switching device, such as a chip, a chip system or a circuit system. Taking the application of this method to a switching device as an example, the method includes: obtaining a first message; wherein the first message carries a first timestamp, and the first timestamp indicates the sending time of the first message from the upstream device of the switching device or the receiving time of the first message by the switching device; storing the first message in a first cache and recording the first storage address of the first message in the first cache; generating a message descriptor for the first message and storing the message descriptor in a first scheduling queue; wherein the message descriptor includes a first timestamp and a first storage address; detecting the first timestamp included in the message descriptor stored in the first scheduling queue, and when it is determined that the actual expected sending time of the first message is greater than or equal to the current time based on the detected first timestamp and a preset time adjustment amount, outputting the message descriptor to the first scheduling queue, obtaining the first message from the first cache according to the first storage address, and sending the first message.
[0006] In a second aspect, an embodiment of the present disclosure provides an electronic device, the device comprising:
[0007] one or more processors;
[0008] a memory having one or more programs stored thereon, which, when the one or more programs are executed by one or more processors, causes the one or more processors to implement the first aspect and any possible embodiment of the first aspect;
[0009] One or more I / O interfaces are connected between the processor and the memory and configured to implement information exchange between the processor and the memory.
[0010] In a third aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the first aspect and any possible embodiment of the first aspect when the computer program is executed by a processor.
[0011] In the present disclosure, a method for accurately scheduling messages is designed. Compared with TAS, the scheduling object of the present disclosure is the message rather than the queue. Compared with TAS, the message descriptors generated by the message rather than the complete message are stored in the scheduling queue. In this way, in a queue of the same size, the method of the present disclosure can store more message descriptors, thereby increasing the maximum residence time of the message supported by the switching device. In addition, the present disclosure does not need to configure a gate list and gate status for the scheduling queue. Instead, the actual expected sending time of the message is determined based on the timestamp carried by the message and a preset time adjustment. When it is determined that the actual expected sending time of the message is greater than or equal to the current time of the switching device, the scheduling message descriptor is output to the scheduling queue, and the corresponding message is retrieved from the cache according to the storage address included in the message descriptor and sent. Compared with TAS, which controls the sending time of all messages in the queue within a certain time period, the method of the present disclosure can accurately control the sending time of each message in the scheduling queue, further optimize the jitter of the message within a period of time, better improve the delay jitter of the switching device, and adapt to more application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In the accompanying drawings of the embodiments of the present disclosure:
[0013] Figure 1 A schematic diagram of message transmission provided in an embodiment of the present disclosure;
[0014] Figure 2 A communication network architecture diagram provided in an embodiment of the present disclosure;
[0015] Figure 3 Another communication network architecture diagram provided by an embodiment of the present disclosure;
[0016] Figure 4 Another communication network architecture diagram provided in an embodiment of the present disclosure;
[0017] Figure 5 Another schematic diagram of message transmission provided by an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of TAS-based scheduling provided in an embodiment of the present disclosure;
[0019] Figure 7 A flow chart of a message transmission method provided in an embodiment of the present disclosure;
[0020] Figure 8 A schematic diagram of another message transmission provided in an embodiment of the present disclosure;
[0021] Figure 9 A flow chart of another message transmission method provided by an embodiment of the present disclosure;
[0022] Figure 10 A schematic diagram of message descriptor scheduling provided in an embodiment of the present disclosure;
[0023] Figure 11 A block diagram of an electronic device according to an embodiment of the present disclosure;
[0024] Figure 12 A block diagram of the composition of a computer-readable medium provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] To enable those skilled in the art to better understand the technical solution of the present disclosure, a message transmission method, device, and medium provided by an embodiment of the present disclosure are described in detail below with reference to the accompanying drawings.
[0026] The present disclosure will be described more fully hereinafter with reference to the accompanying drawings, but the illustrated embodiments may be embodied in different forms, and the present disclosure should not be construed as limited to the embodiments set forth below. Rather, these embodiments are provided so that the present disclosure will be thorough and complete and will fully understand the scope of the present disclosure to those skilled in the art.
[0027] The accompanying drawings of the embodiments of the present disclosure are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the detailed embodiments, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing the detailed embodiments with reference to the accompanying drawings.
[0028] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0029] The terms used in this disclosure are only used to describe specific embodiments and are not intended to limit the disclosure. As used in this disclosure, the term "and / or" includes any and all combinations of one or more related enumerated items. As used in this disclosure, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. As used in this disclosure, the terms "comprising" and "made of" specify the presence of the features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof.
[0030] In the description of the present disclosure, words such as “first” and “second” are only used for the purpose of distinguishing the description and cannot be understood as indicating or implying relative importance or order.
[0031] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meanings as those commonly understood by those skilled in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined in this disclosure.
[0032] In this disclosure, unless otherwise specified, the following technical terms should be understood as follows:
[0033] 1) Delay jitter, also known as jitter, is a short-term deviation of the actual delay from the expected delay due to jitter in the transmission equipment in the network during signal transmission. This is called delay instability. The short-term deviation of the actual signal reception time from the expected reception time (ideal reception time) is called jitter. Figure 1 , is a schematic diagram of message transmission provided by an embodiment of the present disclosure, Figure 1 The example above uses the case where packets are sent evenly at certain time intervals when leaving the sender to explain jitter. In other scenarios, packets may also be sent at uneven time intervals when leaving the sender. Figure 1 When messages pass through the transmission equipment in the network at uniform time intervals, this uniform time interval is disrupted due to the different delays experienced by the messages. When the reception time interval of two messages is inconsistent with the transmission time interval of the two messages, jitter occurs. This jitter is called delay jitter.
[0034] 2) Switching equipment refers to network equipment used to forward electrical (optical) signals. For example, this can be a switch or other equipment capable of forwarding electrical (optical) signals. Switches can include Ethernet switches, voice switches, or fiber optic switches.
[0035] 3) In the present disclosure, a message may include a message header and a message body. The message header may include message control information, such as the message type, source media access control address (MAC) address, destination MAC address, source port number, destination port number, service type, protocol version, etc. The message body includes service data, such as text, images, audio, video, and other data in IIoT services, autonomous driving-related services, or audio and video-related services.
[0036] 4) Congestion refers to the ingress bandwidth being greater than the egress bandwidth. In a congested scenario, the message transmission delay is highly uncertain, significantly increasing the message transmission delay.
[0037] Refer to the attached Figure 2, is a communication network architecture diagram provided by the embodiment of the present disclosure, combined with the attached Figure 2 The scenarios to which the present disclosure is applicable are described. Figure 2 The type of communication network is not limited in the present invention. The network architecture includes a switching device, a transmitting device and a receiving device. The switching device can be a chassis structure, and the chassis can include a routing module and multiple switching modules ( Figure 2 (taking four switching modules as an example), the routing module can be used to provide routing forwarding functions, the switching module can be used to provide data exchange functions, and the message forwarding can be achieved between the sending device and the receiving device through the switching device. For example, taking the example of the sending device 1 transmitting a message to the receiving device 1 through the switching device, the sending device 1 sends a message, the switching module 1 of the switching device receives the message sent by the sending device 1, and transmits the received message to the routing module via the switching module 1, and then transmits it to the switching module 2 via the routing module, and finally sends the message to the receiving device 1 via the switching module 2. In the embodiment of the present disclosure, the switching module used for uplink data exchange (uplink transmission) can be called an uplink switching module, such as the switching module 1 and the switching module 4 for receiving messages, and the switching module used for downlink data exchange (downlink transmission) can be called a downlink switching module, such as the switching module 2 and the switching module 3 for sending messages. Figure 2 The number of devices and modules in the network architecture shown is for illustration only, and the embodiments of the present disclosure are not limited thereto. Figure 2 The example of a sending device and a receiving device forwarding messages through a switching device is used for illustration purposes only and does not limit the applicable scenarios of the technical solutions provided in this application. In some possible scenarios, the sending device and the receiving device may also forward messages through multiple switching devices, cascading multiple switching devices to form a forwarding network, through which the sending device can transmit messages to the receiving device. In the embodiments of the present disclosure, the type of switching device is not limited, and may be, for example, an Ethernet switching device, a Fast Ethernet switching device, a Gigabit Ethernet switching device, a 10 Gigabit Ethernet switching device, etc.
[0038] Refer to the attached Figure 3 , is another communication network architecture diagram provided by the embodiment of the present disclosure, combined with the attached Figure 3 The scenarios to which the present disclosure is applicable are described. Figure 3 The communication network is an Ethernet network. The network architecture includes an Ethernet switching device, a transmitting device, and a receiving device. The Ethernet switching device can be a frame structure, and the frame can include multiple sub-devices ( Figure 3In the example of four sub-devices in the figure) and global switching routing, the global switching routing can provide routing forwarding functions, the sub-devices can provide data exchange functions, and the sending end device and the receiving end device can realize message forwarding through the Ethernet switching device. During message forwarding, the Ethernet switching device receives the message from the sending end device through sub-device 1, and sub-device 1 transmits the received message to the global switching routing, and then transmits the message to sub-device 3 through the global switching routing, and then forwards the message to the receiving end device through the sending port of sub-device 3. In the embodiment of the present disclosure, the sub-device used for uplink data exchange (uplink transmission) can be called an uplink sub-device, for example Figure 3 The sub-device 1 in the embodiment of the present invention is a sub-device used for downlink data exchange (downlink transmission) and can be called a downlink sub-device. Figure 3 Sub-device 3 in. Figure 3 The number of each device or module in the network architecture shown is for illustration only, and the embodiments of the present disclosure are not limited thereto. Figure 3 The example of a transmitting device and a receiving device forwarding messages through a single Ethernet switching device is used for illustration purposes only and does not limit the applicable scenarios of the technical solutions provided herein. In some possible scenarios, the transmitting device and the receiving device may also forward messages through multiple Ethernet switching devices. In such scenarios, multiple Ethernet switching devices are cascaded to form a forwarding network, through which the transmitting device can transmit messages to the receiving device.
[0039] Refer to the attached Figure 4 , is another communication network architecture diagram provided by the embodiment of the present disclosure, combined with the attached Figure 4 The scenarios to which the present disclosure is applicable are described. Figure 4 The type of communication network is not limited, for example, it can be an Ethernet network. The network architecture includes a sending end device, a receiving end device and a switching system, wherein the switching system can include at least two switching devices ( Figure 4 Taking three switching devices as an example), it can be understood that at least two switching devices are cascaded to form a switching system (which can be understood as a forwarding network). Figure 4 The structure of the switching equipment can be Figure 2 The structure of the switching device shown can also be used Figure 3 The structure of the Ethernet switching device shown is not limited thereto. Message forwarding can be achieved between the sending end device and the receiving end device via the switching system.
[0040] by Figure 2-Figure 4Taking the communication network architecture diagram shown in FIG as an example, in the scenario where messages are forwarded through a switching device, an Ethernet switching device or a switching system, there are messages that have deterministic requirements for forwarding delay (i.e., delay-sensitive messages). Due to the delay jitter in the switching device, the Ethernet switching device or the switching system, the forwarding delay of the message is uncertain, and thus cannot meet the deterministic requirements of the delay-sensitive message for forwarding delay. The following describes this process with reference to the accompanying drawings. Figure 5 , which is another message transmission schematic diagram provided by an embodiment of the present disclosure, Figure 5 The switching device in can be Figure 2-Figure 4 In a switching device, Ethernet switching device or switching system, the time intervals of the messages sent by the sending device during transmission may be the same or different. Figure 5 In the example, the time intervals of messages in transmission are different. Messages A1, A2, A3, and A4 are input into the switching device, output from the switching device, and then sent to the receiving device. Figure 5 It can be seen that due to the delay jitter in the switching device, the time interval between packets A1-A4 being output from the switching device and the time interval before they entering the switching device is different. In other words, the forwarding delays of packets A1-A4 from entering the switching device to being output from the switching device are different (that is, t1, t2, t3, and t4 are not equal). The forwarding delay is uncertain and cannot meet the deterministic forwarding delay requirement of the packets.
[0041] Among some related technologies, TAS is defined in IEEE 802.1Qbv. Figure 6 , is a TAS-based scheduling diagram provided in an embodiment of the present disclosure, Figure 6 The switch module can be Figure 2 The switching device or switching module in Figure 3 Ethernet switching device or sub-device in Figure 4A switching device or switching system in which a switching module supports the IEEE 802.1Qbv protocol can control queue switching based on the gate status of different queues included in a gating list, thereby controlling the transmission of messages in the queues. For example, if the gate status for queue 1 is open, messages in queue 1 can be output from the queue. If the gate status for queue 0 is closed, messages in queue 0 cannot be output from the queue, and so on, until there are no messages in the queue to be forwarded. By controlling the queue switching, the transmission time of messages in the queue is controlled within a certain time period, but the specific transmission time of each message within the time period cannot be controlled. This method can only partially improve the delay jitter of the switching device. That is, using this method, messages still have a delay jitter after transmission through the switching device, which is smaller than the delay jitter of the switching device. This method is only suitable for scenarios with low latency requirements. In addition, due to the limited number of messages that can be stored in the queue, this method reduces the maximum residence time of messages supported by the switching device. This method is only suitable for scenarios with low residence time requirements.
[0042] In view of this, the embodiments of the present disclosure provide a message transmission method, device and medium, which can be applied to the scenarios and Figure 2-Figure 4 The communication network architecture shown is described in detail below with reference to the accompanying drawings.
[0043] First, refer to the attached Figure 7 , is a flow chart of a message transmission method provided by an embodiment of the present disclosure, which is applied to a switching device. For example, the switching device may be Figure 2 The switching device in the embodiment can be specifically used for the downlink switching module of the switching device. For example, the switching device can also be Figure 3 The Ethernet switching device in the embodiment can be specifically used as a downlink sub-device of the Ethernet switching device. For example, the switching device can also be Figure 4 The switching device or switching system in the embodiment of the present invention comprises:
[0044] S701: Obtain a first message.
[0045] In an embodiment of the present disclosure, the first message may be a delay-sensitive message. The first message carries a first timestamp, which indicates the time when the first message was sent from an upstream device of the switching device or the time when the first message was received by the switching device. The upstream device may be a transmitting device or a transmission device between the transmitting device and the switching device.
[0046] In the disclosed embodiments, clock synchronization is a prerequisite for achieving deterministic message forwarding. Clock synchronization is maintained between the sub-devices or modules within a switching device, or between the switching device and all devices in the communication network. Existing global clock synchronization technologies can be used to achieve clock synchronization. Clock synchronization ensures the validity of the first timestamp carried by the first message across different modules within the same device or between different devices. The disclosed embodiments can be used in uncongested transmission scenarios.
[0047] In one example, this method is applied to Figure 3 Taking a downstream sub-device of an Ethernet switching device as an example, obtaining the first message may include receiving the first message from an upstream sub-device. In this example, the upstream sub-device may receive the first message from the upstream device and record the time of receipt of the first message. After receiving the first message, the upstream sub-device determines whether the first message carries a first timestamp written by the upstream device when sending the first message, indicating the time when the first message was sent from the upstream device. If the first message carries the first timestamp, the first message is directly sent to the downstream sub-device. If the first message does not carry the first timestamp indicating the time when the first message was sent from the upstream device, a first timestamp is generated based on the recorded time of receipt of the first message, and the first timestamp is written into the first message, and the first message is then sent to the downstream sub-device.
[0048] S702: Store the first message in a first cache, and record a first storage address of the first message in the first cache.
[0049] In the disclosed embodiments, the first cache can be an on-chip cache or an off-chip cache. In one possible implementation, first messages with short residency times can be stored in the on-chip cache, while first messages with long residency times can be stored in the off-chip cache. This allows the high performance of the on-chip cache to be utilized to achieve a shorter transmission latency, while the large capacity of the off-chip cache can be utilized to achieve a longer residency time.
[0050] In some possible implementations, the buffer requirement of the first message may be determined first, and a first buffer may be configured for the first message based on the buffer requirement. The buffer requirement of the message may be calculated using the following formula:
[0051] Cache requirement = packet traffic bandwidth * residence time;
[0052] From the above formula, we can see that the larger the packet traffic bandwidth or the longer the residence time, the larger the required cache capacity.
[0053] S703: Generate a message descriptor for the first message, and store the message descriptor in a first scheduling queue, wherein the message descriptor includes a first timestamp and a first storage address.
[0054] In some embodiments, generating a message descriptor for the first message may include: obtaining a first storage address, extracting a first timestamp from the first message, and generating the message descriptor according to the first storage address and the first timestamp.
[0055] S704: Detect the first timestamp included in the message descriptor stored in the first scheduling queue. When it is determined that the actual expected sending time of the first message is greater than or equal to the current time based on the detected first timestamp and the preset time adjustment amount, output the message descriptor to the first scheduling queue, obtain the first message from the first cache according to the first storage address, and send the first message.
[0056] In the embodiment of the present disclosure, the scheduling process of S704 may be implemented by a dedicated scheduler. The dedicated scheduler may be implemented by software or hardware, and there is no limitation on this.
[0057] Through the method provided by the embodiment of the present disclosure, what is stored in the scheduling queue is the message descriptor generated by the message rather than the complete message. In this way, in a queue of the same size, more message descriptors can be stored by using the method of the present disclosure, thereby increasing the maximum residence time of the message supported by the switching device. In addition, the present disclosure determines the actual expected sending time of the message based on the timestamp carried by the message and the preset time adjustment amount. When it is determined that the actual expected sending time of the message is greater than or equal to the current time of the switching device, the scheduling message descriptor is output to the scheduling queue, and the corresponding message is obtained from the cache according to the storage address included in the message descriptor, and the message is sent. Compared with the prior art that controls the sending time of all messages in the queue within a certain time period, the method of the present disclosure can accurately control the sending time of each message in the scheduling queue, further optimize the jitter of the message within a period of time, and better improve the delay jitter of the switching device.
[0058] by Figure 5 Taking the message transmission shown as an example, the method disclosed in this invention can be used to achieve Figure 8 See the attached Figure 8 , is another message transmission diagram provided by an embodiment of the present disclosure. After messages A1, A2, A3, and A4 are input into a switching device, the switching device adopts the message transmission method disclosed in the present disclosure. After being output by the switching device, the messages are sent to the receiving device. Figure 8 It can be seen that although there is delay jitter in the switching device, the method disclosed in this disclosure can make the time interval after the messages A1 to A4 are output from the switching device the same as the time interval before they enter the switching device, that is, the forwarding delay of the messages A1 to A4 from entering the switching device to being output from the switching device is the same (that is, t1, t2, t3, and t4 are equal). This can meet the deterministic requirements of the forwarding delay for delay-sensitive messages. Figure 2 or Figure 3By applying the method disclosed in the present invention to a switching device or an Ethernet switching device, the forwarded message can have a certain forwarding delay. Figure 4 By applying the method disclosed herein in a switching system, messages forwarded between any two switching devices in the switching system can have a certain forwarding delay, that is, any end-to-end connection can achieve a certain transmission delay.
[0059] In some embodiments, storing a first message in a first cache includes: determining a first message type of the first message based on a first message characteristic parameter of the first message; obtaining a pre-configured first mapping relationship and a second mapping relationship; wherein the first mapping relationship is a mapping relationship between a message type and a scheduling queue, and the second mapping relationship is a mapping relationship between a scheduling queue and a cache; determining a first scheduling queue corresponding to the first message type based on the first mapping relationship; determining a cache corresponding to the first scheduling queue based on the second mapping relationship, and determining the cache corresponding to the first scheduling queue as the first cache; and storing the first message in the first cache. In this way, messages of the same message type are input into the same scheduling queue in the order in which they arrive. Since the order in which messages of the same type arrive is consistent with the order in which they are sent, and the queue has a first-in-first-out feature, the message descriptor at the head of the scheduling queue is the first to be allowed to be sent by the queue. Therefore, when detecting the scheduling queue, only the message descriptor at the head of the queue needs to be detected, and there is no need to detect all message descriptors in the queue. This can greatly reduce detection time and thus improve scheduling efficiency.
[0060] In some embodiments, determining a first message type of a first message based on a first message characteristic parameter of the first message includes: obtaining the first message characteristic parameter of the first message; obtaining a pre-configured third mapping relationship, the third mapping relationship being a mapping relationship between the message characteristic parameter and the message type; determining a message type corresponding to the first message characteristic parameter based on the third mapping relationship; and determining the message type corresponding to the first message characteristic parameter as the first message type.
[0061] In some embodiments, the message characteristic parameters include at least one of the following:
[0062] Source port number;
[0063] Destination port number;
[0064] Source MAC address;
[0065] Destination MAC address;
[0066] Business type.
[0067] In some embodiments, detecting the first timestamp included in the message descriptor stored in the first scheduling queue includes: dividing the plurality of first scheduling queues into at least two groups; and simultaneously performing polling detection on the first scheduling queues included in each of the at least two groups in sequence to detect the first timestamp included in the message descriptor stored in the first scheduling queue, so as to determine whether the actual expected sending time of the first message is greater than or equal to the current time based on the detected first timestamp and a preset time adjustment. In this way, by grouping the plurality of first scheduling queues, parallel detection can be performed on the plurality of scheduling queues, significantly reducing detection time.
[0068] In some embodiments, the preset time adjustment amount includes a preset first residence time; when the first timestamp indicates the sending moment of the first message from the upstream device of the switching device, the first residence time is determined according to the preset first delay and the preset second delay; wherein the preset first delay represents the transmission delay between the receiving moment when the message is received by the switching device and the sending moment from the switching device, and the preset second delay represents the transmission delay between the sending moment when the message is sent from the upstream device and the receiving moment when the message is received by the switching device.
[0069] In some embodiments, the preset time adjustment amount includes a preset first residence time; when the first timestamp indicates the reception moment when the first message is received by the switching device, the first residence time is determined according to the preset first delay; wherein the preset first delay represents the transmission delay between the reception moment when the message is received by the switching device and the transmission moment sent from the switching device.
[0070] It should be noted that, in the embodiment of the present disclosure, the preset first residence time can be configured by the user based on an empirical value or a measured value. In one possible implementation, the first residence time can be configured separately for each scheduling queue, and the configuration principle depends on the transmission delay of the message corresponding to the message descriptor in the scheduling queue that the user expects in the switching device. In one possible design, the first residence time can be determined based on the delay of the message with the largest transmission delay in the data stream to which the message belongs. For example, assuming that a data stream includes B1-Bn (n is greater than 8) messages, where the transmission delay between the reception moment of message B8 received by the switching device and the transmission moment sent from the switching device, and the sum of the transmission delay between the transmission moment sent from the upstream device and the reception moment of the message received by the switching device is T1, and T1 is greater than the transmission delay of the remaining messages, then the first residence time can be determined based on T1.
[0071] In some embodiments, the preset time adjustment amount further includes a preset offset advance amount, wherein the preset offset advance amount represents the transmission delay between the moment the packet descriptor is output from the first scheduling queue and the moment the first packet is retrieved based on the packet descriptor and sent to the output port. Thus, by configuring the offset advance amount, the packet descriptor can be output from the scheduling queue in advance, thereby eliminating the transmission delay between the moment the packet descriptor is output from the first scheduling queue and the moment the first packet is retrieved based on the packet descriptor and sent to the output port, thereby more accurately determining the time to send the packet.
[0072] In the embodiment of the present disclosure, the preset offset advance amount can be configured by the user based on an empirical value or a measured value.
[0073] In some embodiments, the preset time adjustment amount also includes a preset error compensation advance amount, where the preset error compensation advance amount represents the transmission delay between the time the first message arrives at the output port and the time the first message is sent from the switching device. This can eliminate jitter errors caused by buffer accumulation at the output port, thereby more accurately determining the message transmission time.
[0074] In the embodiment of the present disclosure, the preset error compensation advance amount can be fed back by the hardware of the switching device and the error compensation advance amount can be calculated and updated.
[0075] In one possible implementation, the preset time adjustment includes a preset first dwell time, a preset offset advance, and a preset error compensation advance. In this implementation, based on the first timestamp and the preset time adjustment, determining whether the actual expected sending time of the first message is greater than or equal to the current time can be performed using the following formula:
[0076] t in +t hold -t cfg -t back ≥t now ;
[0077] The meanings of the parameters in the formula are as follows:
[0078] t in : first timestamp;
[0079] t hold : The preset first dwell time;
[0080] t cfg : preset offset advance;
[0081] t back : Preset error compensation advance;
[0082] t now: The current time of the exchange device;
[0083] t in +t hold The theoretical expected sending time of the first message;
[0084] t in +t hold -t cfg -t back The actual expected sending time of the first message;
[0085] When the first timestamp and the preset time adjustment amount satisfy the above formula, it can be determined that the first message residence time has been met, and subsequent scheduling can be performed.
[0086] In order to enable those skilled in the art to more clearly understand the technical solutions provided by the embodiments of the present disclosure, the technical solutions provided by the embodiments of the present disclosure are further described below through specific examples:
[0087] Refer to the attached Figure 9 , is a flow chart of another message transmission method provided by an embodiment of the present disclosure. In this embodiment, a switching device is used as Figure 3 Taking the Ethernet switching device in FIG as an example, the Ethernet switching device receives a first message from an upstream device through an upstream sub-device (sub-device 1) and sends the first message through a downstream sub-device (sub-device 3). The preset time adjustment amount includes a preset first dwell time, a preset offset advance amount, and a preset error compensation advance amount. The method includes:
[0088] Step 1: Clock synchronization.
[0089] In this example, global clock synchronization technology is used to achieve clock synchronization between each sub-device included in the Ethernet switching device and the global switching router, and to achieve clock synchronization between the Ethernet switching device and all devices in the transmission network in which it is located.
[0090] Step 2: Timestamp processing.
[0091] In this example, the upstream sub-device receives a first message from an upstream device of the switching device and records the time the first message is received. A determination is made as to whether the first message carries a first timestamp a (indicating the time the first message was sent from the upstream device). If the first message carries the first timestamp a, the first message carrying the first timestamp a is sent to the downstream sub-device via the global switching route. If the first message does not carry the first timestamp a, a first timestamp b is generated based on the recorded time the first message was received (indicating the time the first message was received by the switching device), and the first timestamp b is written into the first message. Furthermore, the first message carrying the first timestamp b is sent to the downstream sub-device via the global switching route. In one possible implementation, the timestamp is carried in the message header.
[0092] Step 3: Cache the first message.
[0093] In this example, the downlink sub-device receives the first message carrying the first timestamp a or the first timestamp b sent by the uplink sub-device through the global switching route, stores the first message in the first cache (i.e., the on-chip / off-chip cache), and records the first storage address of the first message in the first cache.
[0094] The first message may be stored in the first cache in the following manner:
[0095] In this example, after receiving the first message, the first message characteristic parameter of the first message is obtained, and a pre-configured third mapping relationship is obtained, the third mapping relationship being a mapping relationship between the message characteristic parameter and the message type, the message type corresponding to the first message characteristic parameter is determined according to the third mapping relationship, and the message type corresponding to the first message characteristic parameter is determined as the first message type of the first message. Furthermore, after determining the first message type of the first message, a pre-configured first mapping relationship and a second mapping relationship can also be obtained, the first mapping relationship being a mapping relationship between the message type and the scheduling queue, and the second mapping relationship being a mapping relationship between the scheduling queue and the cache, the first scheduling queue corresponding to the first message type is determined according to the first mapping relationship, the cache corresponding to the first scheduling queue is determined according to the second mapping relationship, the cache corresponding to the first scheduling queue is determined as the first cache, and the first message is stored in the first cache.
[0096] It should be noted that pre-initialization configuration is required before implementing this embodiment. The configuration process may include: during the initialization configuration process, after receiving a first message, the downlink sub-device classifies the first message according to the message characteristic parameters, establishes a mapping relationship between the message characteristic parameters and the message type to form a third mapping relationship, establishes a mapping relationship between the message type and the scheduling queue to form a first mapping relationship, establishes a mapping relationship between the scheduling queue and the cache to form a second mapping relationship, and stores different types of messages in different caches according to the mapping relationships.
[0097] Step 4: Generate a message descriptor.
[0098] In this example, the first timestamp may be extracted from the first message, and the message descriptor of the first message may be generated according to the recorded first storage address and the extracted first timestamp.
[0099] Step 5: Scheduling queue selection.
[0100] In this example, according to a preconfigured first mapping relationship, a first scheduling queue corresponding to the message type of the first message of the message descriptor is selected, and the message descriptor is stored in the first scheduling queue.
[0101] Step 6: Dedicated scheduler processing flow.
[0102] In this example, scheduling queues 0 to scheduling queues n are divided into m groups. At the same time, the scheduling queues included in each of the m groups are polled and detected in turn. The timestamp included in the message descriptor of the queue head of the detected scheduling queue is judged to determine whether the timestamp satisfies the following formula:
[0103] t in +t hold -t cfg -t back ≥t now ;
[0104] The meaning and configuration of each parameter in the above formula can be found in the above description and will not be repeated here.
[0105] Refer to the attached Figure 10 , is a schematic diagram of a message descriptor scheduling provided by an embodiment of the present disclosure, in Figure 10 In the process, m groups of scheduling queues are tested in parallel. After polling the scheduling queues in each of the m groups, the message descriptors in each group of scheduling queues that meet the above formula are polled and scheduled. One message descriptor is selected and output to the scheduling queue in each polling. Among them, the parameter t in the above formula for timestamp judgment is back , i.e. the error compensation advance amount, can be calculated and updated in real time by the hardware of the switching device, and the original parameters can be calibrated by the updated parameters.
[0106] In this example, after the message descriptor is output to the scheduling queue, the first message is obtained from the first cache according to the first storage address included in the message descriptor, and the first message is sent.
[0107] Secondly, refer to Figure 11 , an embodiment of the present disclosure provides an electronic device, comprising:
[0108] One or more processors 1101;
[0109] a memory 1102 storing one or more programs, which, when executed by the one or more processors 1101, causes the one or more processors 1101 to implement the first aspect and any possible embodiment of the first aspect;
[0110] One or more I / O interfaces 1103 are connected between the processor 1101 and the memory 1102 and are configured to implement information exchange between the processor 1101 and the memory 1102 .
[0111] Among them, the processor 1101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 1102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read-write interface) 1103 is connected between the processor 1101 and the memory 1102, and can realize information interaction between the processor 1101 and the memory 1102, including but not limited to a data bus (Bus), etc.
[0112] In some embodiments, the processor 1101 , the memory 1102 , and the I / O interface 1103 are connected to each other via a bus 1104 , and further connected to other components of the computing device.
[0113] Thirdly, refer to Figure 12 An embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon. When the program is executed by a processor, the above-mentioned first aspect and any possible embodiment of the first aspect are implemented.
[0114] Those skilled in the art will appreciate that all or some of the steps, systems, and functional modules / units in the apparatus disclosed above may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0115] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation.
[0116] Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH) or other disk storage; compact disc (CD-ROM), digital versatile disc (DVD) or other optical disc storage; magnetic cassettes, tapes, disk storage or other magnetic storage; any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0117] The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A message transmission method, characterized in that: Applied to a switching device, the method includes: Obtaining a first message; wherein the first message carries a first timestamp, the first timestamp indicating a sending time of the first message from the upstream device of the switching device or a receiving time of the first message by the switching device; Storing the first message in a first cache and recording a first storage address of the first message in the first cache; Generate a message descriptor for the first message, and store the message descriptor in a first scheduling queue; wherein the message descriptor includes the first timestamp and the first storage address; Detect the first timestamp included in the message descriptor stored in the first scheduling queue, and when it is determined that the actual expected sending time of the first message is greater than or equal to the current time based on the detected first timestamp and the preset time adjustment amount, output the message descriptor to the first scheduling queue, obtain the first message from the first cache according to the first storage address, and send the first message.
2. The method according to claim 1, characterized in that The storing the first message in the first cache includes: Determining a first message type of the first message according to a first message characteristic parameter of the first message; Obtain a pre-configured first mapping relationship and a second mapping relationship; wherein the first mapping relationship is a mapping relationship between a message type and a scheduling queue, and the second mapping relationship is a mapping relationship between a scheduling queue and a cache; Determine a first scheduling queue corresponding to the first message type according to the first mapping relationship; Determine a cache corresponding to the first scheduling queue according to the second mapping relationship, and determine the cache corresponding to the first scheduling queue as the first cache; The first message is stored in the first cache.
3. The method according to claim 2, characterized in that The determining the first message type of the first message according to the first message characteristic parameter of the first message includes: Obtaining a first message characteristic parameter of the first message; Obtain a pre-configured third mapping relationship, and determine the message type corresponding to the first message characteristic parameter according to the third mapping relationship; wherein the third mapping relationship is a mapping relationship between the message characteristic parameter and the message type; The message type corresponding to the first message characteristic parameter is determined as the first message type.
4. The method according to claim 3, characterized in that The message characteristic parameters include at least one of the following: Source port number; Destination port number; Source Media Access Control MAC address; Destination MAC address; Business type.
5. The method according to claim 1, wherein Detecting the first timestamp included in the message descriptor stored in the first scheduling queue includes: dividing the plurality of first scheduling queues into at least two groups; At the same time, the first scheduling queue included in each of the at least two groups is polled in turn to detect the first timestamp included in the message descriptor stored in the first scheduling queue, so as to determine whether the actual expected sending time of the first message is greater than or equal to the current time based on the detected first timestamp and the preset time adjustment amount.
6. The method according to claim 1, wherein The preset time adjustment amount includes a preset first dwell time; In a case where the first timestamp indicates the sending moment of the first message from the upstream device of the switching device, the first residence time is determined based on a preset first delay and a preset second delay; wherein the preset first delay represents the transmission delay between the receiving moment of the message by the switching device and the sending moment from the switching device, and the preset second delay represents the transmission delay between the sending moment of the message from the upstream device and the receiving moment of the message by the switching device.
7. The method according to claim 1, characterized in that The preset time adjustment amount includes a preset first dwell time; When the first timestamp indicates the reception moment when the first message is received by the switching device, the first residence time is determined according to a preset first delay; wherein the preset first delay represents the transmission delay between the reception moment when the message is received by the switching device and the transmission moment from the switching device.
8. The method according to claim 6 or 7, characterized in that The preset time adjustment amount also includes a preset offset advance amount, wherein the preset offset advance amount represents the transmission delay between the moment when the message descriptor is output from the first scheduling queue and the moment when the first message is obtained according to the message descriptor and the first message is sent to the output port.
9. The method according to claim 8, characterized in that The preset time adjustment amount also includes a preset error compensation advance amount, wherein the preset error compensation advance amount represents the transmission delay between the moment when the first message arrives at the output port and the moment when the first message is sent from the switching device.
10. The method according to claim 1, characterized in that Generating a message descriptor for the first message includes: Obtaining the first storage address; Extracting the first timestamp from the first message; The message descriptor is generated according to the first storage address and the first timestamp.
11. An electronic device, characterized in that: include: one or more processors; a memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 10; One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.
12. A computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.