Data sending method and system based on time delay constraint
Technical Field
The present invention relates to the field of ethernet communication technologies, and in particular, to a data transmission method and system based on delay constraints.
Background
In the ethernet network environment, the devices of each access network share the transmission medium and are based on the technical characteristics of the variable length frame, which causes the problem of uncertain transmission delay. For example, when delay sensitive services such as voice and video are transmitted in a mixed manner with ordinary data services, contention occurs between data of the two service types. If the common data service obtains the priority transmission, the delay sensitive service needs to be transmitted after the common data service is completely transmitted. In particular, when the normal data traffic is a long frame, the frame jitter of the delay sensitive traffic will be too large. On the other hand, with the arrival of the 5G era, the low latency requirement of the bearer access device is indispensable, and the 5G bearer access device generally needs to support a time-sensitive network to implement low latency forwarding.
IEEE (Institute of Electrical and Electronic Engineers) 802.3br proposes a method of inserting fast frames in an ethernet network, which is a frame preemption framework. This framework allows one or more fast frames to be sent before a preemptible frame. The 802.3br standard divides a MAC (Media Access Control) layer into an emoc (Media Access Control) layer and a pMAC (preemptible Media Access Control) layer, adds a MAC Merge Sublayer (MAC Merge Sublayer) in the MAC layer, and supports fast frames and preemptible/normal frames. When a fast frame occurs, the MAC merge sublayer supports preemption in two ways: (1) the MAC merging sublayer can preempt the frame which is transmitted at present, namely interrupt the frame which is transmitted and insert a quick frame in the middle; (2) the MAC merge sublayer can prevent the start of transmission of preemptible frames, i.e., preferentially transmitting fast frames. The fast frame corresponds to the time delay sensitive service with high priority, and the frame can be preempted to correspond to the ordinary data service with low priority. The essence of the frame preemption framework is to divide the preemptible frames into smaller "sections" to give the fast frames a more prioritized order of processing. This means that the fast frames do not have to wait until the preemptible frame is complete before starting, thereby ensuring a faster transmission path and reducing jitter for delay sensitive services.
The method can obviously reduce the time delay of the time delay sensitive service, but has the following defects: first, when there are many fast frames in the system, the fast frames will frequently preempt the normal frames, and the preemption overhead has a certain influence on the system performance, even resulting in a significant performance reduction. Secondly, when a long normal frame is preempted by a plurality of fast frames, the normal frame may not be served all the time and a long waiting time occurs, so that the relative fairness of data transmission cannot be ensured, and even the system is abnormal because the normal frame cannot be transmitted for a long time. And thirdly, even if the fast frame has the potential of faster transmission, the requirement of a part of application scenes on the fast frame is not as fast as possible, but a certain constraint condition can be met.
Disclosure of Invention
The invention aims to provide a data sending method and a system based on time delay constraint, which can make low-priority data have more transmission opportunities and reduce time delay of the low-priority data as far as possible under the condition of meeting the time delay constraint condition of a high-priority frame, thereby improving the overall performance of the system and ensuring the relative fairness of service flow transmission.
The technical scheme provided by the invention is as follows:
the invention provides a data sending method based on time delay constraint, which comprises the following steps:
dividing a sending queue into an eMAC (enhanced random access memory) priority queue and a pMAC priority queue, wherein the eMAC priority is higher than the pMAC priority;
storing a plurality of data to be transmitted into corresponding priority queues according to priorities, calculating the time required for transmitting the first data to be transmitted in the eMAC in an interference-free state, and recording the time as theoretical time delay;
when the execution parameter of the service primitive corresponding to the first data to be sent is kept, calculating the waiting preemption time required by sending the first data to be sent according to the preset expected time delay, the theoretical time delay and the second data to be sent in the pMAC, and sending the first data to be sent according to the preemption time.
On the basis of the technical scheme, the method further comprises a service primitive execution flow, and the service primitive execution flow comprises the following steps:
receiving the service primitive, and identifying the execution parameter of the service primitive;
if the execution parameter of the service primitive is release, the first data to be sent is not sent;
if the execution parameter of the service primitive is maintained, calculating whether to perform preemption operation according to the expected time delay and the theoretical time delay;
when the calculation result is that the preemption is not carried out, the first data to be sent is not sent;
when the calculation result is that preemption is performed, judging the time for sending the first data to be sent;
when the expected time delay is not greater than the theoretical time delay, the first to-be-transmitted data is transmitted;
and when the expected time delay is larger than the theoretical time delay, calculating the waiting preemption time for sending the first data to be sent, and sending the first data to be sent after waiting the duration corresponding to the preemption time.
On the basis of the above technical solution, when the expected time delay is greater than the theoretical time delay, calculating preemption time required for sending the first to-be-sent data, and sending the first to-be-sent data after waiting for a duration corresponding to the preemption time, specifically including the following steps:
acquiring the length of the second data to be sent, and calculating the length which can be sent before the second data to be sent is preempted;
if the length of the second data to be sent is not more than 127 bytes, the maximum length which can be sent before the second data to be sent is preempted is 0, and the first data to be sent is sent;
if the length of the second data to be sent is greater than 127 bytes, calculating the theoretical maximum length which can be sent before the second data to be sent is preempted according to the expected time delay and the theoretical time delay, comparing the theoretical maximum length, the difference between the length of the second data to be sent and 127 bytes, taking the smaller value as the maximum length which can be sent before the second data to be sent is preempted, and the time for sending the maximum length data is the preempting time.
On the basis of the above technical solution, the eMAC and the pMAC are both located in the MAC layer, and the method further includes the following steps:
and establishing an MAC merging sublayer under the MAC layer, wherein the MAC merging sublayer is used for sending, receiving, checking and filtering the first data to be sent and the second data to be sent.
On the basis of the above technical solution, the storing a plurality of data to be sent into corresponding priority queues according to priorities specifically includes the following steps:
acquiring each piece of data to be sent, and dividing each piece of data to be sent into first data to be sent and second data to be sent by a preset priority dividing strategy, wherein the priority of the first data to be sent is higher than that of the second data to be sent;
and storing the first data to be sent into an eMAC (enhanced multimedia access controller), and storing the second data to be sent into the pMAC.
The invention also provides a data transmission system based on time delay constraint, which comprises:
an initialization unit, configured to divide a transmission queue into two priority queues, an eMAC and a pMAC, where a priority of the eMAC is higher than a priority of the pMAC;
the data classification unit is used for storing a plurality of data to be sent into corresponding priority queues according to priorities;
a delay calculating unit, configured to calculate, when an execution parameter of a service primitive corresponding to the first to-be-sent data is hold, a waiting preemption time required for sending the first to-be-sent data according to a preset expected delay, the theoretical delay, and second to-be-sent data in the pMAC;
and the preemption control unit is used for sending the first data to be sent after waiting for the duration corresponding to the preemption time according to the preemption time.
On the basis of the above technical solution, the preemption control unit includes:
an identification subunit, configured to receive the service primitive, and identify an execution parameter of the service primitive;
a sending subunit, configured to not send the first to-be-sent data when the execution parameter of the service primitive is release;
an analysis subunit, configured to calculate, when an execution parameter of the service primitive is hold, whether to perform preemption operation according to the expected time delay and the theoretical time delay;
the analysis subunit is further configured to not send the first data to be sent when the calculation result indicates that preemption is not to be performed;
the analysis subunit is further configured to determine, when the calculation result indicates that preemption is to be performed, a time for sending the first data to be sent;
the transmitting subunit is further configured to transmit the first to-be-transmitted data when the expected time delay is not greater than the theoretical time delay;
the control subunit is configured to calculate, when the expected delay is greater than the theoretical delay, a preemption time that needs to be waited for sending the first to-be-sent data;
and the sending subunit is further configured to send the first data to be sent after waiting for a duration corresponding to the preemption time.
On the basis of the above technical solution, the control subunit includes:
the data calling module acquires the length of the second data to be sent and calls the time delay calculation module to calculate the length of the second data to be sent which can be sent before being preempted
The time calculation module is used for judging that the maximum length which can be sent before the pMAC data are preempted is 0 when the length of the pMAC data is less than or equal to 127 bytes, and setting the preemption time to be 0;
the time calculation module is further configured to, when the length of the second data to be sent is greater than 127 bytes, calculate a theoretical maximum length that can be sent before the second data to be sent is preempted according to the expected time delay and the theoretical time delay, compare the theoretical maximum length, a difference between the length of the second data to be sent and 127 bytes, take a smaller value as the maximum length that can be sent at the time before the second data to be sent is preempted, and set the time for sending the maximum length data as the preemption time.
On the basis of the above technical solution, the eMAC and the pMAC are both located in the MAC layer, and the system further includes:
a MAC merging sublayer establishing unit, configured to establish a MAC merging sublayer below the MAC layer, where the MAC merging sublayer is configured to send, receive, check, and filter the first to-be-sent data and the second to-be-sent data.
On the basis of the above technical solution, the data classification unit is specifically configured to acquire each piece of data to be sent, and a preset priority classification policy classifies each piece of data to be sent into first data to be sent and second data to be sent, where the first data to be sent has a higher priority than the second data to be sent;
the data classification unit is further specifically configured to store the first data to be sent to an eMAC, and store the second data to be sent to the pMAC.
The data sending method and system based on the time delay constraint can bring at least one of the following beneficial effects:
1. in the invention, the preemption control module calculates whether the eMAC data is preempted and the time of the pMAC data is preempted through the expected time delay and the theoretical time delay, and can reasonably arrange the transmission of the eMAC data and the pMAC data.
2. In the invention, the preemption control module controls the time for sending the first data to be sent to the MAC merging sublayer, so that the pMAC data is allowed to be sent fairly under the time delay constraint condition of the eMAC data, and the pMAC data is prevented from being in a transmission waiting state for a long time.
3. In the invention, the preemption control module controls and sends the first data to be sent to the MAC merging sublayer under the time delay constraint condition, thereby overcoming the defect of the reduction of the overall performance of the system caused by frequent preemption.
Drawings
The above features, technical features, advantages and implementation of a data transmission method and system based on delay constraints will be further described in the following preferred embodiments in a clearly understandable manner with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating steps of a data transmission method based on a delay constraint in embodiment 1 of the present invention;
fig. 2 is a flowchart of step S3 in a data sending method based on a delay constraint in embodiment 1 of the present invention;
fig. 3 is a flowchart of step S304b in the data sending method based on the delay constraint in embodiment 1 of the present invention;
FIG. 4 is a system block diagram of the 802.3br standard in embodiment 1 of the present invention;
fig. 5 is a flowchart of steps B1-B8 in a data transmission method based on a delay constraint in embodiment 1 of the present invention;
fig. 6 is a block diagram of a data transmission system based on a delay constraint in embodiment 2 of the present invention;
fig. 7 is a block diagram of a preemption control unit in a data transmission system based on delay constraints in embodiment 2 of the present invention;
fig. 8 is a block diagram of a control subunit in a data transmission system based on delay constraints in embodiment 2 of the present invention;
fig. 9 is a schematic structural diagram of a data transmission system based on a delay constraint in embodiment 2 of the present invention during operation.
In the figure:
1. an initialization unit; 2. a data classification unit; 3. a time delay calculating unit; 4. a preemption control unit; 40. identifying a subunit; 41. a transmitting subunit; 42. an analysis subunit; 43. a control subunit; 430. a data calling module; 431. a time calculation module; 5. and a MAC merging sublayer establishing unit.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
Embodiments of the present invention provide a data sending method and system based on delay constraint, so as to enable low-priority data to have more transmission opportunities as far as possible and reduce the delay of the low-priority data, thereby improving the overall performance of the system and ensuring the relative fairness of service stream transmission.
In order to achieve the technical effects, the general idea of the application is as follows:
a data transmission method based on time delay constraint comprises the following steps:
s1, dividing the sending queue into two priority queues of eMAC and pMAC, wherein the priority of the eMAC is higher than that of the pMAC;
s2, storing a plurality of data to be sent into corresponding priority queues according to priorities, calculating the time required for sending the first data to be sent in the eMAC in an interference-free state, and recording the time as theoretical time delay;
and S3, when the execution parameter of the service primitive corresponding to the first data to be sent is maintained, calculating the waiting preemption time required by sending the first data to be sent according to the preset expected time delay, the theoretical time delay and the second data to be sent in the pMAC, and sending the first data to be sent according to the preemption time.
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Example 1
Referring to fig. 1 to 5, embodiment 1 of the present invention provides a data transmission method based on a delay constraint, where the method includes the following steps:
s1, dividing the sending queue into two priority queues of eMAC and pMAC, wherein the priority of the eMAC is higher than that of the pMAC;
s2, storing a plurality of data to be sent into corresponding priority queues according to priorities, calculating the time required for sending the first data to be sent in the eMAC in an interference-free state, and recording the time as theoretical time delay;
and S3, when the execution parameter of the service primitive corresponding to the first data to be sent is maintained, calculating the waiting preemption time required by sending the first data to be sent according to the preset expected time delay, the theoretical time delay and the second data to be sent in the pMAC, and sending the first data to be sent according to the preemption time.
In the embodiment of the invention, a traditional sending queue is divided into an eMAC (enhanced multiunit access control) priority queue and a pMAC priority queue according to requirements, wherein the eMAC has a high priority, the pMAC has a low priority, and the eMAC has a priority higher than that of the pMAC and is respectively used for processing sending tasks with different priorities;
furthermore, the system stores a plurality of stored data to be sent into corresponding priority queues according to priorities, calculates the time required for sending the first data to be sent in the eMAC in an interference-free state, and records the time as theoretical time delay, so that the time required for sending the first data to be sent in the eMAC in an ideal state can be obtained under the current line condition without interference of other factors;
then, when the execution parameter of the service primitive corresponding to the first data to be sent is maintained, calculating and determining whether the data in the eMAC is preemptively sent or not and the current time and the waiting time of the eMAC according to the preset expected time delay, the theoretical time delay and the second data to be sent in the pMAC, particularly the length of the second data to be sent in the pMAC,
and finally, sending the first data to be sent according to the preemption time.
The embodiment of the invention realizes that the low-priority data has more transmission opportunities and reduces the time delay of the low-priority data as far as possible under the condition of meeting the time delay constraint condition of the high-priority frame, thereby improving the overall performance of the system and ensuring the relative fairness of service flow transmission.
In another implementation manner in the embodiment of the present invention, the eMAC and the pMAC are both located in the MAC layer, and the method further includes the following steps:
and an MAC merging sublayer is established below the MAC layer and used for sending, receiving, checking and filtering the first data to be sent and the second data to be sent.
Specifically, in this embodiment, delay estimation and preemption control are added based on 802.3br, and fig. 4 is a system block diagram of the 802.3br standard. The 802.3br standard divides the MAC layer into eMAC and pMAC: the eMAC supports fast frames, namely high-priority data, the pMAC supports preemptible frames (ordinary frames), namely low-priority data, an MAC merging sublayer is arranged below the MAC layer, and the MAC merging sublayer is responsible for sending, receiving, checking, filtering and the like of the fast frames and the ordinary frames. Request service primitive defines a request to hold or release traffic from a MAC Client (MAC Client) to the MAC merge sub-layer. The service primitive, that is, the operation instruction corresponding to the data to be sent, is initiated by the MAC Client above the MAC layer, and the MAC merging sublayer receives and executes the relevant operation. The service primitive may carry the corresponding execution parameters: when holding (Hold) parameters are carried, the MAC merging Sublayer is allowed to perform frame preemption, when the MAC merging Sublayer judges that specific preemption conditions are allowed, common frames can be preempted, the sending of new frames in the pMAC is prevented until a request for carrying Release parameters is received, when the Release parameters are carried, the MAC merging Sublayer is allowed to send the common frames in the pMAC when the eMAC does not have quick frame sending, and the MAC merging Sublayer sends data to a coordination Sublayer (RS) and then forwards the data to a Physical layer (PHY).
The embodiment prioritizes the data according to a predefined prioritization policy, and the predefined prioritization policy is stored outside the system and can be predefined according to the actual service condition. For example, the priority classification policy may be classified according to the priority of the ethernet, or according to the source IP address, the destination IP address, the source port number, the destination port number, and the like of the service packet.
Only the eMAC and pMAC are included in the 802.3b standard, but a designer may define multiple priority queues in the eMAC and pMAC as desired. The method comprises the steps of initializing the expected time delay, namely setting the expected time delay of the service according to a predefined time delay grade, and storing messages of the same time delay grade in the same queue. And the expected time delay is associated with the data to be sent in the corresponding priority queue, so that the data to be sent is not collided.
The preemption request of the MM _ Ctrl.request service primitive from the MAC Client is not implemented immediately, but is calculated according to an expected time delay and a theoretical time delay so as to determine whether to preempt and the preemption time, wherein the expected time delay refers to the expected time delay set in an initialization module by a priority queue of data to be sent and represents the requirement of the time delay, the theoretical time delay refers to the sending time delay calculated under the condition of no interference of the data to be sent according to the current line bandwidth condition and represents the consumption of the time delay, the preemption time refers to the time/length of allowing pMAC data to be sent continuously under the condition of guaranteeing the time delay constraint of the eMAC data after the data to be sent are received, the MM _ Ctrl.request service primitive from the MAC Client is sent after the preemption time is calculated, and the parameters of the service primitive are kept unchanged.
The system stores a plurality of pieces of data to be sent, and when a piece of data to be sent is obtained, the time for sending the data to be sent to the MAC merging sublayer is determined according to the service primitive and the time delay of one piece of data to be sent. The system only acquires one service primitive at the same time, so that only one piece of data to be sent is processed at the same time, and all the data systems to be sent process one by one.
The invention is based on the frame preemption framework of 802.3br, carries out priority division on data according to a predefined priority division strategy, further divides the priority of queues in eMAC and pMAC, and then sets the expected time delay to ensure that the data to be sent is orderly sent without generating conflict. And calculating whether the quick frame can preempt the common frame and the specific preemption opportunity according to the time delay constraint condition. Under the condition of ensuring the time delay requirement of the quick frame, the probability of the occupation of the common frame can be reduced to the maximum extent, so that the occupation overhead of the whole system is reduced, and the throughput of the system is improved. Meanwhile, the probability of competition of the common frame to the use of the communication line is increased, so that the common frame has more transmission opportunities, and the relative fairness of transmission among different services is ensured.
In another implementation manner in the embodiment of the present invention, the method further includes a service primitive execution process, where the service primitive execution process includes the following steps:
s301, receiving a service primitive and identifying an execution parameter of the service primitive;
s302a, if the execution parameter of the service primitive is release, not sending the first data to be sent;
s302b, if the execution parameter of the service primitive is maintained, calculating whether to perform preemption operation according to the expected time delay and the theoretical time delay;
s303a, when the calculation result is that the preemption is not performed, the first data to be sent is not sent;
s303b, when the calculation result is preemption, judging the time for sending the first data to be sent;
s304a, when the expected time delay is not larger than the theoretical time delay, sending the first data to be sent;
s304b, when the expected delay is greater than the theoretical delay, calculating a preemption time required for sending the first to-be-sent data, and after waiting for a duration corresponding to the preemption time, sending the first to-be-sent data.
In another implementation manner of the embodiment of the present invention, when the expected time delay is greater than the theoretical time delay, calculating preemption time required to wait for sending the first to-be-sent data, and after waiting for a duration corresponding to the preemption time, sending the first to-be-sent data, that is, step S304b, specifically includes the following steps:
a1, obtaining the length of the second data to be sent, and calculating the length of the second data to be sent which can be sent before the second data to be sent is preempted;
a2, if the length of the second data to be sent is not more than 127 bytes, the maximum length which can be sent before the second data to be sent is preempted is 0, and the first data to be sent is sent;
and A3, if the length of the second data to be sent is greater than 127 bytes, calculating the theoretical maximum length which can be sent before the second data to be sent is preempted according to the expected time delay and the theoretical time delay, comparing the theoretical maximum length, the difference between the length of the second data to be sent and 127 bytes, taking the smaller value as the maximum length which can be sent before the second data to be sent is preempted, and taking the time for sending the maximum length data as the preemption time.
Specifically, in actual operation, in this embodiment, after receiving the first to-be-transmitted data, identifying an execution parameter of a service primitive corresponding to the first to-be-transmitted data, if the execution parameter of the service primitive is released, not sending the first to-be-transmitted data, if the execution parameter of the service primitive is maintained, acquiring an expected time delay and a theoretical time delay, and calculating whether to perform preemption according to the expected time delay and the theoretical time delay;
when the calculation result is that preemption is not performed, the first data to be sent is not sent, and when the calculation result is that preemption is performed, the time for sending the first data to be sent is calculated: when the expected time delay is less than or equal to the theoretical time delay, the first data to be sent is sent immediately, when the expected time delay is greater than the theoretical time delay, the maximum length L (eMAC waiting time t) which can be sent before the pMAC is preempted is calculated, the length (M) of the second data to be sent in the pMAC is obtained, according to the condition that 802.3br allows preemption, if the length (M) is less than or equal to 127 bytes, the length of the second data to be sent is less than the minimum unit length by one frame, therefore, the maximum length (M) which can be sent before the pMAC is preempted is 0, the first data to be sent immediately, otherwise, if the length (M) of the pMAC data is greater than 127 bytes, the theoretically sent maximum length (L0) which can be sent before the pMAC is preempted is calculated according to the difference value of the expected time delay of the eMAC and the theoretical time delay and the line bandwidth, the smaller value between (M-127), the eMAC waits for the pMAC to send data with the length of L, the waiting time is t, after the timer expires, the first data to be sent is sent to the MAC merging sublayer, and then the first data to be sent is sent.
In another embodiment of the present invention, storing a plurality of data to be sent into corresponding priority queues according to priorities includes the following steps:
acquiring data to be sent, and dividing the data to be sent into first data to be sent and second data to be sent by a preset priority dividing strategy, wherein the priority of the first data to be sent is higher than that of the second data to be sent;
and storing the first data to be transmitted into the eMAC, and storing the second data to be transmitted into the pMAC.
Specifically, in this embodiment, data to be transmitted is divided according to a preset priority division strategy, the data to be transmitted is divided into corresponding priority queues in the eMAC and the pMAC, an expected time delay is set, the expected time delay and data to be transmitted in the corresponding priority queues are associated, so that the data to be transmitted is not collided, and the expected time delay is a time delay set for the data to be transmitted;
acquiring expected time delay, and calculating theoretical time delay of data to be transmitted, wherein the theoretical time delay is the time delay theoretically required for transmitting the data to be transmitted;
receiving first data to be transmitted, calculating time for transmitting the first data to be transmitted according to expected time delay and theoretical time delay, and transmitting the first data to be transmitted according to the calculated time;
after the preemption time is calculated, the service primitive of the MM _ Ctrl.request from the MAC Client is forwarded to the MAC merging sublayer, and the MAC merging sublayer executes corresponding actions according to the service primitive, identifies the execution parameters corresponding to the first data to be sent and sends the first data to be sent.
In another implementation manner in the embodiments of the present invention, an example of a data transmission method with a time delay constraint according to the present invention is shown in fig. 5, and includes the following steps:
step B1, receiving MM _ Ctrl.request service primitive, the MM _ Ctrl.request service primitive is defined by MACClient according to 802.3br standard, and eMAC and pMAC carry out data relevant processing according to the standard;
step B2, if the parameter of MM _ ctrl. request service primitive is hold, go to step B3, otherwise, go to step B8;
step B3, the preemption control module calls a time delay estimation module to obtain the expected time delay and the theoretical time delay of the data to be sent in the eMAC;
step B4, judging the expected time delay and the theoretical time delay of the eMAC, and if the expected time delay is less than or equal to the theoretical time delay, turning to step B8;
step B5, calling a time delay estimation module to calculate the maximum length L (eMAC waiting time t) which can be sent before the pMAC is preempted;
step B501, acquiring the length (marked as M) of data to be sent of the pMAC, and if the M is less than or equal to 127 bytes, the maximum length which can be sent before the pMAC is preempted is 0 according to the condition that 802.3br allows preemption;
step B502, calculating the theoretically transmittable maximum length (marked as L0) of the pMAC before being preempted according to the difference value of the expected time delay and the theoretical time delay of the eMAC and the line bandwidth, and taking the smaller value between the (M-127) and the L0 as the transmittable maximum length of the pMAC before being preempted;
step B6, if the data length (waiting time) that can be sent before the pMAC is preempted is 0, go to step B8;
step B7, starting a timer, waiting for the data with the length L sent by the pMAC by the eMAC, waiting for t, and turning to step B8 after the timer expires;
step B8, the preemption control module sends the MM _ ctrl. request service primitive to the MAC merging sublayer, and then the MAC merging sublayer responds to the execution parameters in the service primitive.
Example 2
Referring to fig. 6 to 9, embodiment 2 of the present invention provides a data transmission system based on a delay constraint, where the system includes:
an initialization unit 1, configured to divide a transmission queue into two priority queues, namely, an eMAC queue and a pMAC queue, where the priority of the eMAC queue is higher than that of the pMAC queue;
the data classification unit 2 is used for storing a plurality of data to be sent into corresponding priority queues according to priorities;
the delay calculation unit 3 is configured to calculate, when an execution parameter of a service primitive corresponding to the first to-be-transmitted data is hold, a waiting preemption time required for transmitting the first to-be-transmitted data according to a preset expected delay, a theoretical delay and second to-be-transmitted data in the pMAC;
and the preemption control unit 4 is used for sending the first data to be sent after waiting for the duration corresponding to the preemption time according to the preemption time.
In the embodiment of the invention, a traditional sending queue is divided into an eMAC (enhanced multiunit access control) priority queue and a pMAC priority queue according to requirements, wherein the eMAC has a high priority, the pMAC has a low priority, and the eMAC has a priority higher than that of the pMAC and is respectively used for processing sending tasks with different priorities;
furthermore, the system stores a plurality of stored data to be sent into corresponding priority queues according to priorities, calculates the time required for sending the first data to be sent in the eMAC in an interference-free state, and records the time as theoretical time delay, so that the time required for sending the first data to be sent in the eMAC in an ideal state can be obtained under the current line condition without interference of other factors;
then, when the execution parameter of the service primitive corresponding to the first data to be sent is maintained, calculating and determining whether the data in the eMAC is preemptively sent or not and the current time and the waiting time of the eMAC according to the preset expected time delay, the theoretical time delay and the second data to be sent in the pMAC, particularly the length of the second data to be sent in the pMAC,
and finally, sending the first data to be sent according to the preemption time.
The embodiment of the invention realizes that the low-priority data has more transmission opportunities and reduces the time delay of the low-priority data as far as possible under the condition of meeting the time delay constraint condition of the high-priority frame, thereby improving the overall performance of the system and ensuring the relative fairness of service flow transmission.
In another embodiment of the present invention, the eMAC and the pMAC are both located in the MAC layer, and the system further includes:
and the MAC merging sublayer establishing unit 5 is configured to establish a MAC merging sublayer below the MAC layer, where the MAC merging sublayer is configured to send, receive, check, and filter the first to-be-sent data and the second to-be-sent data.
Specifically, in this embodiment, delay estimation and preemption control are added based on 802.3br, and fig. 4 is a system block diagram of the 802.3br standard. The 802.3br standard divides the MAC layer into eMAC and pMAC: the eMAC supports fast frames, namely high-priority data, the pMAC supports preemptible frames (ordinary frames), namely low-priority data, an MAC merging sublayer is arranged below the MAC layer, and the MAC merging sublayer is responsible for sending, receiving, checking, filtering and the like of the fast frames and the ordinary frames. Request service primitive defines a request to hold or release traffic from a MAC Client (MAC Client) to the MAC merge sub-layer. The service primitive, that is, the operation instruction corresponding to the data to be sent, is initiated by the MAC Client above the MAC layer, and the MAC merging sublayer receives and executes the relevant operation. The service primitive may carry the corresponding execution parameters: when holding (Hold) parameters are carried, the MAC merging Sublayer is allowed to perform frame preemption, when the MAC merging Sublayer judges that specific preemption conditions are allowed, the MAC merging Sublayer can preempt the common frame and prevent the sending of a new frame in the pMAC until a request for carrying Release parameters is received, when the Release parameters are carried, the MAC merging Sublayer is allowed to send the common frame in the pMAC when the eMAC does not send a quick frame, the MAC merging Sublayer sends data to a coordination Sublayer (RS), and then forwards the data to a physical layer (PHY),
Physical)。
the embodiment prioritizes the data according to a predefined prioritization policy, and the predefined prioritization policy is stored outside the system and can be predefined according to the actual service condition. For example, the priority classification policy may be classified according to the priority of the ethernet, or according to the source IP address, the destination IP address, the source port number, the destination port number, and the like of the service packet.
Only the eMAC and pMAC are included in the 802.3b standard, but a designer may define multiple priority queues in the eMAC and pMAC as desired. The method comprises the steps of initializing the expected time delay, namely setting the expected time delay of the service according to a predefined time delay grade, and storing messages of the same time delay grade in the same queue. And the expected time delay is associated with the data to be sent in the corresponding priority queue, so that the data to be sent is not collided.
The preemption request of the MM _ Ctrl.request service primitive from the MAC Client is not implemented immediately, but is calculated according to an expected time delay and a theoretical time delay so as to determine whether to preempt and the preemption time, wherein the expected time delay refers to the expected time delay set in an initialization module by a priority queue of data to be sent and represents the requirement of the time delay, the theoretical time delay refers to the sending time delay calculated under the condition of no interference of the data to be sent according to the current line bandwidth condition and represents the consumption of the time delay, the preemption time refers to the time/length of allowing pMAC data to be sent continuously under the condition of guaranteeing the time delay constraint of the eMAC data after the data to be sent are received, the MM _ Ctrl.request service primitive from the MAC Client is sent after the preemption time is calculated, and the parameters of the service primitive are kept unchanged.
The system stores a plurality of pieces of data to be sent, and when a piece of data to be sent is obtained, the time for sending the data to be sent to the MAC merging sublayer is determined according to the service primitive and the time delay of one piece of data to be sent. The system only acquires one service primitive at the same time, so that only one piece of data to be sent is processed at the same time, and all the data systems to be sent process one by one.
The invention is based on the frame preemption framework of 802.3br, carries out priority division on data according to a predefined priority division strategy, further divides the priority of queues in eMAC and pMAC, and then sets the expected time delay to ensure that the data to be sent is orderly sent without generating conflict. And calculating whether the quick frame can preempt the common frame and the specific preemption opportunity according to the time delay constraint condition. Under the condition of ensuring the time delay requirement of the quick frame, the probability of the occupation of the common frame can be reduced to the maximum extent, so that the occupation overhead of the whole system is reduced, and the throughput of the system is improved. Meanwhile, the probability of competition of the common frame to the use of the communication line is increased, so that the common frame has more transmission opportunities, and the relative fairness of transmission among different services is ensured.
In another implementation manner of the embodiment of the present invention, the preemption control unit 4 includes:
an identification subunit 40, configured to receive the service primitive, and identify an execution parameter of the service primitive;
a sending subunit 41, configured to not send the first to-be-sent data when the execution parameter of the service primitive is release;
an analysis subunit 42, configured to, when the execution parameter of the service primitive is hold, calculate whether to perform preemption job according to the expected delay and the theoretical delay;
the analysis subunit 42 is further configured to not send the first data to be sent when the calculation result indicates that preemption is not to be performed;
the analysis subunit 42 is further configured to, when the calculation result is that preemption is performed, determine a time to send the first data to be sent;
a sending subunit 41, configured to send the first to-be-sent data when the expected delay is not greater than the theoretical delay;
a control subunit 43, configured to calculate, when the expected delay is greater than the theoretical delay, a waiting preemption time required for sending the first to-be-sent data;
and the sending subunit 41 is further configured to send the first data to be sent after waiting for the duration corresponding to the preemption time.
In another embodiment of the present invention, the control subunit 43 includes:
the data calling module 430 is configured to obtain the length of the second data to be sent, and call the delay calculation module to calculate the length that the second data to be sent can be sent before being preempted;
a time calculating module 431, configured to determine that the maximum length that can be sent before the pMAC data is preempted is 0 and set the preemption time to be 0 when the length of the pMAC data is less than or equal to 127 bytes;
the time calculating module 431 is further configured to, when the length of the second data to be sent is greater than 127 bytes, calculate a theoretical maximum length that can be sent before the second data to be sent is preempted according to the expected time delay and the theoretical time delay, compare differences between the theoretical maximum length, the length of the second data to be sent, and 127 bytes, take a smaller value as the maximum length that can be sent at a time before the second data to be sent is preempted, and set the time for sending the maximum length data as the preemption time.
Specifically, in actual operation, in this embodiment, after receiving the first to-be-transmitted data, identifying an execution parameter of a service primitive corresponding to the first to-be-transmitted data, if the execution parameter of the service primitive is released, not sending the first to-be-transmitted data, if the execution parameter of the service primitive is maintained, acquiring an expected time delay and a theoretical time delay, and calculating whether to perform preemption according to the expected time delay and the theoretical time delay;
when the calculation result is that preemption is not performed, the first data to be sent is not sent, and when the calculation result is that preemption is performed, the time for sending the first data to be sent is calculated: when the expected time delay is less than or equal to the theoretical time delay, the first data to be sent is sent immediately, when the expected time delay is greater than the theoretical time delay, the maximum length L (eMAC waiting time t) which can be sent before the pMAC is preempted is calculated, the length (M) of the second data to be sent in the pMAC is obtained, according to the condition that 802.3br allows preemption, if the length (M) is less than or equal to 127 bytes, the length of the second data to be sent is less than the minimum unit length by one frame, therefore, the maximum length (M) which can be sent before the pMAC is preempted is 0, the first data to be sent immediately, otherwise, if the length (M) of the pMAC data is greater than 127 bytes, the theoretically sent maximum length (L0) which can be sent before the pMAC is preempted is calculated according to the difference value of the expected time delay of the eMAC and the theoretical time delay and the line bandwidth, the smaller value between (M-127), the eMAC waits for the pMAC to send data with the length of L, the waiting time is t, after the timer expires, the first data to be sent is sent to the MAC merging sublayer, and then the first data to be sent is sent.
In another embodiment of the present invention, the data classifying unit 2 is specifically configured to acquire each data to be sent, and a preset priority classification policy classifies each data to be sent into a first data to be sent and a second data to be sent, where the priority of the first data to be sent is higher than that of the second data to be sent;
the data classification unit 2 is further specifically configured to store the first data to be transmitted into the eMAC, and store the second data to be transmitted into the pMAC.
Specifically, in this embodiment, data to be transmitted is divided according to a preset priority division strategy, the data to be transmitted is divided into corresponding priority queues in the eMAC and the pMAC, an expected time delay is set, the expected time delay and data to be transmitted in the corresponding priority queues are associated, so that the data to be transmitted is not collided, and the expected time delay is a time delay set for the data to be transmitted;
acquiring expected time delay, and calculating theoretical time delay of data to be transmitted, wherein the theoretical time delay is the time delay theoretically required for transmitting the data to be transmitted;
receiving first data to be transmitted, calculating time for transmitting the first data to be transmitted according to expected time delay and theoretical time delay, and transmitting the first data to be transmitted according to the calculated time;
after the preemption time is calculated, the service primitive of the MM _ Ctrl.request from the MAC Client is forwarded to the MAC merging sublayer, and the MAC merging sublayer executes corresponding actions according to the service primitive, identifies the execution parameters corresponding to the first data to be sent and sends the first data to be sent.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.