Detailed Description
In embodiments of the application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In embodiments of the application, the terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature.
The term "at least one" in the present application means one or more, and the term "plurality" in the present application means two or more, for example, a plurality of second messages means two or more second messages.
When the first node performs flow control (flow control is flow control by CFC technology) in the process of sending a message to the second node, the first node maintains a credit (credit) counter for each sending queue, and determines whether the second node is congested with flow by the value of the credit counter, and then stops sending the message when the second node is congested with flow.
Referring to fig. 1, fig. 1 shows a schematic flow diagram of flow control by CFC technology. As shown in fig. 1, taking an Output Queue (OQ) 1 of a first node as an example, a credit counter maintained by the first node for the OQ 1 is a counter 1, and a receive queue (IQ) 1 of a second node is used for receiving a message from the first node OQ 1.
In the first node, regarding any message to be sent, taking a message that the message is OQ 1 as an example, when the first node dispatches the message from OQ 1, the first node calculates a credit value 1 for representing the length of the message according to the length of the message, and accumulates the value of the counter 1 to the credit value 1. The first node then sends the message to the second node via the send interface.
In the second node, for any message to be received, taking that the message needs to be received through IQ 1 as an example, when the second node receives the message through the receiving interface, the second node writes the message into IQ 1 of a receiving buffer. When the second node dispatches the message from the IQ 1, the second node calculates a credit value 2 for representing the length of the message according to the length of the message, and returns the credit value 2 to the first node through a sending interface of the second node. In response, the first node receives the credit value 2 sent by the second node, and decrements the value of the counter 1 by the credit value 2. That is, the counter 1 decrements the credit value that characterizes the length of the buffer outflow message received from the second node.
Thus, by accumulating the credit value used for representing the message length of dequeuing from the OQ schedule and deducting the credit value used for representing the message length of buffer received from the second node, the communication link which dequeues from the OQ schedule and is positioned at the first node and transmits the message to the second node and the message length buffered in the buffer received by the second node can be recorded through the credit counter.
Therefore, when the value of the credit counter exceeds the flow control threshold, the credit counter indicates a communication link between the first node and the second node, and a buffer report Wen Jiaoduo buffered in the second node, so that traffic congestion may be caused in the second node. Under the condition, the first node can stop scheduling and sending the message in the sending queue corresponding to the credit counter, so that credit flow control is carried out through the credit counter in the process that the first node sends the message to the second node.
However, when the credit flow control is performed in the process that the first node sends the message to the second node by the method, when the message sent by the first node to the second node is lost, the second node cannot generate and send a credit value for representing the length of the message to the second node. Or after the second node generates the credit value for representing the message length of the buffer received by the second node, the information is lost when the credit value is sent to the first node.
In this case, the credit counter maintained by the first node cannot be normally deducted, so that credit flow control cannot be effectively performed on the message sent by the first node to the second node through the credit counter. That is, when credit flow control is performed by the credit counter in the process that the first node transmits the message to the second node, reliability is poor.
Based on this, the embodiment of the application provides a data transmission method, which is applied to a first node which transmits a message to a second node through one or more transmission queues. For a first sending queue in a first node, in the process of performing credit flow control on a message of the first sending queue through a first counter, the method sends a reference message for indicating to correct the first counter to a second node through the first node, and corrects the first counter according to a credit value carried in a service message or a credit response message preamble received from the second node.
By automatically correcting the first counter in the credit flow control process based on the counter, the phenomenon that the flow performance is reduced or even blocked caused by the loss of a message sent by the first node or the credit value received by the first node can be avoided, and the reliability of credit flow control based on the first counter is improved. The description of credit flow control based on the counter may refer to the above description, and will not be repeated.
The embodiment of the application also provides a data transmission system which comprises a first node and a second node, and the method provided by the embodiment of the application is applied to the system and is particularly used for correcting the first counter in the process of credit flow control through the first counter when the first node in the system transmits a message to the second node, thereby greatly improving the reliability of credit flow control through the first counter in the process of transmitting the message to the second node by the first node.
The first node and the second node may communicate through any form (e.g., wired or wireless) and/or standard communication link, which is not limited.
Alternatively, the first node and the second node may communicate directly. Or communication between the first node and the second node may also be via one or more transit devices/nodes, without limitation. For simplicity of description, embodiments of the present application will be described below by taking direct communication between a first node and a second node as an example.
Referring to fig. 2, fig. 2 shows a schematic architecture diagram of a data transmission system according to an embodiment of the present application.
As shown in fig. 2, the data transmission system 20 includes a first node 21 and a second node 22.
Wherein the first node 21 may send a message to the second node 22 via ethernet. The first node 21 is able to credit-stream messages sent to the second node 22 by means of the first counter. In addition, in the process of performing credit flow control by the first node 21 based on the first counter, the first counter can be automatically corrected (such as periodically and automatically corrected), so that the reliability is greatly improved when the first node 21 performs credit flow control based on the corrected first counter.
The embodiment of the application also provides a data transmission device which is applied to the first node and the second node in the data transmission system and is used for executing corresponding steps executed by the first node and the second node in the method described in the embodiment of the application.
Alternatively, the first node and the second node may be two chips capable of communication, or two groups of chip assemblies capable of communication, or two network nodes capable of communication, which is not limited.
As an example, the chip capable of communication may be a Network Interface Card (NIC) or the like, and the network node may be a router, a switch, a server, a gateway or the like, which is not limited.
Taking the first node and the second node as chips for communication as an example, referring to fig. 3, fig. 3 shows a schematic hardware structure of a chip according to an embodiment of the present application. As shown in fig. 3, the chip 30 includes a control circuit 31, a communication interface 32, a memory 33, and a flow control module 34, and communication is connected among the control circuit 31, the communication interface 32, the memory 33, and the flow control module 34.
The control circuit 31 is a control portion of the chip 30 for implementing control of various devices, modules, and circuits within the chip 30. For example, the control circuit 31 may be configured to control the transmission buffer of the slave chip 30 to schedule the messages of different transmission queues to the communication interface 32, so as to implement the transmission of the messages. For another example, the control circuit 31 may be configured to control the scheduling of messages from different receive queues of the receive buffer of the chip 30 to a message processing module (e.g., a processor) of the device where the chip is located.
Alternatively, the control circuit 31 may be a general-purpose central processing unit (central processing unit, CPU), an application-specific integrated circuit (ASIC), a micro-processing unit (MPU), or the like, but is not limited thereto.
Communication interface 32 for connecting chip 30 to other chips via a communication network. The communication network may be, but is not limited to, ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
As an example, when the communication network is an ethernet, the communication interface 32 may be a Media Access Control (MAC) interface, not limited thereto. Communication interface 32 includes, without limitation, one or more transmit interfaces (or referred to as transmit ports) for transmitting messages and one or more receive interfaces (or referred to as receive ports) for receiving messages.
To enable control of traffic sent by any one of the communication interfaces 32, the chip 30 may configure the transmission interface with a plurality of transmission queues (i.e., OQs as described above) having different priorities. In this way, the control circuit 31 can control the transmission interface to transmit the messages in different transmission queues in a time-division multiplexing manner according to the priority of each transmission queue. Here, the transmission queues with different priorities may be used to transmit service packets with different transmission priority requirements.
The priority of the sending queue is used for indicating the priority degree of dispatching the messages in the sending queue to the sending interface. It should be understood that after the message is scheduled to the transmitting interface, the message can be transmitted by the transmitting interface through the communication network. Therefore, the priority of the transmission queue can also be understood as the priority of transmitting the message in the transmission queue through the transmission interface.
For example, the messages in the transmission queue with the highest priority are scheduled to be dequeued to the transmission interface in sequence, and after all the messages in the transmission queue with the highest priority are scheduled to be dequeued, the messages in the transmission queue with the next highest priority are scheduled to be dequeued to the transmission interface in sequence, and so on. For another example, the scheduling frequency of dequeuing a message in the transmission queue with the highest priority to the transmission interface is the highest, and the scheduling frequency of scheduling a message in the transmission queue with the lowest priority to the transmission interface is the lowest. Etc., not limited thereto.
It should be understood that, when a first node having the hardware structure shown in fig. 3 configures a plurality of transmission queues for a certain transmission interface, for a reception interface of the chip 30 connected to the transmission interface through a communication network and serving as a second node, the reception interface is configured with a reception queue corresponding one-to-one to the transmission queue configured by the transmission interface of the first node. And, the transmission queue and the reception queue having the correspondence have the same priority.
As an example, a transmit queue and a receive queue having a correspondence relationship may be marked by setting the same queue identification (e.g., a queue number).
The memory 33 includes a transmission buffer for temporarily storing a message to be transmitted, which is to be transmitted by the transmission interface of the chip 30, and a reception buffer for temporarily storing a message received by the reception interface.
Alternatively, a plurality of transmit queues configured by a certain transmit interface in the chip 30 may share the transmit buffer, or each transmit queue corresponds to a dedicated segment of transmit buffer, which is not limited thereto.
Alternatively, a plurality of receiving queues configured by a certain receiving interface in the chip 30 may share the receiving buffer, or each receiving queue corresponds to a dedicated section of receiving buffer, which is not limited.
Further, the control circuit 31 can access the transmission buffer and the reception buffer. The control circuit 31 may schedule the packets of different transmit queues in the transmit buffer to be dequeued to the transmit interface according to the priority of the transmit queues. The control circuit 31 may also determine a corresponding receive queue according to the packet received by the receive interface, and write the received packet into the receive queue in the receive buffer. Then, the control circuit 31 may dispatch the messages of the different receive queues to the message processing module of the device where the chip 30 is located based on the priorities of the different receive queues. The message is scheduled to be dequeued from the receiving queue, and can be understood as the message flows out from the receiving buffer.
The process how the message is scheduled to the corresponding sending queue and the process how the received message is written to the corresponding receiving queue are not described in detail in the embodiments of the present application.
The flow control module 34 is configured to perform flow control (e.g. instruct to start or stop sending the message) during the process of sending the message from the chip 30 to other chips.
The flow control module 34 includes a first counter configured for credit flow control for each transmission queue requiring credit flow control with the transmission queue of the chip 30 as granularity, and a second counter configured for correcting each first counter, so that the second counter can be used to implement correction of the first counter.
Wherein, a first counter is correspondingly configured for a sending queue needing credit flow control. A first counter may be configured with a second counter. Or a plurality of first counters configured for a plurality of transmission queues under the same transmission interface may be configured with a second counter correspondingly. When one second counter is configured corresponding to a plurality of first counters configured for a plurality of transmission queues under the same transmission interface, correction of the plurality of first counters can be achieved by time-division multiplexing the second counter.
In other words, when the plurality of transmit queues under any of the transmit interfaces of the chip 30 all need credit flow control, the chip 30 may maintain a first counter for credit flow control for each of the plurality of transmit queues. That is, the chip 30 maintains a plurality of first counters for a plurality of transmit queues under the transmit interface. In this case, the embodiment of the present application does not particularly limit the number of second counters configured to the chip 30 for correcting the plurality of first counters.
Alternatively to this, the method may comprise, the chip 30 may be configured with a second counter for correcting the plurality of first counters. In this case, correction of the plurality of first counters may be achieved by time-multiplexing the second counters.
For example, the chip 30 maintains 4 first counters for flow control for 4 transmit queues under the transmit interface 1, and maintains 1 second counter for correction of the 4 first counters. The second node may correct the 1 st first counter by the second counter during period 1, the 2 nd first counter by the second counter during period 2, the 3 rd first counter by the second counter during period 3, and the 4 th first counter by the second counter during period 4.
Alternatively, the chip 30 may also be configured with a second counter for each first counter for correcting the first counter. That is, the number of the first counters is the same as the number of the second counters, and corresponds one by one.
It should be appreciated that for a transmit queue, such as a first transmit queue, where any one of the chips 30 needs to be subject to flow control, when the chip 30 configures a first counter for the first transmit queue, the first counter is used to subject to flow control during the process of transmitting a message through the first transmit queue (e.g., to indicate to start or stop transmitting a message through the first transmit queue). Specific functions may refer to the description of the credit counter above, and will not be repeated. When the first counter needs to be corrected, the chip 30 is further configured with a second counter, where the second counter is used to implement correction on the first counter, so as to improve reliability of credit flow control based on the first counter in a process that the chip 30 sends a message through the first sending queue. The first counter and the second counter may be described in more detail with reference to the following description, which is not repeated here.
In addition, when the first node having the hardware structure shown in fig. 3 is configured with the first counter described above for the first transmit queue and is configured with the second counter for correcting the first counter, for the chip 30 (or referred to as the second node) that receives the first transmit queue packet from the first node through the first receive queue, the flow control module 34 of the chip 30 further includes a third counter configured for corresponding to the first receive queue and includes a fourth counter configured for corresponding to the third counter, and the third counter and the fourth counter are used together to assist in correcting the first counter configured for the first transmit queue in the first node. Wherein a receiving queue is correspondingly provided with a third counter. A third counter may be configured to a fourth counter, or a plurality of third counters configured for a plurality of receive queues under the same receive port may be configured to a fourth counter, which is not limited. The third counter and the fourth counter may be used in more detail with reference to the following description of the method, and will not be described here.
Alternatively, any counter (such as the first counter, the second counter, the third counter, or the fourth counter, etc.) of the flow control module 34 may be a hardware circuit capable of implementing a counter function, which is not limited thereto. And, the counter in the flow control module 34 performs an update operation based on the system clock frequency of the chip 30. Each update operation of the counter may be referred to as a beat. In other words, the frequency of the counter update operation is the same as the system clock frequency of the chip 30.
It should be noted that the chip configuration shown in fig. 3 does not constitute a limitation of the chip 30, and that the chip 30 may include more or less components than those shown in fig. 3, or may combine some components, or may be arranged differently, in addition to those shown in fig. 3.
The data transmission method provided by the embodiment of the application is described below with reference to the accompanying drawings.
Specifically, when the first node transmits a message to the second node through one or more transmission queues, for simplicity of description, in the following embodiments of the present application, the first node is configured with a first counter for performing credit flow control on a first transmission queue of the one or more transmission queues, and is configured with a second counter for implementing correction on the first counter.
In addition, it is assumed that the receiving queue for receiving the message in the first sending queue of the first node is the first receiving queue of the second node, and the second node is configured with the third counter for the first receiving queue and the fourth counter for the third counter. The first receiving queue of the second node may also be referred to as a receiving queue having a corresponding relationship with the first transmitting queue of the first node.
In this case, referring to fig. 4a, fig. 4a shows a flow chart of a data transmission method according to an embodiment of the present application. Alternatively, the method is applied to the data transmission system shown in fig. 2, and the corresponding steps are performed by the first node and the second node having the hardware structure shown in fig. 3.
As shown in fig. 4a, the data transmission method provided by the embodiment of the application includes the following steps:
s101, a first node sends a reference message to a second node, wherein the reference message is used for indicating to correct the first counter.
The detailed description of the reference message and the first counter, and the detailed description of the first node determining the reference message may refer to the following description in S201, which is not repeated. The detailed description of the first node sending the reference message to the second node may refer to the following description of S203, which is not repeated.
S102, the second node receives a first message from a first sending queue.
The second node receives the first message from the first sending queue, which may be described in S204 below, and will not be described in detail.
S103, the second node responds to the first message as a reference message, and transmits a service message or a credit response message to the first node, wherein a preamble in the service message or the credit response message carries a credit value, and the credit value is used for correcting the first counter.
The credit value carried by the preamble in the service message or the credit response message is used for representing the length of the message flowing out of the buffer received from the second node.
The detailed description of the second node determining the credit value, the detailed description of the service message or the credit response message carrying the credit value, and the detailed description of the service message or the credit response message carrying the credit value to the first node by the second node in response to the first message being the reference message may refer to the following descriptions of S206-S208, and will not be repeated.
S104, the first node receives the service message or the credit response message returned by the second node.
Further, the first node corrects the first counter based on the credit value carried by the service message or the credit response message preamble received from the second node.
The detailed description of the first node correcting the first counter based on the credit value carried by the service message or the credit response message preamble may refer to the following description of S209, which is not repeated.
By the method of S101-S104, the counter can be automatically corrected in the process of credit flow control of the message sent by the first node through the counter, so that the reliability of credit flow control of the message sent by the first node through the counter is greatly improved.
In other embodiments, referring to fig. 4b, fig. 4b is a schematic flow chart of another data transmission method according to an embodiment of the present application. Alternatively, the method is applied to the data transmission system shown in fig. 2, and the corresponding steps are performed by the first node and the second node having the hardware structure shown in fig. 3.
As shown in fig. 4b, the data transmission method provided by the embodiment of the application includes the following steps:
S201, when a message to be transmitted, which is dequeued from a first transmission queue of a first node, is scheduled as a reference message, the first node updates the value of a first counter according to the reference message.
The reference message is a message for indicating to correct the first counter. The first counter is used for credit flow control in the process that the first node sends the message to the second node through the first sending queue, for example, the first counter indicates to start or stop sending the message to the second node through the first sending queue.
The first counter is specifically configured to record a length of a message scheduled out of the first transmit queue. The message which is scheduled to be dequeued from the first sending queue comprises a communication link which is positioned in the first node and used for transmitting the message to the second node and a message which is cached in the second node and used for receiving the buffer. Alternatively, it is understood that the value of the first counter is used to characterize the length of messages scheduled out of the first transmit queue. The value of the first counter is specifically a credit value that characterizes the length of the message scheduled out of the first transmit queue. In other words, the first counter records the current occupation condition of the buffer received by the second node in real time through the credit value corresponding to the message length.
Specifically, the first node may determine, as the reference message, a message to be transmitted that is scheduled out of the first transmit queue.
The message to be sent may be a service message that needs to be sent through the first sending queue of the first node, or a sample message that is specially used for correcting the first counter, which is not limited.
Alternatively, the first node may randomly determine the message to be transmitted, which is scheduled out of the first transmit queue, as the reference message.
Alternatively, the first node may periodically determine, as the reference message, a message to be transmitted that is scheduled out of the first transmit queue. The period duration is not particularly limited in the embodiment of the present application.
Alternatively, the first node may determine, as the reference message, a message to be transmitted scheduled out of the first transmit queue in response to the correction instruction. The correction instruction may be a correction instruction issued by the processor of the first node, or a correction instruction input by the user received by the first node, which is not limited.
It should be understood that, for each reference message determined by the first node, the embodiments of the present application execute S202 to S209 described below to implement correction of the first counter. In this way, when the first node periodically determines the message to be sent, which is scheduled and dequeued from the first sending queue, as the reference message, the embodiment of the application can automatically and periodically correct the first counter through the periodically determined reference message, thereby improving the reliability of credit flow control through the first counter in the process that the first node sends the message through the first sending queue.
Further, the first node updates the value of the first counter according to the determined reference message.
Specifically, the first node may determine, according to the length of the reference message and the bit width of the buffer received by the second node, a first credit value for characterizing the length of the reference message.
Specifically, the first node may obtain the first credit value representing the length of the reference message by rounding (e.g., rounding up) the quotient of the length of the reference message and the buffer bit width received by the second node. As an example, assuming that the length of the reference message is cfc_ Plength and the bit width of the buffer received by the second node is 160 bytes (B), the first credit value=blocking (cfc_ Plength/160,1) characterizing the length of the reference message. Wherein Ceiling (CFC_ Plength/160,1) represents rounding up the quotient of CFC_ Plength/160.
The bit width of the buffer received by the second node for calculating the first credit value can be regarded as a credit unit when calculating the credit value. Optionally, when calculating the credit value, the credit unit may be the actual buffer bit width received by the second node, or may be an integer multiple of the buffer bit width actually received by the second node, or may be any preset value that is negotiated in advance by the first node and the second node.
It should be understood that the bit width of a buffer refers to the data width (or referred to as the data length) of a single access buffer, and the bit width of a buffer may be generally an integer multiple of 32 bytes (B), since the smallest bit width unit when designing a chip buffer may be 32B, although the invention is not limited thereto.
The length of the reference message used for calculating the first credit value refers to the message length when the reference message is buffered in the second node to receive the buffer.
It should be appreciated that since some buffers may be configured such that when a message is written to a buffer, a static extension header is added to the message to facilitate buffer identification and/or operation, and then the message with the added static extension header is written to the buffer. In this case, when the receiving buffer of the second node is a buffer of this type, when calculating the credit value representing a certain message length, in order to ensure that the credit values calculated by the first node and the second node are the same (in the subsequent step, the second node needs to calculate the credit value for the message buffered in the receiving buffer), the first node calculates the credit value representing the message length, and the message length adopted by the first node is the actual length of the message+the length of the static extension header added for the message when the second node buffers the message, that is, the message length adopted by the first node calculates the credit value representing the message length is the length when the message is buffered in the second node. That is, the credit value used for representing the message length described in the context of the present application is actually used for representing the buffer depth occupied when the message is buffered in the receiving buffer.
Optionally, when determining the length of the reference packet, the first node may obtain the total length of the IP data packet of the reference packet by reading a total length field carried by an internet protocol (internet protocol, IP) header in the reference packet and used for recording the total length of the IP data packet. Then, the first node adds a certain offset based on the total length of the IP data packet, so as to obtain the length of the reference message buffered when the second node receives the buffer. Wherein, the offset includes the length of the outer layer header of the reference message IP data packet.
For example, assuming that the IP packet is a three-layer packet of the reference packet, the reference packet further includes a two-layer header (e.g., a MAC header) and a one-layer header (e.g., a virtual local area network (virtual local area network, VLAN) header) located on an outer layer of the three-layer IP header. Optionally, when the second node receives the buffer packet, the static extension header needs to be added to the packet, and the offset further includes the length of the static extension header configured by the second node to receive the buffer.
Illustratively, assuming that the reference message is an internet protocol version 4 (internet protocol version, ipv 4) message, the reference message length=length+offset indicated by the total length field in the IP header. Assuming an internet protocol version 6 (internet protocol version, IPv 6) message when referring to the message, the reference message length=the length indicated by the total length field in the IP header+the IPv6 header length+the offset. The IPv6 header length is generally 40B.
Optionally, the parameters such as the bit width and the offset of the buffer received by the second node used for calculating the first credit value may be obtained from the second node when the first node negotiates CFC capability with the second node, which is not limited.
Wherein the process of negotiating CFC capabilities with the second node by the first node may comprise:
Step 1, a first node sends a CFC capability request message to a second node before sending the message to the second node.
The CFC request message is used for determining whether the second node supports CFC capability, and requesting to acquire CFC capability information of the second node when the second node supports CFC capability. The CFC capability information is used for credit flow control of the message sent to the second node, and the CFC capability information may include one or more of a size of a second node receiving buffer, a bit width of the second node receiving buffer, a receiving queue supporting CFC in the second node, or an offset.
The second node receives the buffer size and is used for the first node to set a flow control threshold of the first counter for credit flow control, so that the first node can flow control the message to be sent in the first sending queue according to whether the value of the first counter exceeds the flow control threshold.
The offset is used to determine the message length required to calculate the message credit. The second node receives the bit width of the buffer and the message length calculated based on the offset, and uses the calculated message length to calculate the credit value of the message.
The CFC-capable receive queues in the second node are used by the first node to determine which receive queues in the second node support CFC capabilities.
Thus, when the second node does not support the CFC capability, the second node cannot identify the CFC request message after receiving the CFC request message sent by the first node, so that the second node can discard the CFC request message.
When the second node supports CFC capability, the second node may execute step 2 after receiving the CFC request packet sent by the first node.
And 2, the second node recognizes and responds to the CFC request message, and transmits a CFC capability response message carrying self CFC capability information to the first node.
Specifically, the second node may read the size and bit width of the self-receiving buffer from the self-configuration information, and determine the queue number of the self-supporting CFC receive queue. The second node may also determine an outer header length of the IP header of the message transmitted between the second node and the first node based on a communication mode adopted when the second node communicates with the first node, and optionally, the second node may determine the static extension header length based on a configuration of receiving buffers. And then, the second node calculates the offset according to the determined outer layer header length and static extension header length of the IP header. Furthermore, the second node carries CFC capability information including the size and bit width of the self-receiving buffer, the queue number of the self-supporting CFC receiving queue, and the offset in a CFC capability response message, and sends the CFC capability response message to the first node.
In response, the first node receives the CFC capability response message of the second node, thereby obtaining the bit width of the buffer received by the second node and the offset used for determining the message length required for calculating the credit value.
Thus, the first node can calculate the length of the reference message cached in the second node when receiving the buffer according to the offset, and square the quotient of the length and the bit width of the buffer received by the second node, thereby obtaining the first credit value representing the length of the reference message.
Further, the first node accumulates the current value of the first counter with the first credit value to complete updating of the value of the first counter when the timer is started.
It can be seen that the updated value of the first counter is the sum of the current value and the first credit value. For example, assuming that the current value of the first counter is 5 and the first credit value is 3, the updated value of the first counter is 5+3=8.
Wherein each time the first counter of the first node performs an update operation comprising an accumulation and/or a subtraction, based on the same frequency as the system clock of the first node, is referred to as a beat. The beat is the update operation currently executed by the first counter.
Alternatively, when the value of the first counter is updated at the time of the beat, the first node may include a second credit value returned by the second node and not used for the deduction operation. The second credit value is specifically used for characterizing the length of one or more messages from the first sending queue of the first node, which flows out from the second node. The number of second credit values may be one or more. For example, a message from the first transmit queue of the first node that receives buffer flow from the second node may correspond to a second credit value.
Here, the detailed process of the second node returning the second credit value to the first node may refer to the description of the second node returning the credit value to the first node described in S207 or S208, which is not described herein.
Thus, when the first node further includes the second credit value, when the value of the first counter is updated:
In one possible implementation manner, the first node firstly accumulates the current value of the first counter to a first credit value, and then deducts the value of the first counter accumulated with the first credit value by a second credit value, thereby completing updating the value of the first counter when the current value is taken. It can be seen that the updated current value of the first counter is the sum of the current value and the first credit value, and the difference value between the updated current value and the second credit value. As an example, assuming that the current value of the first counter is 5, the first credit value is 3, and the second credit value is 4, the updated value of the first counter=5+3-4=4.
In another possible implementation manner, the first node firstly deducts the current value of the first counter by the second credit value, and then accumulates the value of the first counter after deducting the second credit value by the first credit value, so as to complete updating of the value of the first counter when clapping. It can be seen that the updated value of the first counter is the sum of the difference between the current value and the second credit value and the first credit value. As an example, assuming that the current value of the first counter is 5, the first credit value is 3, and the second credit value is 4, the updated value of the first counter=5-4+3=4.
In addition, it should be noted that, when the first node performs credit flow control based on the first counter in the process of sending the message through the first sending queue, the first node updates (including accumulating and/or deducting) the value of the first counter according to the message when one message is dequeued from the first sending queue.
It can be seen that the updating operation performed on the first counter includes an accumulating operation performed on the value of the first counter after the packet in the first transmission queue is scheduled to be dequeued, and a deducting operation performed on the value of the first counter after the packet in the first transmission queue receives the buffer from the second node. In this way, the credit value recorded by the first counter can be used for characterizing the communication link which is currently scheduled and dequeued from the first sending queue and is positioned in the first node to transmit the message to the second node and the message length cached in the second node to receive the buffer in real time. In other words, the credit value recorded by the first counter can reflect the buffer usage of the second node for buffering the receiving buffer from the first transmit queue in real time.
S202, the first node controls the second counter to acquire the updated value of the first counter.
The second counter is specifically configured to indicate whether the reference packet flows out from a receiving buffer of the second node that receives the reference packet.
Specifically, after the second counter obtains the updated value of the first counter, when the value of the second counter is updated to 0, it indicates that the reference message has flowed out from the receiving buffer of the second node. When the value of the second counter is greater than 0, it indicates that the reference message is still buffered (or referred to as stay in) the receiving buffer of the second node. The update process of the second counter may refer to the following description of S209, which will not be repeated,
Optionally, after updating the value of the first counter according to the reference message, the first node may send a sampling instruction to the first counter, so as to instruct the first counter to send the updated value to the second counter. Then, the second counter may acquire the value of the updated first counter, and set its own value to the acquired value.
Optionally, after updating the value of the first counter according to the reference message, the first node may send a sampling instruction to the second counter, so as to instruct the second counter to read the value updated by the first counter, and set the value of the second node to the read value.
S203, the first node sends a reference message to the second node.
Specifically, the first node first adds a reference mark to a reference message scheduled to be dequeued from the first transmit queue. The reference mark is used for identifying that the current message is a reference message and indicating a second node receiving the reference message to control a fourth counter to acquire the value of a third counter.
The third counter is a counter configured for the second node for receiving the first receiving queue packet from the first sending queue packet, and the fourth counter is a counter configured for the third node by the second node.
Specifically, the value of the third counter is used for representing the message length of the buffer received by the second node and coming from the first transmission queue, and the value of the third counter is specifically used for representing the credit value of the message length of the buffer received by the second node and coming from the first transmission queue. It can be seen that the value of the third counter can reflect the usage of the receiving buffer in the second node for buffering the message from the first transmit queue in real time.
The fourth counter is used for indicating whether the reference message received by the second node flows out from the receiving buffer of the second node. Thus, after the fourth counter obtains the value of the third counter, when the value of the fourth counter is updated to 0, it indicates that the reference message has flowed out from the receiving buffer of the second node. When the value of the fourth counter is greater than 0, it indicates that the reference message is still buffered (or referred to as stay in) the receiving buffer of the second node. The fourth counter may refer to the description of S206 when acquiring the value of the third counter, and the update process of the fourth counter may refer to the related descriptions of S207-S208, which are not described herein.
Alternatively, the first node may add a reference mark in a preamble (preamble) of the reference message. The detailed description of the reference mark carried by the preamble of the message can refer to the description of the preamble of the message provided by the embodiment of the application, and the description is not repeated.
The first node then schedules the reference message with the added reference mark to a transmission interface of the first node (e.g., a transmission interface in the communication interface shown in fig. 3) so that the transmission interface transmits the reference message with the added reference mark to the second node through the communication network. The form and/or the format of the communication network are not particularly limited in the embodiments of the present application.
S204, the second node receives the first message from the first sending queue of the first node.
The first message is any message received by the second node from a first sending queue of the first node. For example, the first message may be the reference message described above.
Specifically, the second node may receive the first packet from the first transmit queue of the first node through a receive interface (e.g., a receive interface of the communication interface shown in fig. 3). Wherein, the receiving interface establishes communication connection with the sending interface of the first message sent by the first node.
S205, the second node updates the value of the third counter according to the first message.
The details of the third counter may be referred to the above description, and will not be described herein.
Specifically, after receiving the first message, the second node determines a third credit value according to the length of the first message and the bit width of the buffer received by the second node. The third credit value is used to represent the length of the first message, or it is understood that the third credit value is used to represent the buffer depth occupied by the first message when the second node receives the buffer.
The second node determines the third credit value according to the length of the first message and the bit width of the buffer received by itself, which may refer to the description that the first node determines the first credit value according to the length of the reference message and the bit width of the buffer received by the second node in S201, and will not be described again.
Further, the second node accumulates the current value of the third counter by the third credit value to complete the update of the value of the third counter when the timer is started. It can be seen that the value of the updated third counter is the sum of the current value and the third credit value. For example, assuming that the current value of the third counter is 10 and the third credit value is 5, the updated value of the third counter is 10+5=15.
Optionally, when the third counter is updated in time, the second node may further include a fourth credit value calculated based on a length of the message from the first transmit queue flowing from the self-receiving buffer and not used for the deduction operation. That is, the fourth credit value is used to characterize the length of one or more messages from the first transmit queue flowing from the second node to receive the buffer, or it is understood that the fourth credit value is used to characterize the buffer depth occupied by the one or more messages when buffered in the receive buffer. The number of fourth credit values may be one or more. For example, a message from the first transmit queue of the first node that receives buffer flow from the second node may correspond to a fourth credit value.
Here, the second node determines the detailed description of the fourth credit value according to the length of one or more messages from the first transmit queue flowing from the self-receiving buffer, and reference may be made to the following description of determining the credit value of the second message according to the second message in S207, which is not described herein.
Thus, when the second node further includes the fourth credit value, the third counter is updated when the value is taken:
in a possible implementation manner, the second node firstly accumulates the current value of the third counter by the third credit value, and then deducts the value of the third counter accumulated by the third credit value by the fourth credit value, thereby completing the update of the value of the third counter when the timer is started. It can be seen that when the updated third counter is added to the current value and the third credit value, the difference is compared with the fourth credit value. As an example, assuming that the current value of the third counter is 10, the third credit value is 5, and the fourth credit value is 2, the updated value of the third counter=10+5-2=13.
In another possible implementation manner, the second node firstly deducts the current value of the third counter by the fourth credit value, and then accumulates the value of the third counter after deducting the fourth credit value by the third credit value, so as to complete updating of the value of the third counter when clapping. It can be seen that the updated value of the third counter is the sum of the difference between the current value and the fourth credit value and the third credit value. As an example, assuming that the current value of the third counter is 10, the third credit value is 5, and the fourth credit value is 2, the updated value of the third counter=10-2+5=13.
It can be seen that the update operation performed on the third counter includes an accumulation operation performed on the third counter before the message from the first transmit queue is written into the second node to receive the buffer, and a deduction operation performed on the third counter after the message Wen Liuchu from the first transmit queue receives the buffer. In this way, the credit value recorded by the third counter can be used for representing the length of the message which is currently buffered in the second node receiving buffer and comes from the first sending queue in real time. In other words, the credit value recorded by the third counter can reflect the buffer usage of the second node for buffering the receiving buffer from the first transmit queue in real time.
S206, responding to the first message as the reference message, and controlling the fourth counter by the second node to acquire the updated value of the third counter.
Specifically, the second node determines whether the received first message carries a reference mark. When the second node determines that the first message carries the reference mark, the first message is the reference message carrying the reference mark. In this case, the second node responds to the reference mark carried by the first message and controls the fourth counter to acquire the updated value of the third counter. Thus, the value of the fourth counter is the same as the value of the updated third counter.
The reference signs, the third counter and the fourth counter may be described in detail with reference to the above description, and will not be repeated. The process of the second node controlling the fourth counter to obtain the updated value of the third counter may refer to the description of the process of the first node controlling the second counter to obtain the updated value of the first counter in S202, which is not repeated.
Further, the second node writes the first message into a receiving buffer for receiving a first receiving queue from the first sending queue message.
In one example, the first packet carries a queue identifier of the first sending queue, and the second node pre-stores a correspondence between the sending queue and the receiving queue, so that the second node queries the correspondence based on the queue identifier of the first sending queue, and can determine the first receiving queue for receiving the first packet. The second node then writes the first message to the first receive queue.
S207, the second node updates the value of the fourth counter.
The second node updating the value of the fourth counter includes that after the fourth counter obtains the value of the third counter, the second node deducts the value of the fourth counter according to each message which flows out from the receiving buffer (or is understood to be scheduled out from the first receiving queue) and comes from the first sending queue. And stopping the deduction operation after the value deduction of the fourth counter is 0.
When the first node performs credit flow control based on the first counter in the process of sending the message through the first sending queue, and the method provided by the embodiment of the application is adopted to automatically correct the first counter, the second node also deducts the value of the third counter according to each message which flows out from the self receiving buffer and comes from the first sending queue in the process of performing credit flow control based on the first counter. It should be understood that "each message from the first transmit queue and out of the receive buffer itself" as described herein includes each message from the first transmit queue and out of the receive buffer of the second node within the target period. The target period is a period from the time when the value of the third counter is acquired by the fourth counter to the time when the value button of the fourth counter is reduced to 0.
The following describes a process of deducting the values of the fourth counter and the third counter by the second node, taking the second message as an example, where any message that flows from the receiving buffer of the second node and comes from the first sending queue in the target period. The process may include the steps of:
and step 1, the second node determines the credit value of the second message according to the length of the second message.
The credit value of the second message is used for representing the length of the second message, or understood that the credit value of the second message is used for representing the buffer depth occupied when the second message is buffered in the second node to receive the buffer.
The process that the second node determines the credit value of the second message according to the length of the second message and the bit width of the buffer received by the second node may refer to the process that the first node determines the first credit value according to the length of the reference message and the bit width of the buffer received by the second node in S201, which is not described herein.
And 2, the second node deducts the credit value of the second message from the value of the fourth counter.
When the second message from the first sending queue receives the buffer from the second node and flows out in the target period, the second node deducts the value of the fourth counter by the credit value of the second message, so that the second node can determine whether the reference message has flowed out from the receiving buffer of the second node according to whether the value of the fourth counter subtracted is 0.
And 3, the second node deducts the credit value of the second message from the value of the third counter.
When the second message from the first sending queue receives the buffer from the second node, the second node deducts the credit value of the second message by the value of the third counter, thereby realizing the purpose of updating the third counter for recording the message length from the first sending queue, which is buffered in the second node receiving buffer, in real time based on the message flowing out of the second node receiving the buffer.
In the embodiment of the present application, the execution sequence of step 2 and step 3 is not limited, for example, step 2 may be executed first, then step 3 may be executed, or step 3 may be executed first, then step 2 may be executed, or step 2 and step 3 may be executed simultaneously.
It can be seen that the updating operation performed on the fourth counter only includes the deduction operation performed on the value of the fourth counter according to the message from the first sending queue, which flows out from the second node in the target period. In this way, whether the current reference message flows out from the receiving buffer of the second node can be determined by whether the value of the fourth counter after the current deduction credit value is 0.
Further, the second node also returns the credit value of the message to the first node, that is, returns the credit value for updating the fourth counter (or the third counter) to the first node after determining the credit value of the message according to the message length from the self-receiving buffer. For example, after determining the credit value of the second message according to step 1, the second node also returns the credit value of the second message to the first node. The credit value returned by the second node to the first node is used for updating the value of the first counter and the value of the second counter by the first node, and the detailed description can refer to the related description of S209 below, which is not repeated.
Specifically, the second node may return a message/packet including the credit value to the first node through a transmission interface (e.g., a transmission interface in the communication interface shown in fig. 3), which is not limited.
It should be noted that, when the second node receives the reference message and controls the fourth counter to obtain the updated value of the third counter in response to the reference message, one or more messages may be cached in the first receiving queue of the second node receiving buffer. Thus, in the above-mentioned target period, the second node performs the processes of steps 1-3 above for each packet scheduled out of the first receiving queue (or understood as each packet sent out by the second node by receiving buffer), and returns the credit value determined each time step 1 is performed to the first node, so that the first node updates the values of the first counter and the second counter according to the credit value returned by the second node.
Optionally, when the second node needs to return the credit value to the first node, the second node sends a service message or a credit response message to the first node, where the service message or the credit response message is used to carry the credit value that the second node needs to return to the first node. The credit response message is a message which is generated when the second node needs to return the credit value to the first node and is specially used for carrying the credit value.
It may be appreciated that when the second node needs to return the credit value to the first node, no service message to be sent to the first node in the second node may generate a credit response message for carrying the credit value. Of course, the second node may also generate the credit response message for carrying the credit value immediately when the credit value needs to be returned to the first node, without determining whether there is a service message to be sent to the first node currently.
In the embodiment of the application, a CFC message for carrying credit flow control related information is defined, and the credit response message is one of the CFC messages. Specifically, the embodiment of the application indicates whether the current message is a CFC message by multiplexing a Destination MAC (DMAC) field, a Type/Length (Type/Length) field and an operation code (Opcode) field in a message MAC frame structure.
The CFC message also includes a type field. In the embodiment of the application, the CFC message indicates the specific application of the current CFC message through different values of the type field.
For example, when the value of the type field in the CFC message is 0, it indicates that the current CFC message is a CFC capability request message for requesting to acquire CFC capability information. When the value of the type field in the CFC message is 1, it indicates that the current CFC message is a CFC capability response message carrying CFC capability information. When the value of the type field in the CFC message is 3, it indicates that the current CFC message is a credit response message for carrying a credit value. The details of the CFC capability request message and the CFC capability response message may refer to the descriptions related to S201 above, and are not repeated here.
Referring to fig. 5, fig. 5 schematically illustrates a structure of a credit response packet according to an embodiment of the present application. The rows of the table shown in fig. 5 represent bytes and column columns of bits (bits).
As shown in fig. 5, byte 0 to byte5 in the credit response message MAC frame is a DMAC field, byte 6 to byte 11 is a Source MAC (SMAC) field, byte 12 to byte 13 is a Type/Length field, byte 14 to byte 15 is an Opcode field, byte16 is a Type (MsgType) field, byte 17 to byte 19 is a reserved field, byte 20 to byte59 is a padding (pad) field, and byte 60 to byte 63 is a frame check sequence (FRAMECHECK SEQUENCE, FCS) field.
The details of DMAC field, SMAC field, type/Length field, opcode field, msgType field, and FCS field are not described here. In addition, in the embodiment of the present application, the reserved field and the pad field in the MAC frame of the credit response packet are not particularly defined, and may be filled with 0.
As shown in FIG. 5, the embodiment of the present application may set the value of the DMAC field in FIG. 5 to 0x01-80-C2-00-00-01, the value of the Type/Length field to 0x9999/User definition, and the value of the Opcode field to 0x0909, so that the current message may be identified as a CFC message. In addition, the embodiment of the present application may set the value of MsgType field in fig. 5 to 3, so as to indicate that the current CFC message is a credit response message.
Further, optionally, for the service message or the credit response message for carrying the credit value, the service message and the credit response message may carry the credit value through a message preamble. The detailed description of the message preamble carrying the credit value may refer to the description of the message preamble provided in the embodiment of the present application, and will not be repeated.
S208, when the value of the fourth counter is updated to 0, the second node returns a reference end mark to the first node and the credit value deducted when the value of the fourth counter is updated to 0.
The second node may return a message/packet including the reference end flag and the credit value deducted when the value of the fourth counter is updated to 0 to the first node through a transmission interface (for example, a transmission interface in the communication interface shown in fig. 3), which is not limited.
Specifically, the reference end mark and the credit value deducted when the value of the fourth counter is updated to 0 are used for correcting the first counter configured for the first transmission queue in the first node.
More specifically, the credit value deducted when the value of the fourth counter is updated to 0 is used for updating the value of the first counter and the value of the second counter of the first node. The reference end mark is used for indicating that the reference message received by the second node from the first node has flowed out of the receiving buffer of the second node, so that the reference end mark can be used for indicating the first node to correct the value updated by the first counter based on the value updated by the second counter. The detailed process may refer to the following description of S209, which is not repeated here.
It should be understood that, when the value of the fourth counter is decremented to 0, it indicates that the reference packet received by the second node has already flowed out of the receiving buffer (or that the second node schedules the reference packet out of the first receiving queue of its own buffer). In this case, the second node returns a reference end-marker to the first node.
In one possible implementation manner, for the credit value determined by the second node according to the message currently flowing out of the self-receiving buffer and coming from the first sending queue, if the second node deducts the value of the fourth counter according to the credit value, the value of the fourth counter is just 0 (refer to S207 for a specific process).
In this case, the second node returns the complete credit value of the fourth counter when the timer is subtracted (i.e., the credit value determined by the second node according to the message currently flowing out of the receiving buffer and coming from the first sending queue) and the reference end mark to the first node, so that the first node subtracts the value of the first counter and the value of the second counter according to the credit value returned by the second node, and corrects the subtracted first counter based on the subtracted value of the second counter in response to the reference end mark.
However, since the message of the first receive queue in the second node is written first, dequeuing may be scheduled from the first receive queue later. In other words, the message that flows into the second node to receive the buffer may flow out from the second node to receive the buffer. In this way, the reference message is written into the message of the second node receiving buffer, and may flow out of the second node receiving buffer before the reference message.
Thus, in another possible implementation manner, for the credit value determined by the second node according to the message currently flowing out of the self-receiving buffer and coming from the first transmission queue, if the second node deducts the value of the fourth counter according to the credit value, the value of the fourth counter is smaller than 0 (refer to S207 for a specific process).
In this case, the second node returns only the credit value and the reference end flag of the fourth counter deducted when the tap is reduced to 0 to the first node, so that the first node deducts the value of the first counter and the value of the second counter according to the credit value returned by the second node, and corrects the deducted first counter based on the deducted value of the second counter in response to the reference end flag.
Or it is understood that in this case, for the credit value determined by the second node according to the message currently flowing out of the buffer itself and coming from the first transmission queue, the second node divides the credit value into a first value and a second value equal to the current value of the fourth counter. The second value is used for deducting the value of the fourth counter when the value of the fourth counter is taken, and the current value of the fourth counter is equal to the second value, so that the value of the fourth counter is 0 after the second value is deducted. And the second node returns the second value and the reference end mark to the first node, so that the first node deducts the value of the first counter and the value of the second counter according to the second value returned by the second node, and the deducted first counter is corrected based on the deducted value of the second counter in response to the reference end mark. And when the second node returns the credit value to the first node next time, the first value is returned at the same time, so that the first node deducts the value of the first counter according to the credit value including the first value returned by the second node. For the third counter, the second node may decrement the third counter when the previously determined credit value (i.e., first value + second value) is taken. Or the second node may decrement the third counter when the second value is taken and decrement the third counter when the first value is taken next. Or the second node may decrement the third counter when the first value is taken and decrement the third counter when the second value is taken next. This is not limited thereto.
As an example, assuming that the current value of the fourth counter is 8, the credit value 10 determined by the second node according to the message currently flowing out of the self-receiving buffer and coming from the first sending queue may be divided into a first value 2 and a second value 8. The second value 8 is used for deducting the value of the third counter and the value of the fourth counter when the claps, and at the moment, the value of the fourth counter is deducted to be 0 after the second value 8. Thus, the second node returns the second value 8 and the reference end mark to the first node, so that the first node deducts the value of the first counter and the value of the second counter according to the second value 8 returned by the second node, and corrects the deducted first counter based on the deducted value of the second counter in response to the reference end mark. Further, the next time the second node returns a credit value to the first node, the first value of 2 is returned at the same time.
Optionally, when the value of the fourth counter is updated to 0, the second node needs to send the reference end mark and the fourth credit value subtracted when the value is updated to 0 to the first node, and the second node sends a service message or a credit response message to the first node, where the service message or the credit response message is used to carry the reference end mark and the credit value needed to be sent to the first node by the second node. The relevant description of the credit response message may refer to the above, and will not be repeated.
It will be appreciated that when the second node needs to return the reference end tag and the credit value to the first node, no traffic message to be sent to the first node in the second node may generate a credit response message for carrying the reference end tag and the credit value. Of course, the second node may also generate the credit response message carrying the credit value and the reference end mark immediately when the credit value needs to be returned to the first node, without determining whether there is a service message to be sent to the first node currently.
Further, optionally, for the service message or the credit response message for carrying the reference end mark and the credit value, the service message and the credit response message may carry the reference end mark and the credit value through a message preamble. The detailed description of the reference end mark and the credit value carried by the message preamble can refer to the description of the message preamble provided by the embodiment of the application, and is not repeated.
S209, the first node receives one or more credit values returned by the second node. The one or more credit values are used for updating the value of the first counter of the first node and the value of the second counter, and the value updated by the second counter is used for correcting the value updated by the first counter.
The first node receives one or more credit values returned by the second node, and the one or more credit values are analyzed in a service message or a credit response message received by the first node from the second node. The one or more credits received by the first node include a credit characterizing a length of a reference message sent by the first node to the second node.
Specifically, the first node receives one or more credit values returned by the second node, updates the value of the first counter and the value of the second counter according to the received one or more credit values, and corrects the updated value of the first counter according to the updated value of the second counter.
More specifically, after receiving one or more credit values returned by the second node, the first node deducts the value of the first counter from the value of the second counter by the one or more credit values. And then, the first node corrects the value obtained after the deduction of the first counter according to the residual value obtained after the deduction of the one or more credit values of the second counter. It should be understood that the updating operation performed on the second counter only includes the deduction operation performed on the value of the second counter according to the credit value for characterizing the length of the message from the first transmission queue flowing out from the second node.
In some cases, when the first node receives the message/packet returned by the second node only including the credit value (e.g., the credit value returned by the second node in S207), the first node deducts the value of the first counter and the value of the second counter according to the received credit value. For example, assuming that the current value of the first counter is 15, the current value of the second counter is 10, and the message returned by the first node received by the second node only includes the credit value 3, the first node decrements the value of the first counter by 3 and then the value of the second counter is 15-3=12, and the decremented value of the second counter is 10-3=7.
Further, if the value of the second counter is less than or equal to 0 after the deduction, the reference end mark is not received when the second counter performs the deduction operation. In this case, it is indicated that the message/packet including the reference end-marker returned by the second node to the first node is lost. And/or the reference message including the reference mark sent by the first node to the second node is lost, so that the second node cannot respond to the reference mark to execute the step S206 and subsequent steps, and the second node cannot return the reference end mark to the first node in the process of correcting the first counter. The first node determines that the value correction after the subtraction of the first counter fails.
It should be understood that when the value of the second counter is less than 0 after the subtraction, it can also be stated that the first node does not receive the reference end mark returned by the second node when the second counter is subtracted to 0. The first node determines that the value correction after the subtraction of the first counter fails.
Alternatively, the first node may trigger execution of S201 to S209 described above upon determining that the correction of the first counter fails, thereby expanding a new round of correction procedure for the first counter.
Alternatively, the first node may wait for the above S201 to S209 to be re-executed in the next cycle, thereby re-correcting the first counter.
Optionally, in the process that the first node performs periodic correction on the first counter, when the number of times of continuous correction failure exceeds a threshold value, the first node outputs alarm information. That is, in the process that the first node periodically corrects the first counter based on the periodically determined reference message, when the number of continuous correction failures exceeds the threshold value, the first node outputs alarm information. The specific value of the threshold is not limited in the embodiment of the application.
It can be understood that when the number of times of failure of continuously correcting the first counter exceeds the threshold value, it indicates that the packet transmitted between the first node and the second node is frequently lost, that is, the packet loss rate is serious. Therefore, the first node outputs alarm information to the user, so that the user can be reminded of timely overhauling the communication link between the first node and the second node, and the communication quality is ensured.
In other cases, when the first node receives the message/packet returned by the second node and includes the credit value and the reference end flag (e.g., the credit value returned by the second node and the reference end flag in S208), the first node deducts the value of the first counter and the value of the first counter according to the received credit value, and in response to the reference end flag, corrects the value of the first counter after deducting the credit value according to the remaining value of the second counter after deducting the credit value. For clarity, the value obtained by deducting the credit value from the first counter is referred to as the third value in the embodiment of the present application. The detailed description of the reference end mark refers to the above description, and will not be repeated.
And when the first node receives the message/message comprising the credit value and the reference end mark, the first node deducts the credit value from the second counter and then responds to the reference end mark to stop the updating operation of the second counter.
Specifically, when the remaining value is equal to 0, the first node determines that the flow of the message sent by the first sending queue based on the first counter is normal in response to the reference end mark, so that correction of the first counter is not needed.
It should be understood that when the first node receives the reference end flag, the value of the fourth counter of the second node is 0, which further indicates that the reference message has flowed out of the receiving buffer of the second node. The remaining value is also 0 at this time, which means that the second counter also indicates that the reference message has been sent from the receiving buffer of the second node at this time. It can be seen that the value of the fourth counter of the second node is synchronous with the value of the second counter of the first node, which indicates that no packet loss occurs between the second node and the first node. In this case, therefore, the first node determines that the flow of the message sent to the first send queue based on the first counter is normal.
When the remaining value is greater than 0, the first node deducts the value of the first counter (i.e. the third value) by the remaining value in response to the reference end mark, so as to complete the value correction of the first counter. In other words, when the remaining value is greater than 0 and the first node determines that the reference end mark returned by the second node has been received, the value of the first counter (i.e. the third value) is deducted from the remaining value, so as to complete the value correction of the first counter. For example, assuming that the value of the first counter is 12 (i.e., the third value is 12) and the remaining value of the second counter is 7, the corrected value of the first counter is 12-7=5.
It should be understood that when the first node receives the reference end flag, the value of the fourth counter of the second node is 0, which further indicates that the reference message has flowed out of the receiving buffer of the second node. The remaining value is greater than 0, which indicates that the value of the second counter of the first node is not 0, that is, indicates that the reference message is still buffered (or stays in) the receiving buffer of the second node at this moment. Therefore, in this case, after the first node sends the reference message to the second node and before the first node receives the reference end mark returned by the second node, the credit value returned by the second node to the first node is lost, so that the value of the second counter of the first node and the value of the fourth counter of the second node are not synchronous. Therefore, the first node deducts the value of the first counter (namely the third value) and then subtracts the remaining value, so that compensation correction on the value of the first counter can be realized, and the first counter can accurately record the message length which is currently scheduled and dequeued from the first sending queue and is positioned in a communication link where the first node transmits the message to the second node and is buffered in the second node receiving buffer. Therefore, the phenomenon that when the credit value returned by the second node to the first node is lost, the accumulated credit value of the first counter of the first node is more, and the corresponding deducted credit value is less, and when the unrealistic value of the first counter exceeds the flow control threshold value, the first node stops sending messages to the second node, namely the flow transmission performance between the first node and the second node is reduced, and even the phenomenon of flow blockage occurs at the first node can be prevented.
In summary, by the data transmission method provided by the embodiment of the application, the first counter can be automatically corrected in the process of credit flow control of the message sent by the first node through the first counter, so that the reliability of credit flow control of the message sent by the first node through the counter is greatly improved.
To enhance understanding of the method according to the embodiments of the present application, the method is described below by way of example with reference to fig. 6.
Referring to fig. 6, fig. 6 shows another flowchart of a data transmission method according to an embodiment of the present application. As shown in fig. 6, when a packet of a video service class is sent to a second node through a first sending queue of a first node, the second node receives the packet of the video service class through a first receiving queue. The first sending queue is configured with a first counter for credit flow control of video service class messages and a second counter for correction of the first counter. The first receive queue is configured with a third counter and a fourth counter for aiding in correcting the aforementioned first counter. The detailed descriptions of the first counter, the second counter, the third counter and the fourth counter may refer to the above description, and will not be repeated.
In this scenario, the first node may determine, by executing S201 described above, a packet of a certain video service class that is dequeued from the first transmit queue, e.g. packet 1, as a fixed reference packet, and update the first counter according to packet 1. Next, the first node executes S202 described above to control the second counter to obtain the updated value of the first counter. The first node then performs S203 described above to send message 1 to the second node.
In response, the second node receives the message 1 by executing S204 described above. Further, the second node performs S205 and S206 described above to update the value of the third counter according to the message 1, and controls the fourth counter to obtain the updated value of the third counter. The second node continues to execute the steps S207-S208 to update the fourth counter and the third counter, returns the credit value for updating the fourth counter to the first node each time, and returns the reference end mark to the first node when the fourth counter is updated to 0.
In response, the first node receives a message/packet returned by the second node and including only the credit value, or receives a message/packet returned by the second node and including the credit value and the reference end mark by executing S209. Thus, the first node can update the value of the first counter and the value of the second counter according to the received credit value, and correct the value of the first counter according to the value of the second counter after updating.
The following describes a message preamble provided by the embodiment of the present application.
In the embodiment of the application, the preamble of the message comprises a type field, a reference request field, a credit value field and a reference end field of the preamble. Optionally, the preamble of the message further includes a queue packet field and a check field.
The type field of the preamble is used for carrying a type mark to indicate the type of the preamble. The type mark comprises a common preamble mark and a CFC type mark, wherein the CFC type mark is used for indicating that the preamble of the current message carries information for credit flow control. Here, the information for credit flow control includes, but is not limited to, at least one of the above-described reference marks, credit values, or reference end marks.
As an example, a normal preamble mark may be characterized by a hexadecimal value 0x5 (binary number denoted 0101) and a CFC type mark may be characterized by a hexadecimal value 0xA (binary number denoted 1010). Thus, when the value of the type field of the preamble is 0x5, the preamble of the current message is a common preamble. When the value of the type field of the preamble is 0xA, it indicates that the preamble of the current message carries information for credit flow control, for example, at least one of the above-mentioned reference mark, credit value or reference end mark.
The reference request field for carrying the reference marks described above. As an example, the value of the reference mark may be the value 7, with the binary number being denoted 111. Thus when the reference request field comprises 3 bits and the 3 bits are set to 111, the reference request field representing the message preamble carries a reference mark. When the 3 bits of the reference request field are set to any value other than 111, it means that the reference request field of the message preamble is invalid or it is understood that the reference request field of the message preamble does not carry a reference mark.
And the credit value field is used for carrying the credit value returned by the second node to the first node. In an embodiment of the present application, the credit field may carry multiple credits. But the number of credits that the credit field of the preamble can carry is limited due to the limited preamble length. In some examples, the credit field of one message preamble may carry at most a credit value for decrementing the 4 first counters at a single time. The 4 first counters are respectively used for credit flow control of the messages of the 4 sending queues.
It should be appreciated that when the credit field is capable of carrying multiple credits, the credit field may be divided into multiple credit subfields, and each credit subfield is used to carry one or more credits for decrementing one first counter, i.e. one credit subfield corresponds to one first counter. Since a first counter is used for credit flow control of a message in a transmit queue, that is, a first counter corresponds to a transmit queue. It is also understood that a credit subfield corresponds to a transmit queue.
It should also be understood that when the credit field and/or the credit subfield of the message preamble is set to 0, it indicates that the credit field and/or the credit subfield are invalid, or that the credit field and/or the credit subfield of the message preamble do not carry a credit.
The end of reference field for carrying the end of reference marker described above. As an example, when the reference end field comprises 1 bit, and when the 1 bit is set to 1, the reference end field representing the message preamble carries a reference end flag. When 1 bit of the reference end field is set to 0, it indicates that the reference end field is invalid, or it is understood that the reference end field does not carry a reference end flag.
It should be noted that, when the credit value field can carry a plurality of credit values, that is, when the credit value field includes a plurality of credit value subfields, the reference end field of the preamble includes a plurality of reference end subfields, and the number of the plurality of reference end subfields is the same as the number of the credit value subfields in the current preamble and corresponds to one.
In this case, taking any one of the credit value subfields, such as the credit value subfield 1 as an example, it is assumed that the transmission queue corresponding to the credit value subfield 1 is the transmission queue 1, and the reference end subfield corresponding to the credit value subfield 1 is the reference end subfield 1. Then, after the first node sends the reference packet from the send queue 1 to the second node and before the receiving buffer of the second node in the reference packet Wen Liuchu, if any packet from the send queue 1 in the first node, such as the packet 1 flows out from the receiving buffer of the second node, the credit value subfield 1 carries a credit value for characterizing the length of the packet 1 in the preamble of the service packet or the credit response packet sent by the second node to the first node, and the reference end subfield 1 is set to be invalid, i.e. the reference end subfield 1 does not carry a reference end mark. If the reference message from the transmission queue 1 in the first node flows out from the receiving buffer of the second node, the credit value subfield 1 carries a credit value for characterizing the message length of the message currently received from the second node and flowing out from the transmission queue 1 in the preamble of the service message or the credit response message sent from the second node to the first node, and the reference end subfield 1 carries a reference end mark.
And the queue packet field is used for carrying a queue packet identifier so as to identify a queue packet to which a sending queue corresponding to the credit value carried in the current message preamble belongs. It should be understood that, when the plurality of sending queues each use the first counter to perform credit flow control, the first counter corresponding to each of the plurality of sending queues needs to be deducted according to the credit value returned by the peer node. Because the credit value field of a message preamble has a limited number of credit values that can be carried at a time, the plurality of sending queues can be divided into a plurality of queue groups, and the number of sending queues included in each queue group is less than or equal to the number of credit values that can be carried by the credit value field in the preamble. In this way, the credit field of a message preamble may carry, at most, a credit value for decrementing the first counter of each transmit queue in a queue packet at a single time.
As an example, assume that the credit field may carry at most a credit value for deducting 4 first counters at a time, and the first node currently includes 8 transmission queues that need to be subjected to credit flow control, so that the 8 first counters corresponding to the 8 transmission queues all need to be deducted according to the credit value returned by the peer node. Thus, the 8 transmit queues may be divided into queue packet 1 and queue packet 2. The queue packet 1 may include 4 transmission queues of a transmission queue 1, a transmission queue 2, a transmission queue 3, and a transmission queue 4, and the queue packet 2 may include 4 transmission queues of a transmission queue 5, a transmission queue 6, a transmission queue 7, and a transmission queue 8. Thus, when the value carried in the queue packet field is used to identify the queue packet 1, the credit value field of the current packet preamble correspondingly carries 4 credit values for deducting the first counter of each transmit queue in the queue packet 1. Similarly, when the value carried in the queue packet field is used to identify the queue packet 2, the credit value field of the current packet preamble correspondingly carries 4 credit values for deducting the first counter of each transmit queue in the queue packet 2.
It will be appreciated that the number of queue packets that the queue packet field can identify is to the power of 2 n, where n is the number of bits that the queue packet field includes. For example, when the queue packet field includes 1 bit, the queue packet field can identify 2 1 queue packets, i.e., 2 queue packets, and the 2 queue packets are specifically identified by two states of 0 and 1 of the 1 bit. For another example, when the queue packet field includes 2 bits, the queue packet field may identify 2 2 queue packets, i.e., 4 queue packets, and the 4 queue packets are specifically identified by four combined states of 01, 10, 00, 11 of the 2 bits.
And the check field is used for checking the preamble. The check field may be, for example, an 8-bit CRC check code.
Based on the message preamble described above, the first node adds a reference flag to the reference message in the above S203, which means that the type field of the reference message preamble is set to a value (e.g. 0 xA) corresponding to the CFC type flag, and the reference request field is set to a value (e.g. 111) corresponding to the reference flag.
That is, the first node carries the CFC type flag in the preamble of the reference message sent to the second node in S203, and the reference request field carries the reference flag.
In addition, the second node carries the credit value returned by the second node to the first node through the preamble of the service message or the credit response message, which means that the type field of the preamble is set to the value (e.g. 0 xA) corresponding to the CFC type flag, the queue packet field of the preamble is set to the group number of the queue packet corresponding to the credit value, and the credit value sub-field corresponding to the credit value in the credit value field carries the credit value. In this way, the second node may return a credit value (e.g., the credit value of the second message as described above) to the first node via the credit self field in the preamble of the service message or the credit response message.
The queue packet corresponding to the credit value refers to a queue packet to which a transmission queue from which a message for obtaining the credit value is derived by calculation. The credit value subfield corresponding to the credit value refers to a credit value subfield corresponding to a transmission queue from which a message for calculating the credit value is received. The description of the transmission queue corresponding to the credit value subfield may refer to the description of "one credit value subfield corresponds to one transmission queue" in the above description, and will not be repeated. As an example, when the second node calculates the credit value 1 according to the message from the sending queue 1 flowing from the receiving buffer, the queue packet corresponding to the credit value 1 is the queue packet to which the sending queue 1 belongs, and the credit value subfield corresponding to the credit value 1 is the credit value subfield corresponding to the sending queue 1.
In addition, the second node carries the reference end tag and the credit value returned to the first node by the preamble of the service message or the credit response message in S208, which means that the type field of the preamble is set to the value (e.g. 0 xA) corresponding to the CFC type tag, the queue packet field is set to the identifier of the queue packet corresponding to the credit value, the credit value is carried in the credit value sub-field corresponding to the credit value in the credit value field, and the reference end sub-field corresponding to the credit value sub-field in the preamble is set to the value (e.g. 1) corresponding to the reference end tag. The description of the queue packet corresponding to the credit value, the description of the credit value subfield corresponding to the credit value, and the description of the credit value subfield and the description of the reference end subfield may be referred to the above description, and will not be repeated.
In this way, in the preamble of the service message or the credit response message sent to the first node in S208, the type field carries the CFC type flag, the reference end field carries the reference end flag, and the credit value field carries the credit value returned by the second node to the first node.
Optionally, for the service message or the credit response message sent by the second node and carrying the reference end mark and the credit value, or only carrying the credit value, the message may also be used as a reference message sent by the second node to the first node for correcting the credit flow control counter, and the reference request field of the message preamble carries the reference mark, that is, the value of the reference request field of the message preamble is the value corresponding to the reference mark (e.g. 7), which is not limited.
As an example, referring to fig. 7, fig. 7 shows a schematic structural diagram of a message preamble according to an embodiment of the present application.
As shown in fig. 7, the MAC-based ethernet frame 70 includes/S/field, preamble field, start of FRAME DELIMITER (SFD) field, frame payload (FCS) field, and frame payload (frame payload) field. Wherein the/S/field and the preamble field shown in fig. 7 constitute a conventional preamble, which is generally used to isolate each ethernet frame, and which may also be referred to as a locator. The preamble field shown in fig. 7 includes 6 bytes. The SFD field shown in fig. 7 includes 1 byte for indicating the start of a frame. The frame payload field shown in fig. 7 is generally 60 bytes or more, specifically, a MAC frame. The FCS field shown in fig. 7 includes 4 bytes for checking the ethernet frame.
As shown in fig. 7, for the first 8 bytes of the ethernet frame 70, byte 7 is the/S/field and byte 0 is the SFD field. byte1 through byte 6 are preamble fields.
The msg_type field including bit 4 to bit 7 in byte6 shown in fig. 7 may be used as the TYPE field of the preamble described above for carrying the normal preamble tag or CFC TYPE tag described above. The s_req field including bit 1 to bit 3 in byte6 shown in fig. 7 may be used as the above-described reference request field for carrying the above-described reference marks. The cos_group field including bit 0 in byte6 of fig. 7 may be used as the queue packet field described above for carrying the queue packet identification described above.
As shown in fig. 7, for any one byte of the bytes 2 to 5 shown in fig. 7, bit 0 to bit 6 in the byte may be used as a credit value subfield described above for carrying one or more credit values described above returned by the second node to the first node, and bit 7 in the byte may be used as a reference end subfield described above for carrying a reference end flag returned by the second node to the first node. And, the credit value subfield and the reference end subfield in the byte correspond to the same transmit queue, so that the byte can carry a credit value for deducting the first counter corresponding to a certain transmit queue, and a reference end mark for indicating that the reference message from the transmit queue flows out of the receive buffer. Thus, the reference end subfield and the credit value subfield in byte 2 to byte 5 of the preamble shown in fig. 7 correspond to 4 transmit queues, and can carry a credit value for deducting 4 first counters corresponding to the 4 transmit queues one by one, and carry a reference end flag for indicating that the reference message from the 4 transmit queues flows out of the receive buffer.
For simplicity of description, for a certain transmission queue, "a credit value for deducting a first counter corresponding to the transmission queue" will be referred to as "a credit value corresponding to the transmission queue" in the following examples. And, the "reference end mark for indicating the reference message from the transmission queue to flow out of the receiving buffer" is simply referred to as "reference end mark corresponding to the transmission queue"
In one example, when a port of the first node includes 4 transmit queues that need credit flow control, transmit queue 0, transmit queue 1, transmit queue 2, and transmit queue 3, respectively. In this case, as shown in fig. 7, the credit value subfield and the reference end subfield in byte 2 shown in fig. 7 may correspond to the transmission queue 0, and may carry a credit value corresponding to the transmission queue 0, and carry a reference end flag corresponding to the transmission queue 0. Specifically, in the embodiment of the present application, the bit 0 to bit 6 of the byte 2 shown in fig. 7 may carry the credit value corresponding to the transmission queue 0 (e.g., credit 0 shown in fig. 7), and the bit 7 of the byte 2 shown in fig. 7 may carry the reference end flag corresponding to the transmission queue 0 (e.g., t_ack0 shown in fig. 7).
Similarly, in the embodiment of the present application, the bit 0 to bit6 of the byte 3 shown in fig. 7 may carry the credit value corresponding to the transmit queue 1 (e.g., credit 1 shown in fig. 7), and the bit7 of the byte 3 shown in fig. 7 may carry the reference end tag corresponding to the transmit queue 1 (e.g., t_ack1 shown in fig. 7). The embodiment of the application can carry the credit value corresponding to the sending queue 2 (credit 2 shown in fig. 7) through bit 0-bit 6 of the byte 4 shown in fig. 7, and carry the reference end mark corresponding to the sending queue 2 (t_ack2 shown in fig. 7) through bit7 of the byte 4 shown in fig. 7. The embodiment of the application can carry the credit value corresponding to the sending queue 3 (credit 3 shown in fig. 7) through bit 0-bit 6 of the byte 5 shown in fig. 7, and carry the reference end mark corresponding to the sending queue 3 (t_ack3 shown in fig. 7) through bit7 of the byte 5 shown in fig. 7.
In another example, when a port in the first node includes 8 transmit queues that require credit flow control, the 8 transmit queues may be divided into queue packet 1 and queue packet 2. The queue packet 1 includes a transmission queue 0, a transmission queue 1, a transmission queue 2, and a transmission queue 3, and the queue packet 2 includes a transmission queue 4, a transmission queue 5, a transmission queue 6, and a transmission queue 7.
In this case, when the value of the cos_group field shown in fig. 7 is the identifier of the queue packet 1, the bytes 2 to 5 shown in fig. 7 can respectively carry the credit values corresponding to the transmission queues in the queue packet 1, and carry the reference end marks corresponding to the transmission queues in the queue packet 1. Specifically, as shown in fig. 7, the credit value subfield and the reference end subfield in byte2 shown in fig. 7 may correspond to the transmission queue 0, and may carry a credit value (e.g., credit 0) corresponding to the transmission queue 0, and a reference end flag (e.g., t_ack0) corresponding to the transmission queue 0. Similarly, the credit value subfield and the reference end subfield in byte 3 shown in fig. 7 may correspond to transmit queue 1 and may carry a credit value (e.g., credit 1) corresponding to transmit queue 1 and a reference end tag (e.g., t_ack1) corresponding to transmit queue 1. The credit value subfield and the reference end subfield in byte 4 shown in fig. 7 may correspond to transmit queue 2 and may carry a credit value (e.g., credit 2) corresponding to transmit queue 2 and a reference end tag (e.g., t_ack2) corresponding to transmit queue 2. The credit value subfield and the reference end subfield in byte 5 shown in fig. 7 may correspond to transmit queue 3 and may carry a credit value (e.g., credit 3) corresponding to transmit queue 3 and a reference end tag (e.g., t_ack3) corresponding to transmit queue 3.
Similarly, when the value of the cos_group field shown in fig. 7 is the identifier of the queue packet 2, the byte 2-byte 5 shown in fig. 7 can respectively carry the credit value corresponding to each transmission queue in the queue packet 2, and carry the reference end mark corresponding to each transmission queue in the queue packet 2. Specifically, as shown in fig. 7, the credit value subfield and the reference end subfield in byte 2 shown in fig. 7 may correspond to the transmission queue 4, and may carry a credit value (e.g., credit 4) corresponding to the transmission queue 4, and a reference end flag (e.g., t_ack4) corresponding to the transmission queue 4. Similarly, the credit value subfield and the reference end subfield in byte3 shown in fig. 7 may correspond to transmit queue 5 and may carry a credit value (e.g., credit 5) corresponding to transmit queue 5 and a reference end tag (e.g., t_ack5) corresponding to transmit queue 5. The credit value subfield and the reference end subfield in byte 4 shown in fig. 7 may correspond to the transmit queue 6 and may carry a credit value (e.g., credit 6) corresponding to the transmit queue 6 and a reference end tag (e.g., t_ack6) corresponding to the transmit queue 6. The credit value subfield and the reference end subfield in byte 5 shown in fig. 7 may correspond to transmit queue 7 and may carry a credit value (e.g., credit 7) corresponding to transmit queue 7 and a reference end tag (e.g., t_ack7) corresponding to transmit queue 7.
As shown in fig. 7, byte 1 in the preamble of fig. 7 may be used to carry an 8-bit CRC check code.
The foregoing description of the solution provided by the embodiments of the present application has been mainly presented in terms of a method.
In order to achieve the above functions, as shown in fig. 8, fig. 8 shows a schematic structural diagram of a data transmission device 80 according to an embodiment of the present application. The data transmission device 80 is the first node, and the first node sends the message to the second node through one or more sending queues, where the first node is configured with the first counter, and the first counter is used to credit and flow control the message in the first sending queue in the one or more sending queues. The data transmission device 80 is used for performing the data transmission method described above, for example for performing the method shown in fig. 4a, 4b or 6. The data transmission device 80 may include a transmitting unit 81 and a receiving unit 82.
A transmitting unit 81 for transmitting a reference message for indicating correction of the first counter to the second node. And a receiving unit 82, configured to receive a service message or a credit response message returned by the second node, where a preamble in the service message or the credit response message carries a credit value, and the credit value is used to correct the first counter.
As an example, in connection with fig. 4a, the transmitting unit 81 may be used to perform S101 and the receiving unit 82 may be used to perform S104. In connection with fig. 4b, the transmitting unit 81 may be used for performing S203 and the receiving unit 82 may be used for performing S209.
Optionally, the credit value is used to characterize a length of a message from the first sending queue and flowing out of the second node to receive the buffer. The preamble in the service message and the credit response message includes a type field, a reference end field, and a credit value field. The type field carries a credit flow control CFC type mark, and the CFC type mark is used for indicating that the preambles in the service message and the credit response message carry information for credit flow control. The reference end field is used to carry a reference end flag, which is used to indicate that the reference message has flowed out of the receiving buffer of the second node. The credit field is used to carry the credit returned by the second node to the first node.
Optionally, the preamble in the reference message includes a type field and a reference request field. The type field carries a CFC type flag, where the CFC type flag is used to indicate that the preamble in the reference message carries information for credit flow control. The reference request field is used to carry a reference mark identifying a reference message.
Optionally, the data transmission device 80 further comprises a processing unit 83, configured to periodically determine, as a reference message, a message to be sent scheduled out of the first sending queue, or configured to determine, as a reference message, a message to be sent scheduled out of the first sending queue in response to a correction instruction.
Optionally, the value of the first counter is used to characterize the length of the message scheduled out of the first transmit queue. The message which is scheduled to be dequeued from the first sending queue comprises a communication link which is positioned in the first node and used for transmitting the message to the second node, and the message which is cached in the second node and received.
Optionally, the processing unit 83 is specifically configured to determine, before sending the reference message to the second node, a first credit value for characterizing the length of the reference message according to the length of the reference message and the bit width of the buffer received by the second node, and accumulate the current value of the first counter with the first credit value, so as to complete updating the value of the first counter.
As an example, in connection with fig. 4b, the processing unit 83 may be used to perform S201.
Optionally, the data transmission device 80 further comprises an output unit 84 for outputting alarm information when the number of consecutive correction failures of the first counter exceeds a threshold value.
Optionally, the sending unit 81 is further configured to send a CFC capability request message to the second node before the first node sends the message to the second node. The receiving unit 82 is further configured to receive a CFC capability response message returned by the second node. The CFC capability response message carries CFC capability information of the second node. The CFC capability information includes one or more of a size of the second node receive buffer, a bit width of the second node receive buffer, a receive queue in the second node supporting CFCs, or an offset. Here, the offset is used to determine the message length required to calculate the message credit value.
For a specific description of the above alternative modes, reference may be made to the foregoing method embodiments, and details are not repeated here. In addition, any explanation and description of the beneficial effects of the data transmission device 80 provided above may refer to the corresponding method embodiments described above, and will not be repeated.
As an example, in connection with fig. 3, the transmitting unit 81 and the receiving unit 82 in the data transmission apparatus 80 may be implemented by the communication interface 32 shown in fig. 3. The processing unit 83 may be implemented jointly by the control circuit 31 and the flow control module 34 shown in fig. 3. The output unit 84 may be implemented by an output interface of the device in which the chip 30 shown in fig. 3 is located. Here, the output interface includes, but is not limited to, a display screen, a speaker, an indicator light, and the like.
As shown in fig. 9, fig. 9 is a schematic structural diagram of a data transmission device 90 according to an embodiment of the present application. The data transmission device 90 is applied to the second node including the first receiving queue, where the first receiving queue is used to receive the message from the first sending queue of the first node. The data transmission device 90 is configured to perform the data transmission method described above, for example, to perform the method shown in fig. 4a, 4b or 6. The data transmission device 90 may include a receiving unit 91 and a transmitting unit 92.
A receiving unit 91, configured to receive a first packet from the first transmit queue. The sending unit 92 is configured to send, to the first node, a service message or a credit response message in response to the first message being a reference message, where a preamble in the service message or the credit response message carries a credit value, and the credit value is used to correct a first counter for performing credit flow control CFC on a message in the first sending queue. The reference message is used for indicating to correct the first counter.
As an example, in connection with fig. 4a, the receiving unit 91 may be used to perform S102 and the transmitting unit 92 may be used to perform S103. In connection with fig. 4b, the receiving unit 91 may be used for performing S204 and the transmitting unit 92 may be used for performing S207 and S208.
Optionally, the credit value is used to characterize a length of a message from the first sending queue and flowing out of the second node to receive the buffer. The preamble in the service message and the credit response message includes a type field, a reference end field, and a credit value field. The type field carries a credit flow control CFC type mark, and the CFC type mark is used for indicating that the preamble in the service message and the credit response message carries information for credit flow control. The reference end field is used to carry a reference end flag, which is used to indicate that the reference message has flowed out of the receiving buffer of the second node. The credit field is used to carry the credit returned by the second node to the first node.
Optionally, the preamble in the reference message includes a type field and a reference request field. The type field carries a CFC type flag, which is used to indicate that the preamble in the reference message carries information for credit flow control. The reference request field is used to carry a reference mark identifying a reference message.
Optionally, the receiving unit 91 is further configured to receive the CFC capability request message sent by the first node before receiving the first message from the first sending queue. The sending unit 93 is further configured to send a CFC capability response message to the first node in response to the CFC capability request message. The CFC capability response message carries CFC capability information of the second node, where the CFC capability information includes one or more of a size of a second node receiving buffer, a bit width of the second node receiving buffer, a receiving queue supporting CFC in the second node, or an offset. Here, the offset is used to determine the message length required to calculate the message credit value.
For a specific description of the above alternative modes, reference may be made to the foregoing method embodiments, and details are not repeated here. In addition, any explanation and description of the beneficial effects of the data transmission device 90 provided above may refer to the corresponding method embodiments described above, and will not be repeated.
As an example, in connection with fig. 3, the receiving unit 91 and the transmitting unit 93 in the data transmission apparatus 90 may be realized by the communication interface 32 shown in fig. 3.
Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It should be noted that the division of the modules in fig. 8 and 9 is illustrative, and is merely a logic function division, and other division manners may be implemented in practice. For example, two or more functions may also be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules.
The embodiment of the application also provides a first node. The first node sends a message to the second node through one or more sending queues, and the first node is configured with a first counter as described above, where the first counter is configured to perform credit flow control on the message in the first sending queue of the one or more sending queues. The first node performs the method provided by the embodiment of the present application (e.g., the portion of the method described in fig. 4a, fig. 4b, or fig. 6 that is performed by the first node) to implement the correction of the first counter for credit flow control.
The embodiment of the application also provides a second node. The second node comprises a first receiving queue for receiving the message from the first sending queue of the first node, the second node is configured with the third counter and the fourth counter, and the value of the third counter is used for representing the length of the message from the first sending queue cached in the receiving cache of the second node. The second node performs the method provided by the embodiment of the present application (such as the portion of the method described in fig. 4a, fig. 4b, or fig. 6 that is performed by the second node) to implement correction on the first counter, where the first counter is used to perform credit flow control on the packet in the first transmit queue.
The embodiment of the application also provides a data transmission system, which comprises a first node and a second node, wherein the first node and the second node are respectively used for executing corresponding steps in the method, and are not repeated.
Embodiments of the present application also provide a computer program product, and a computer readable storage medium for storing the computer program product. The computer program product may comprise one or more program instructions which, when executed by one or more processors, may provide the functionality or part of the functionality described above with respect to fig. 4a, 4b or 6. Thus, for example, one or more features described with reference to S101-S104 of FIG. 4a may be carried by one or more instructions in the computer program product.
In some examples, a data transmission determining apparatus, such as for performing the methods described in fig. 4a, 4b, or 6, may be configured to provide various operations, functions, or actions in response to one or more program instructions stored by a computer readable storage medium.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The processes or functions in accordance with embodiments of the present application are produced in whole or in part on and when the computer-executable instructions are executed by a computer. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, a website, computer, server, or data center via a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices including one or more servers, data centers, etc. that can be integrated with the media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid State Disk (SSD)) or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.