WO2019096246A1 - 调度数据的方法和交换设备 - Google Patents

调度数据的方法和交换设备 Download PDF

Info

Publication number
WO2019096246A1
WO2019096246A1 PCT/CN2018/115887 CN2018115887W WO2019096246A1 WO 2019096246 A1 WO2019096246 A1 WO 2019096246A1 CN 2018115887 W CN2018115887 W CN 2018115887W WO 2019096246 A1 WO2019096246 A1 WO 2019096246A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
queue
original
target
counter
Prior art date
Application number
PCT/CN2018/115887
Other languages
English (en)
French (fr)
Inventor
胡农达
曹政
刘小丽
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP18879244.4A priority Critical patent/EP3700149B1/en
Publication of WO2019096246A1 publication Critical patent/WO2019096246A1/zh
Priority to US16/875,215 priority patent/US11218417B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6295Queue scheduling characterised by scheduling criteria using multiple queues, one for each individual QoS, connection, flow or priority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/34Flow control; Congestion control ensuring sequence integrity, e.g. using sequence numbers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/622Queue service order
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6255Queue scheduling characterised by scheduling criteria for service slots or service orders queue load conditions, e.g. longest queue first
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/30Peripheral units, e.g. input or output ports
    • H04L49/3018Input queuing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9015Buffering arrangements for supporting a linked list

Definitions

  • the present application relates to the field of information technology, and more particularly to a method and a switching device for scheduling data.
  • Switching devices typically contain multiple queues.
  • the switching device may switch the queue that receives the data stream during the process of receiving the data stream.
  • the switching device selects the queue for which the data stream needs to be input according to the size of the received data stream.
  • the switching device will recognize the stream of mice when it begins to receive the data stream. In this case, the data stream will be entered into the queue corresponding to the mouse stream.
  • the switching device identifies the data stream as an elephant stream. In this way, the switching device switches the queue that receives the data stream from the queue corresponding to the mouse stream to the queue corresponding to the elephant stream.
  • the switching device selects a queue for which the data stream needs to be input according to whether the received data stream is a data stream that causes congestion.
  • the switching device considers the data stream to be an uncongested data stream when it begins to receive the data stream. Therefore, the data stream is entered into the queue corresponding to the non-congested data stream.
  • the switching device identifies the data stream as a congested data stream, and the switching device switches the queue that receives the data stream from the queue corresponding to the non-congested data stream to the queue corresponding to the congested data stream.
  • the output order of the data unit output by the switching device needs to be consistent with the input order of the data unit.
  • the switching device receives data units 1 through 7 in sequence when receiving the data stream.
  • the order of the data units output by the switching device also needs to be guaranteed to be 1 to 7.
  • a feasible technical solution is to move the data unit input into the queue before the switching to the switched queue.
  • data units 1 through 6 have been input to a queue (hereinafter referred to as a source queue).
  • the target queue After the data stream is switched from the queue to another queue (hereinafter referred to as the target queue), the target queues in which the data units 1 to 6 are moved from the source queue are first input, and then the data unit 7 is input to the target queue.
  • the switching device needs to traverse the access source queue to determine the data unit that needs to be moved, which introduces a very large access overhead, thereby seriously affecting the performance of the switching device to process the data stream normally.
  • queues typically only support first-in, first-out scheduling.
  • mobile packets need to support random access, which will greatly increase the complexity of queue management.
  • the embodiment of the present application provides a method for scheduling data and a switching device, which can avoid data stream disorder.
  • an embodiment of the present application provides a method for scheduling data, where the method includes: receiving N 1 data units from a first data stream, where the data unit is a descriptor of a data packet or a data packet, where N 1 is a positive integer greater than or equal to 1; inputting the N 1 data unit into the first original queue; determining that the first data stream is switched from the first original queue to the first target queue, wherein the first original queue and the first The target queue belongs to the first queue pair; the first original marking unit is input to the first original queue and the first target marking unit is input to the first target queue; and M 1 data units from the first data stream are received, wherein M 1 is a positive integer greater than or equal to 1; the M 1 data unit is input to the first target queue; according to the first original marking unit and the first target marking unit, the N 1 data unit and the first the original flag unit schedules the first queue and the original first target marking unit M 1 and the data of the first target unit schedules the queue, wherein the first prime mark unit schedules
  • the above technical solution only needs to input the original marking unit and the target marking unit into the original queue and the target queue respectively, so that the input order and the output order of the N data units and the M data units can be the same. Therefore, the above technical solution does not need to switch data units from one queue to another. Therefore, the complexity of the above technical solution queue management is low. In addition, the above technical solution does not need to select a partial data unit from a queue, which does not require the switching device to support random access. Therefore, the above technical solution provides a simple method for avoiding data stream disorder.
  • the marking unit according to the first primary and the first target marking unit, the data unit and the N 1 of the first prime mark unit schedules the first queue is the original and the marking unit and the first target data unit M 1 illustrating the first target queue scheduling, comprising: a first prime mark based on the first target unit and the marking unit, the N 1 after a first original data unit and the marker unit schedules the queue of the first original and the first original marking unit of the first scheduling the original queue, marking the first target unit and the data unit schedules M 1 Out of the first target queue.
  • the N 1 data unit is configured according to the first original label unit and the first target label unit after the marking unit and the first prime the scheduling queue of the first original and the first original marking unit schedule the queue of the first original
  • the marking unit and the first target data M 1 to the first unit schedules the a target queue includes: determining whether the first to-be-scheduled unit is the first original marking unit, where the first to-be-scheduled unit is the first unit to be scheduled in the original queue; determining whether the second to-be-scheduled unit is the a first target marking unit, wherein the second to-be-scheduled unit is the first unit to be scheduled in the target queue; the first to-be-scheduled unit is not the first original marking unit and the second to-be-scheduled unit is not In the case of the first target marking unit, the first to-be-scheduled unit and the second to-be-scheduled unit are scheduled according to a preset rule
  • the unit is the first target marking unit
  • the third to-be-scheduled unit is the first unit to be scheduled in the first original queue after the first scheduled unit is scheduled to be the first original queue.
  • the fourth to-be-scheduled unit is the first unit to be scheduled in the first target queue after the second to-be-scheduled unit is scheduled to be the first target queue; the first to-be-scheduled unit is not the first
  • the original marking unit is the first target marking unit
  • the first to-be-scheduled unit is scheduled to be out of the original queue
  • the method further includes: When the marking unit inputs the first original queue, the value of the first original counter in the first counter pair is incremented by one; in the case that the first target flag is input into the first target queue, the first counter is Adding a value of the first target counter of the pair, wherein the first counter pair corresponds to the first queue pair, the first original counter corresponds to the first original queue, and the first target counter corresponds to the first target a queue; if the first original tag unit schedules the first original queue, the value of the first original counter is decremented by 1; if the first target tag unit schedules the first target queue, The value of the first target counter is decremented by one. In this way, it can be avoided that when the original queue is the original queue of another queue or the target queue of another queue, the scheduling queue cannot be correctly selected.
  • the method before the first target marking unit is scheduled to be out of the first target queue, the method further includes: determining The value of the first original counter is less than the value of the first target counter. In this way, it can be avoided that when the original queue is the original queue of another queue or the target queue of another queue, the scheduling queue cannot be correctly selected.
  • the original marking unit carries the first number information
  • the target tag unit carries the first number information and the second number information, wherein the first number information is a number of the original counter, and the second number information is a number of the target counter; the method further includes: according to the first number The information and the second number information determine the original counter and the target counter.
  • the original counter and the target counter in the counter pair to be compared may be determined according to the first number information and the second number information.
  • the method further includes: receiving the second data stream N 2 data units, where N 2 is a positive integer greater than or equal to 1; inputting the N 2 data units into the first original queue; determining that the second data stream is switched from the first original queue to the first a target queue; inputting a second original marking unit into the first original queue and inputting a second target marking unit into the first target queue; receiving M 2 data units from the second data stream, wherein M 1 is greater than or equal to a positive integer of 1; inputting the M 2 data units into the first target queue; and scheduling the N 2 data units and the second original marking unit according to the second original marking unit and the second target marking unit
  • the first original queue and the second target marking unit and the M 2 data units are scheduled out of the first target queue, wherein the second original marking unit schedules the first original queue earlier than the second target Scheduling unit scheduling a time of the first target queue; in the case where the second original marking unit schedules the first original queue earlier than the second target Scheduling unit scheduling a time of the first target queue; in
  • the method further includes: receiving N 3 data units from the third data stream, where N 3 is a positive integer greater than or equal to 1; inputting the N 3 data units into the second original queue; determining the third data stream from the first The second original queue is switched to the second target queue, wherein the second original queue and the second target queue belong to the second queue pair, the second original queue is different from the first original queue and/or the second target queue is The first target queue is different; the third original marker unit is input to the second original queue and the third target marker unit is input to the second target queue; and M 3 data units from the third data stream are received, where M 1 is a positive integer greater than or equal to 1; inputting the M 3 data units into the second target queue; and according to the third original marking unit and the third target marking unit, the N 3 data units and the third original marking The unit dispatches the second Queue means and the third target mark
  • the embodiment of the present application further provides a switching device, where the switching device includes a unit for implementing the first aspect or any possible implementation manner of the first aspect.
  • an embodiment of the present application provides a switching device, where the switching device includes: a memory, configured to store a program, and a processor, configured to execute the program stored in the memory, when the program is executed, where The processor is for performing the method of the first aspect or any one of the possible implementations of the first aspect.
  • the switching device is a chip or an integrated circuit.
  • the embodiment of the present application provides a method for performing the first aspect or any one of the possible implementation manners of the first aspect.
  • an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores instructions, when the instructions are run on a computer, causing the computer to execute the method described in the foregoing aspects. .
  • an embodiment of the present application provides a computer program product comprising instructions, when the computer program product is run on a computer, causing the computer to perform the method described in the above aspects.
  • FIG. 1 is a schematic flowchart of a method for scheduling data according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • FIG. 6 is a structural block diagram of a switching device according to an embodiment of the present application.
  • FIG. 7 is a structural block diagram of another switching device according to an embodiment of the present application.
  • the switching device referred to in the embodiment of the present application may be a switching device in a wide area network, or may be a switching device in a local area network.
  • the switching device referred to in the embodiment of the present application may be a switch, such as an Ethernet switch, a fiber switch, a Fast Ethernet switch, a Gigabit Ethernet switch, or the like.
  • the switching device referred to in the embodiment of the present application may also be a router such as an access router, a backbone router, a wired router, a wireless router, or the like.
  • the switching device referred to in the embodiment of the present application may also be other network devices having the same function as the switch or the router.
  • the data unit referred to in the embodiment of the present application may be a data packet or a descriptor of the data packet.
  • FIG. 1 is a schematic flowchart of a method for scheduling data according to an embodiment of the present application. The method shown in Figure 1 can be performed by a switching device.
  • N 1 data units from a first data stream, where the data unit is a descriptor of a data packet or a data packet, and N 1 is a positive integer greater than or equal to 1.
  • M 1 is a positive integer equal to or greater than 1.
  • the N 1 data unit and the first original label unit are scheduled out of the first original queue according to the first original label unit and the first target label unit, and the first target label unit and the M 1 are The data unit dispatches the first target queue, wherein the time when the first original labeling unit schedules the first original queue is earlier than the time when the first target scheduling unit schedules the first target queue.
  • the method shown in FIG. 1 only needs to input the original label unit and the target label unit into the original queue and the target queue respectively, so that the input order and the output order of the N 1 data unit and the M 1 data unit can be the same. Therefore, the above technical solution does not need to switch data units from one queue to another. Therefore, the complexity of the above technical solution queue management is low. In addition, the above technical solution does not need to select a partial data unit from a queue, which does not require the switching device to support random access. Therefore, the above technical solution provides a simple method for avoiding data stream disorder.
  • the data unit in the first data stream first enters the first original queue, and then switches from the first original queue to the first target queue. Therefore, in the method shown in FIG. 1, steps 101 to 107 are sequentially performed. Meanwhile, for a plurality of data units belonging to the same queue, the plurality of data units are scheduled to be queued in a first-in first-out manner.
  • the original tag unit eg, the first original tag unit
  • the target tag unit eg, the first target tag unit
  • the original tag unit e.g. the first original tag unit
  • the target tag unit e.g. the first target tag unit
  • the format and/or content of the marking unit is different from the format and/or content of the data unit.
  • the switching device can distinguish whether the unit to be scheduled is a marking unit or a data unit according to the format and/or content in the original marking unit and the target marking unit.
  • the N 1 data unit and the first original label unit are scheduled out of the first original queue according to the first original marking unit and the first target marking unit, and the first target marks M 1 and a unit of data units that the first target queue scheduling, comprising: a first prime mark based on the first target unit and the marking unit, the data unit and the N 1 of the first primary marker after the first original unit schedules the queue, and the first prime marking unit of the first scheduling the original queue, marking the first target unit and the data unit M 1 illustrating the first target scheduling queue.
  • the N 1 data unit and the first original label unit are scheduled out of the first original queue according to the first original marking unit and the first target marking unit, and after the first prime mark unit schedules the queue of the first original, the marking unit and the first target data unit M 1 illustrating the first target queue scheduling, comprising: determining whether a first scheduling unit is the first to be The original marking unit, wherein the first to-be-scheduled unit is the first unit to be scheduled in the original queue; determining whether the second to-be-scheduled unit is the first target marking unit, wherein the second to-be-scheduled unit is the target queue The first unit to be scheduled; if the first to-be-scheduled unit is not the first original marking unit and the second to-be-scheduled unit is not the first target marking unit, scheduling the first according to a preset rule a scheduling unit and the second to-be-scheduled unit, and determining whether the third to-be-scheduled unit is the first original marking unit, determining whether the fourth to
  • the preset scheduling rule may be a rule such as a polling schedule, a weighted round robin scheduling, or a strict priority scheduling.
  • the scheduling device may also maintain a counter pair corresponding to the queue pair.
  • the first counter pair corresponds to the first queue pair.
  • the first counter pair includes a first original counter and a first target counter.
  • the first original counter corresponds to the first original queue
  • the first target counter corresponds to the first target queue.
  • the value of the first original counter is incremented by one; in the case that the first target marking is input to the first target queue, the first The value of the target counter is incremented by one; in the case that the first original marking unit schedules the first original queue, the value of the first original counter is decremented by one; and the first target marking unit is scheduled to be the first target queue In the case of this, the value of the first target counter is decremented by one. In this way, it can be avoided that when the original queue is the original queue of another queue or the target queue of another queue, the scheduling queue cannot be correctly selected.
  • the method before the first target marking unit is scheduled out of the first target queue, the method further comprises: determining that the value of the first original counter is smaller than the value of the first target counter. In other words, if the value of the first original counter is greater than or equal to the value of the first target counter before the second scheduling unit is scheduled to be out of the target queue, the second to-be-scheduled unit is not scheduled to be the first Target queue. In this case, the to-be-scheduled unit in the first original queue may continue to be scheduled out of the first original queue. In this way, it can be avoided that when the first original queue is the original queue of another queue pair or the target queue of another queue pair, the scheduling queue cannot be correctly selected.
  • the original marking unit carries the first number information
  • the target marking unit carries the first number information and the second number information, wherein the first number information is a number of the original counter,
  • the second number information is a number of the target counter; the method further includes: determining the original counter and the target counter based on the first number information and the second number information.
  • the value of the first original counter in the first counter pair may be incremented according to the first number information; when the first target marking unit When the first target queue is input, the value of the first target counter in the first counter pair may be increased by 1 according to the second number information; when the first original marking unit schedules the first original queue, Determining the value of the first original counter by one according to the first number information; when the first original marking unit schedules the first target queue, the first target counter may be used according to the second numbering information The value is decremented by 1.
  • the first number of the first counter pairs to be compared may be determined according to the first number information and the second number information. The value of the original counter and the value of the first target counter.
  • the method shown in FIG. 1 may further include: receiving N 2 data units from the second data stream, where N 2 is a positive integer greater than or equal to 1; the N 2 data The unit inputs the first original queue; determines that the second data stream is switched from the first original queue to the first target queue; inputs the second original marking unit into the first original queue and inputs the second target marking unit into the first a target queue; receiving M 2 data units from the second data stream, where M 1 is a positive integer greater than or equal to 1; inputting the M 2 data units into the first target queue; according to the second original mark a unit and the second target marking unit, scheduling the N 2 data units and the second original marking unit to the first original queue and scheduling the second target marking unit and the M 2 data units to the first a target queue, wherein the second original marking unit schedules the first original queue earlier than the second target scheduling unit schedules the first target queue; and inputs the second original marking unit into the first original In the case of a queue, The value of an original counter is incremente
  • the method shown in FIG. 1 may further include: receiving N 3 data units from the third data stream, where N 3 is a positive integer greater than or equal to 1; the N 3 data The unit is input to the second original queue; determining that the third data stream is switched from the second original queue to the second target queue, wherein the second original queue and the second target queue belong to a second queue pair, and the second original queue is The first original queue is different and/or the second target queue is different from the first target queue; the third original marking unit is input to the second original queue and the third target marking unit is input to the second target queue; M 3 data units of the third data stream, wherein M 1 is a positive integer greater than or equal to 1; inputting the M 3 data units into the second target queue; according to the third original marking unit and the third target Marking unit, scheduling the N 3 data units and the third original marking unit out of the second original queue and scheduling the third target marking unit and the M 3 data units out of the second target queue, where the The three original marking unit dispatches the first
  • the specific scheduling manner of the data unit in the third data stream is similar to the specific scheduling manner in the data unit in the first data stream, and need not be described here.
  • the second original queue is the same as the first original queue and the second target queue is different from the first target queue, or the second original queue is different from the first original queue and the second target queue is the first
  • the target queues are the same, the counter pairs corresponding to the first queue pair and the second queue pair are different. Therefore, by comparing the value of the original counter in the counter pair with the value of the target counter, it can be avoided that when the first original queue is the original queue of another queue pair or the target queue of another queue pair, the scheduling queue cannot be correctly selected. The situation happened.
  • FIG. 2 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • the queue pair 1 shown in FIG. 2 includes two queues, an original queue 11 and a target queue 12.
  • Data stream 1 is first input to the original queue 11.
  • the data unit input to the original queue 11 includes the data units 10 to 12 in the data stream 1.
  • the marking unit 11 is input to the original queue 11, and the marking unit 12 is input to the target queue 12.
  • the acquired data unit of the data stream 1 is input to the target queue 12.
  • the data unit of the input target queue 12 includes the data unit 13 and the data unit 14 in the data stream 1.
  • the original queue 11 includes four units, which are the data unit 10, the data unit 11, the data unit 12, and the marking unit 11 in sequence, and the first to-be-scheduled unit of the head of the queue is the data unit 10.
  • the target queue 12 includes a total of three units, which in turn are the marking unit 12, the data unit 13 and the data unit 14, and the first to-be-scheduled unit located at the head of the queue is the marking unit 12. Further, the order in which the data stream 1 is input to the data unit in the queue pair 1 is: the data unit 10, the data unit 11, the data unit 12, the data unit 13, and the data unit 14.
  • the switching device determines whether the first to-be-scheduled unit in the original queue 11 is a marking unit, and determines whether the first unit to be scheduled in the target queue 12 is a marking unit. As shown in FIG. 2, the switching device determines that the first to-be-scheduled unit in the original queue 11 is not a marking unit, and determines that the first to-be-scheduled unit in the target queue 12 is a marking unit. In this case, the switching device can schedule the first to-be-scheduled unit in the original queue 11 to the original queue 11, that is, the data unit 10 is scheduled out of the original queue 11. Furthermore, the switching device does not schedule the first to-be-scheduled unit in the target queue 12, namely the marking unit 12.
  • the switching device determines whether the next unit to be scheduled in the original queue 11 is a marked unit. As shown in FIG. 2, the unit to be scheduled after the data unit 10 is the data unit 11. In this case, the switching device will continue to schedule the data unit 11 out of the original queue 11. After the data unit 11 is scheduled out of the original queue 11, the switching device will continue to determine whether the next unit to be scheduled in the queue 11 is a marked unit. As shown in FIG. 2, the unit to be scheduled after the data unit 11 is the data unit 12. In this case, the switching device will continue to schedule the data unit 12 out of the original queue 11.
  • the switching device After the data unit 12 is scheduled out of the original queue 11, the switching device will continue to determine whether the next unit to be scheduled in the original queue 11 is a marked unit. As shown in FIG. 2, the unit to be scheduled after the data unit 12 is the labeling unit 11. In this case, the switching device will dispatch the marking unit 11 out of the original queue 11. After the tag unit 11 is scheduled out of the original queue 11, the switching device can dispatch the tag unit 12 at the head of the target queue 12 out of the target queue 12. After this, the first unit to be scheduled in the target queue 12 is the data unit 13.
  • the switching device may stop scheduling data units from the original queue 11. After the tag unit 12 is scheduled out of the target queue 12, the switching device can determine whether the next unit to be scheduled in the target queue 12 is a tag unit. As shown in FIG. 2, the unit to be scheduled after the marking unit 12 is the data unit 13. In this case, the switching device will continue to schedule the data unit 13 out of the target queue 12. After the data unit 13 is scheduled out of the target queue 12, the switching device will continue to determine if the next unit to be scheduled in the target queue 12 is a marked unit. As shown in FIG. 2, the unit to be scheduled after the data unit 13 is the data unit 14. In this case, the switching device will schedule the data unit 14 out of the target queue 12.
  • the switching device before determining whether a to-be-scheduled unit is a marking unit, the switching device first determines whether the to-be-scheduled unit still exists, and if the to-be-scheduled unit does not exist, scheduling the unit in another queue.
  • the queue if the unit to be scheduled exists, determines whether the unit to be scheduled is a label unit. For example, after the data unit 14 is scheduled out of the target queue 12, the switching device determines if there are still units to be scheduled in the target queue 12. In the case that there is no to-be-scheduled unit in the target queue 12 and the original queue 11 has a unit to be scheduled, the to-be-scheduled unit in the original queue 11 can be scheduled out of the original queue 11.
  • the order of data units scheduled from the original queue 11 and the target queue 12 is: data unit 10, data unit 11, data unit 12, data unit 13, and data unit 14. It can be seen that the input order of the data units input to the switching device is the same as the output order of the data units output by the switching device.
  • the switching device can also receive data stream 2.
  • data stream 2 is always input to the original queue 11.
  • the input order of the data units input to the switching device is the same as the output order of the data units output by the switching device.
  • data unit 20 and data unit 21 (not shown in FIG. 2) in data stream 2 are input to original queue 11 after data unit 10 and before data unit 11.
  • the data units output from the queue pair 1 are, in order, the data unit 10, the data unit 20, the data unit 21, the data unit 11, the data unit 12, the data unit 13, and the data unit 14.
  • the data unit 22 and the data unit 23 (not shown in FIG. 2) in the data stream 2 are input to the original queue 11 after the data stream 1 is switched from the original queue 11 to the target queue 12.
  • the data unit 22 and the data unit 23 may be scheduled out of the original queue 11 after the data unit 13 and the data unit 14 in the target queue 12 are scheduled out of the target queue.
  • the data units output from the original queue 11 and the target queue 12 are: data unit 10, data unit 20, data unit 21, data unit 11, data unit 12, data unit 13, data unit 14, Data unit 22 and data unit 23. It can be seen that the input order of the data units of the data stream 1 input to the switching device is the same as the output order of the data units in the switching device output data stream 1, and the input of the data unit of the data stream 2 input to the switching device The order is the same as the output order of the data units in the switching device output data stream 2.
  • the switching device may schedule the marking unit 12 out of the target queue 12. After that, the switching device can continue to determine whether the next to-be-scheduled unit in the original queue 11 is a marking unit, and determine whether the next to-be-scheduled unit in the target queue 12 is a marking unit. At this time, the next to-be-scheduled unit in the original queue 11 is the data unit 22, and the next to-be-scheduled unit in the target queue 12 is the data unit 13. In other words, the next to-be-scheduled unit in the original queue 11 and the next to-be-scheduled unit in the target queue are not tag units.
  • the switching device can schedule the data unit 22 and the data unit 13 according to a preset rule. For example, if the preset rule is a polling schedule and the original queue 11 is scheduled to reschedule the target queue 12, the switching device may first schedule the data unit 22 out of the original queue 11 and then schedule the data unit 13 out of the target queue 12. Similarly, the unit to be scheduled after the data unit 22 is the data unit 23, and the unit to be scheduled after the data unit 13 is the data unit 14. The switching device can schedule the data unit 23 out of the original queue 11 in the same manner, and then schedule the data unit 14 out of the target queue 12.
  • a preset rule is a polling schedule and the original queue 11 is scheduled to reschedule the target queue 12
  • the switching device may first schedule the data unit 22 out of the original queue 11 and then schedule the data unit 13 out of the target queue 12.
  • the unit to be scheduled after the data unit 22 is the data unit 23, and the unit to be scheduled after the data unit 13 is the data unit 14.
  • the switching device can schedule the
  • the data units output from the original queue 11 and the target queue 12 are: data unit 10, data unit 20, data unit 21, data unit 11, data unit 12, data unit 22, data unit 13, Data unit 23 and data unit 14. It can be seen that the input order of the data units of the data stream 1 input to the switching device is the same as the output order of the data units in the switching device output data stream 1, and the input of the data unit of the data stream 2 input to the switching device The order is the same as the output order of the data units in the switching device output data stream 2.
  • the switching device may continue to determine whether the next to-be-scheduled unit in the original queue 11 is a marking unit.
  • the next to-be-scheduled unit in the original queue 11 is the data unit 22, and the next to-be-scheduled unit in the target queue 12 is the marking unit 12. Therefore, the switching device can continue to schedule the data unit 22 in the original queue 11 out of the original queue 11.
  • the next to-be-scheduled unit after the data unit 22 in the original queue 11 is the data unit 23. Therefore, the switching device can continue to schedule the data unit 23 out of the original queue 11. There is no unit to be scheduled in the original queue 11 after the data unit 23.
  • the cells in the target queue 12 can be scheduled out of the queue.
  • the data units output from the original queue 11 and the target queue 12 are: data unit 10, data unit 20, data unit 21, data unit 11, data unit 12, data unit 22, data unit 23, Data unit 13 and data unit 14. It can be seen that the input order of the data units of the data stream 1 input to the switching device is the same as the output order of the data units in the switching device output data stream 1, and the input of the data unit of the data stream 2 input to the switching device The order is the same as the output order of the data units in the switching device output data stream 2.
  • a pair of counter pairs may also be provided.
  • the counter pair includes an original counter 11 and a target counter 12.
  • the original counter 11 corresponds to the original queue 11, and the target counter 12 corresponds to the target queue 12.
  • the value of the counter corresponding to the queue is incremented by one.
  • the value of the original counter 11 is incremented by one when the marking unit 11 is input to the queue 11; in the case where the marking unit 12 is input to the queue 12, the value of the target counter 12 is incremented by one.
  • the switching device may also decrement the value of the original counter 11 by 1 after the flag unit 11 is scheduled out of the original queue 11, and decrement the value of the target counter 12 by 1 after the flag unit 12 is scheduled out of the target queue 12.
  • the switching device needs to determine that the value of the target counter is greater than the value of the original counter before scheduling the marking unit located in the target queue out of the target queue. Specifically, the switching device needs to determine that the value of the target counter 12 is greater than the value of the original counter 11 before the tag unit 12 is scheduled out of the target queue 12.
  • the marking unit 11 may include number information 11 which is the number of the original counter 11.
  • the tag unit 12 may include number information 12, which is the number of the target counter 12.
  • the marking unit 12 may also carry the number information 11.
  • the original counter and the target counter in the counter pair to be compared can be determined based on the number information 11 and the number information 12.
  • the switching device can add and subtract the values of the corresponding original counter and the target counter according to the number information in the marking unit.
  • the data stream 2 is also switched from the original queue 11 to the target queue 12.
  • the switching device can schedule the acquired data unit of the data stream 2 in the same manner as the processing data stream 1, as shown in FIG. 3.
  • FIG. 3 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • the queue pair 1 shown in FIG. 3 includes two queues, an original queue 11 and a target queue 12.
  • Data stream 1 is first input to the original queue 11.
  • the data unit input to the original queue 11 includes the data units 10 to 12 in the data stream 1.
  • the marking unit 11 is input to the original queue 11, and the marking unit 12 is input to the target queue 12.
  • the acquired data unit of the data stream 1 is input to the target queue 12.
  • the data unit of the input target queue 12 includes the data unit 13 and the data unit 14 in the data stream 1.
  • the switching device receives the data stream 2.
  • Data stream 2 is first input to the original queue 11.
  • the data unit input to the original queue 11 includes a data unit 20 and a data unit 21.
  • the marking unit 21 is input to the original queue 11, and the marking unit 22 is input to the target queue 12.
  • the acquired data unit of the data stream 2 is input to the target queue 12.
  • the data unit of the input target queue 12 includes data unit 22 and data unit 23 in data stream 2.
  • the manner in which the switching device processes the data units 10 to 12 and the marking unit 11 in the original queue 11 and the target queue 12 is the same as the embodiment shown in FIG. 2, and need not be described here.
  • the input order and output order of the data units in the data stream can be the same.
  • FIG. 3 as an example, as long as the time at which the marking unit 11 dispatches the original queue 11 is earlier than the timing at which the marking unit 12 dispatches the target queue 12, it can be ensured that the input order and the output order of the data units in the data stream 1 do not change.
  • the timing of the original queue 11 by the marking unit 21 is earlier than the timing at which the marking unit 22 dispatches the target queue 12, it can be ensured that the input order and the output order of the data units in the data stream 2 do not change.
  • the switching device may continue to schedule the unit from the original queue 11 until the marking unit 21 is scheduled out of the original queue 11, and then the target queue is sequentially
  • the tag unit 12, the data unit 13, the data unit 14, the tag unit 22, the data unit 22, and the data unit 23 in 12 may align the target queue 12.
  • the tag unit 12 can be scheduled out of the target queue 12.
  • Data unit 20, data unit 13, data unit 21, and data unit 14 can then be scheduled in their respective queues in a polling schedule. After that, the marking unit 21, the marking unit 22, the data unit 22, and the data unit 23 are sequentially scheduled to be in the respective queues.
  • the tag unit 12 can be scheduled out of the target queue 12.
  • Data unit 13 and data unit 14 can then be scheduled out of target queue 12 in sequence.
  • the data unit 20 the data unit 21, and the marking unit 21 can be scheduled out of the original queue 11 in sequence.
  • the tag unit 22 the data unit 22, and the data unit 23 can be sequentially scheduled out of the target queue 12.
  • the input order and output order of the data units in the data stream 1 do not change, and the input order and output order of the data units in the data stream 2 do not change.
  • a pair of counter pairs may also be provided.
  • the counter pair includes an original counter 11 and a target counter 12.
  • the original counter 11 corresponds to the original queue 11, and the target counter 12 corresponds to the target queue 12.
  • the value of the counter corresponding to the queue is incremented by one. For example, the value of the original counter 11 is incremented by 1 when the marking unit 11 is input to the queue 11; the value of the target counter 12 is incremented by 1 when the marking unit 12 is input to the queue 12; The value of the original counter 11 is incremented by one when input to the original queue 11; the value of the target counter 12 is incremented by one when the flag unit 22 is input to the target queue 12.
  • the switching device may also decrement the value of the original counter 11 by 1 after the tag unit 11 is scheduled out of the queue 11, and decrement the value of the target counter 12 by 1 after the tag unit 12 is scheduled out of the target queue 12, and the tag unit 21 is scheduled.
  • the value of the original counter 11 is decremented by 1 after the original queue 11 is decremented, and the value of the target counter 12 is decremented by 1 after the flag unit 22 is scheduled out of the target queue 12.
  • the switching device needs to determine that the value of the target counter is greater than the value of the original counter before scheduling the flag unit located in the target queue out of the target queue. Specifically, before the flag unit 12 is scheduled out of the target queue 12, it is necessary to determine that the value of the target counter 12 is greater than the value of the original counter 11; before the flag unit 22 is scheduled out of the target queue 12, it is necessary to determine that the value of the target counter 12 is greater than the original The value of counter 11.
  • the marking unit 11 and the marking unit 21 may include number information 11 which is the number of the original counter 11.
  • the marking unit 12 and the marking unit 22 may include number information 12, which is the number of the target counter 12.
  • the marking unit 12 may also carry the number information 11.
  • the original counter and the target counter in the counter pair to be compared can be determined based on the number information 11 and the number information 12.
  • the switching device can add and subtract the values of the corresponding original counter and the target counter according to the number information in the marking unit.
  • the queues corresponding to the two different data streams may be the same as the queues included, but the first-in queue and the switched queue are different.
  • the queue that is input first in data stream 1 and the queue that is input after the data stream 2 switches the queue are the same queue; the queue that is input first in data stream 2 and the queue that is input after the data stream 1 switches the queue are the same queue.
  • the data stream 1 corresponds to the queue pair 1
  • the queue pair 1 includes the original queue 11 and the target queue 12
  • the data stream 2 is considered to correspond to the queue pair 2
  • the queue pair 2 includes the original queue 21 and the target queue 12.
  • the original queue 21 and the target queue 12 are the same queue, and the target queue 12 and the original queue 11 are the same queue.
  • a counter pair 1 corresponding to queue pair 1 and a counter pair 2 corresponding to queue pair 2 can be set.
  • the switching device can utilize the value of the counter in the counter pair and the tag unit to schedule the cells in the original queue and the target queue. For a specific implementation, refer to the embodiment shown in FIG. 4.
  • FIG. 4 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • the queue pair 1 shown in FIG. 4 includes two queues, an original queue 11 and a target queue 12.
  • Data stream 1 is first input to the original queue 11.
  • the data unit input to the original queue 11 includes the data units 10 to 12 in the data stream 1.
  • the marking unit 11 is input to the original queue 11, and the marking unit 12 is input to the target queue 12.
  • the acquired data unit of the data stream 1 is input to the target queue 12.
  • the data unit of the input target queue 12 includes the data unit 13 and the data unit 14 in the data stream 1.
  • Data stream 2 corresponds to queue pair 2.
  • the queue pair 2 includes the original queue 21 and the target queue 22.
  • the original queue 21 and the target queue 12 are the same queue, and the target queue 12 and the original queue 11 are the same queue.
  • Data stream 2 is first input to the original queue 21.
  • the data unit input to the original queue 21 includes a data unit 20 and a data unit 21.
  • the marking unit 21 is input to the original queue 21, and the marking unit 22 is input to the target queue 22.
  • the acquired data unit of the data stream 2 is input to the target queue 22.
  • the data unit of the input target queue 22 includes the data unit 22 and the data unit 23 in the data stream 2.
  • the counter pair 1 includes an original counter 11 corresponding to the original queue 11 and a target counter 12 corresponding to the target queue 12.
  • the counter pair 2 includes an original counter 21 corresponding to the original queue 21 and a target counter 22 corresponding to the target queue 22.
  • the value of the original counter 11 can be incremented by one; in the case where the marking unit 12 is input to the target queue 12, the value of the target counter 12 can be incremented by one.
  • the flag unit 21 is input to the original queue 21, the value of the original counter 21 can be incremented by one; in the case where the flag unit 22 is input to the target queue 22, the value of the target counter 12 can be incremented by one.
  • the initial values of the two counters in each counter pair are the same. In other words, the initial value of the original counter 11 is the same as the initial value of the target counter 12, and the initial value of the original counter 21 is the same as the initial value of the target counter 22. Assuming that the initial values of the original counter 11, the target counter 12, the original counter 21, and the target counter 22 are both 0, the values of the original counter 11, the target counter 12, the original counter 21, and the target counter 22 in the case shown in FIG. Both are 1.
  • the marking unit 11 may include number information 11 which is the number of the original counter 11.
  • the marking unit 12 may include number information 12, the number information 12 is the number of the target counter 12; the marking unit 21 may include number information 21, the number information 21 is the number of the original counter 21; and the marking unit 22 may include the number information 22, The number information 22 is the number of the target counter 22.
  • the marking unit 12 can also carry the number information 11, and the marking unit 22 can also carry the number information 21.
  • the marking unit 12 is the first to-be-scheduled unit of the target queue 12
  • the original counter and the target counter in the counter pair to be compared can be determined based on the number information carried by the marking unit 12/marking unit 22.
  • the switching device can add and subtract the values of the corresponding original counter and the target counter according to the number information in the marking unit.
  • the switching device schedules data units belonging to multiple data streams in a similar manner to data units belonging to one data stream. In other words, the switching device can be considered to be scheduled in the same manner for data units belonging to different data streams.
  • the original queue 11, the target queue 12, the original queue 12, and the target queue 22 shown in FIG. 4 are taken as an example.
  • the switching device determines that the to-be-scheduled unit located in the head of the original queue 11 is a data unit, and the to-be-scheduled unit located in the head of the target queue 12 is a marking unit.
  • the switching device can schedule the first to-be-scheduled unit in the original queue 11 to the original queue 11, that is, the data unit 10 is scheduled out of the original queue 11.
  • the switching device determines whether the next unit to be scheduled in the original queue 11 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 10 is the data unit 11.
  • the switching device will continue to schedule the data unit 11 out of the original queue 11. After the data unit 11 is scheduled out of the original queue 11, the switching device will continue to determine whether the next unit to be scheduled in the original queue 11 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 11 is the data unit 12. In this case, the switching device will continue to schedule the data unit 12 out of the original queue 11. After the data unit 12 is scheduled out of the original queue 11, the switching device determines whether it is determined whether the next unit to be scheduled in the original queue 11 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 12 is the labeling unit 11.
  • the switching device will schedule the flag unit 11 out of the original queue 11 and decrement the value of the original counter 11.
  • the value of the original counter 11 is smaller than the value of the target counter 12.
  • the switching device can determine that the next unit to be scheduled in the original queue 11 is the marking unit 22.
  • the switching device can determine that the value of the original counter 21 is equal to the value of the target counter 22 based on the counter number information carried by the marking unit 22. Therefore, after the flag unit 11 is scheduled out of the original queue 11, the value of the target counter 12 is larger than the value of the original counter 11, and the value of the original counter 21 is equal to the value of the target counter 22.
  • the switching device schedules the tag unit 12 at the head of the target queue 12 to dispatch the target queue 12. At the same time, the switching device will stop scheduling data units from the original queue 11. After the tag unit 12 is scheduled out of the target queue 12, the switching device decrements the value of the target counter 12 by one. After the tag unit 12 is scheduled out of the target queue 12, the switching device determines whether the next unit to be scheduled in the target queue 12 is a tag unit. As shown in FIG. 4, the unit to be scheduled after the marking unit 12 is the data unit 13. In this case, the switching device will continue to schedule the data unit 13 out of the target queue 12. After the data unit 13 is scheduled out of the target queue 12, the switching device will continue to determine whether the next unit to be scheduled in the target queue 12 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 13 is the data unit 14. In this case, the switching device will schedule the data unit 14 out of the target queue 12.
  • the to-be-scheduled unit located at the head of the original queue 11 is the marking unit 22
  • the unit to be scheduled located at the head of the target queue 12 is the data unit 20.
  • the switching device can determine that the value of the original counter 21 is equal to the value of the target counter 22 based on the number information in the marking unit 22. Therefore, the switching device can schedule the data unit 20 from the original queue 21.
  • the switching device determines whether the next unit to be scheduled in the original queue 21 is a marking unit. As shown in FIG. 4, the unit to be scheduled after the data unit 20 is the data unit 21. In this case, the switching device will continue to schedule the data unit 21 out of the original queue 21. After the data unit 21 is scheduled out of the original queue 21, the switching device continues to determine whether the next unit to be scheduled in the queue 21 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 21 is the marking unit 21.
  • the switching device will schedule the flag unit 21 out of the original queue 21, and decrement the value of the original counter 21 by one.
  • the value of the original counter 21 is smaller than the value of the target counter 22.
  • the switching device schedules the tag unit 22 at the head of the target queue 22 to dispatch the target queue 22.
  • the switching device will stop scheduling data units from the original queue 21.
  • the switching device decrements the value of the target counter 22 by one.
  • the switching device determines whether the next unit to be scheduled in the target queue 22 is a tag unit. As shown in FIG. 4, the unit to be scheduled after the marking unit 22 is the data unit 22.
  • the switching device will continue to dispatch data unit 22 out of target queue 22. After the data unit 22 is scheduled out of the target queue 22, the switching device will continue to determine whether the next unit to be scheduled in the target queue 22 is a marked unit. As shown in FIG. 4, the unit to be scheduled after the data unit 22 is the data unit 23. In this case, the switching device will schedule the data unit 23 out of the target queue 22.
  • the order of the data units scheduled from the original queue 11 and the target queue 12 is: data unit 10, data unit 11, data unit 12, data unit 13, data unit 14, data unit 20, data unit 21, Data unit 22 and data unit 23. It can be seen that the input order of the data units input to the switching device is the same as the output order of the data units output by the switching device.
  • each queue is the original or target queue of a queue.
  • a queue can be the original or target queue of multiple queues.
  • a queue pair still includes two queues, an original queue and a target queue.
  • Data stream 1 is switched from queue A to queue B.
  • data stream 1 corresponds to queue pair AB
  • queue A in queue pair AB is the original queue of data stream 1
  • queue B in queue pair AB is the target queue of data stream 1.
  • Data stream 2 is switched from queue A to queue C.
  • data traffic 2 corresponds to queue pair AC
  • queue A in queue AC is the original queue of data stream 2
  • queue C in queue pair AC is the target queue of data stream 2.
  • queue D there are three queues: queue D, queue E, and queue F.
  • Data stream 3 is switched from queue D to queue F.
  • data stream 1 corresponds to queue pair DF
  • queue D in queue pair DF is the original queue of data stream 1
  • queue F in queue pair DF is the target queue of data stream 1.
  • Data stream 2 is switched from queue E to queue F.
  • data traffic 2 corresponds to queue pair EF
  • queue E in queue EF is the original queue of data stream 2
  • queue F in queue pair EF is the target queue of data stream 2.
  • FIG. 5 is a schematic diagram of a method for scheduling data according to an embodiment of the present application.
  • the queue pair 1 shown in FIG. 5 includes two queues, an original queue 11 and a target queue 12.
  • Data stream 1 is first input to the original queue 11.
  • the data unit input to the original queue 11 includes the data units 10 to 12 in the data stream 1.
  • the marking unit 11 is input to the original queue 11, and the marking unit 12 is input to the target queue 12.
  • the acquired data unit of the data stream 1 is input to the target queue 12.
  • the data unit of the input target queue 12 includes the data unit 13 and the data unit 14 in the data stream 1.
  • Data stream 2 corresponds to queue pair 2.
  • the queue pair 2 includes the original queue 21 and the target queue 22.
  • the original queue 21 and the original queue 11 are the same queue.
  • the target queue 22 and the target queue 12 are different queues.
  • Data stream 2 is first input to the original queue 21.
  • the data unit input to the original queue 21 includes a data unit 20 and a data unit 21.
  • the marking unit 21 is input to the original queue 21, and the marking unit 22 is input to the target queue 22.
  • the acquired data unit of the data stream 2 is input to the target queue 22.
  • the data unit of the input target queue 22 includes the data unit 22 and the data unit 23 in the data stream 2.
  • the value of the original counter 11 can be incremented by one; in the case where the marking unit 12 is input to the target queue 12, the value of the target counter 12 can be incremented by one.
  • the flag unit 21 is input to the original queue 21, the value of the original counter 21 can be incremented by one; in the case where the flag unit 22 is input to the target queue 22, the value of the target counter 12 can be incremented by one.
  • the initial values of the two counters in each counter pair are the same. In other words, the initial value of the original counter 11 is the same as the initial value of the target counter 12, and the initial value of the original counter 21 is the same as the initial value of the target counter 22. Assuming that the initial values of the original counter 11, the target counter 12, the original counter 21, and the target counter 22 are both 0, the values of the original counter 11, the target counter 12, the original counter 21, and the target counter 22 in the case shown in FIG. Both are 1.
  • the marking unit 11 may include number information 11 which is the number of the original counter 11.
  • the marking unit 12 may include number information 12, the number information 12 is the number of the target counter 12; the marking unit 21 may include number information 21, the number information 21 is the number of the original counter 21; and the marking unit 22 may include the number information 22, The number information 22 is the number of the target counter 22.
  • the marking unit 12 can also carry the number information 11, and the marking unit 22 can also carry the number information 21.
  • the marking unit 12 is the first to-be-scheduled unit of the target queue 12
  • the original counter and the target counter in the counter pair to be compared can be determined based on the number information carried by the marking unit 12/marking unit 22.
  • the switching device can add and subtract the values of the corresponding original counter and the target counter according to the number information in the marking unit.
  • the specific process of the switching device processing the data units 10 to 14 and the marking units 11 and 12 may process the data units 10 to 14 and the marking unit 11 with the switching device in the embodiment shown in FIG.
  • the specific process is the same as 12, so I won't go into details here.
  • the to-be-scheduled unit located at the head of the original queue 11 is the data unit 20
  • the unit to be scheduled located at the head of the target queue 22 is the marking unit 22.
  • the switching device can determine that the counter corresponding to the marking unit 22 is the target counter 22 based on the number information in the marking unit 22. At the same time, the value of the original counter 21 is the same as the value of the target counter 22. In this case, the switching device will schedule the first to-be-scheduled unit in the original queue 21 to be out of the original queue 21, that is, to schedule the data unit 20 out of the original queue 21. After the data unit 20 is scheduled out of the original queue 21, the switching device determines whether the next unit to be scheduled in the original queue 21 is a marked unit. As shown in FIG. 5, the unit to be scheduled after the data unit 20 is the data unit 21. In this case, the switching device will continue to schedule the data unit 21 out of the original queue 21.
  • the switching device After the data unit 21 is scheduled out of the original queue 21, the switching device will continue to determine whether the next unit to be scheduled in the original queue 21 is a marked unit. As shown in FIG. 5, the unit to be scheduled after the data unit 21 is the marking unit 21. In this case, the switching device will schedule the flag unit 21 out of the original queue 21, and decrement the value of the original counter 21 by one. Thus, the value of the original counter 21 is smaller than the value of the target counter 22. In this case, the switching device schedules the tag unit 22 at the head of the target queue 22 to dispatch the target queue 22. At the same time, the switching device will stop scheduling data units from the original queue 21. After the tag unit 22 is scheduled out of the target queue 22, the switching device decrements the value of the target counter 22 by one.
  • the switching device determines whether the next unit to be scheduled in the target queue 22 is a tag unit. As shown in FIG. 5, the unit to be scheduled after the marking unit 22 is the data unit 22. In this case, the switching device will continue to dispatch data unit 22 out of target queue 22. After the data unit 22 is scheduled out of the target queue 22, the switching device will continue to determine if the next unit to be scheduled in the target queue 22 is a marked unit. As shown in FIG. 5, the unit to be scheduled after the data unit 22 is the data unit 23. In this case, the switching device will schedule the data unit 23 out of the target queue 22.
  • the order of the data units scheduled from the original queue 11 and the target queue 12 is: data unit 10, data unit 11, data unit 12, data unit 13, data unit 15, data unit 20, data unit 21, Data unit 22 and data unit 23. It can be seen that the input order and output order of the data units in the data stream 1 do not change, and the input order and output order of the data units in the data stream 2 do not change.
  • the switching device may also first schedule all the cells in the original queue 11 out of the original queue 11, that is, the data unit 10, the data unit 11, the data unit 12, the marking unit 11, and the data.
  • the unit 20, the data unit 21, and the marking unit 21 all schedule the original queue 11.
  • the switching device then schedules all of the units in the target queue 12 and the target queue 22 to their respective queues. In this case, the input order and the output order of the data units in the data stream 1 do not change, and the input order and output order of the data units in the data stream 2 do not change.
  • the switching device schedules the data units 11 to 12 in the original queue 11 to the original queue 11.
  • the target queue 12 may be first The marking unit 12 dispatches the target queue 12. Then, the switching device can schedule the remaining data units in the original queue 21 and the remaining data units of the target queue 12 according to a preset rule (eg, a rotation training schedule). After the tag unit 21 is scheduled out of the original queue 21, the switching device can sequentially schedule the tag unit 22, the data unit 22, and the data unit 23 in the target queue 22 out of the target queue 22.
  • a preset rule eg, a rotation training schedule
  • one queue is a target queue of multiple queues is similar to the case where one queue is a plurality of queue original queues, and need not be described here.
  • FIG. 6 is a structural block diagram of a switching device according to an embodiment of the present application.
  • the switching device 600 shown in FIG. 6 includes a processing unit 601 and an input unit 602.
  • the input unit 602 is configured to receive N 1 data units from the first data stream, where the data unit is a descriptor of a data packet or a data packet, and N 1 is a positive integer greater than or equal to 1.
  • the input unit 602 is further configured to input the N 1 data units into the first original queue.
  • the processing unit 601 is configured to determine that the first data stream is switched from the first original queue to the first target queue, where the first original queue and the first target queue belong to a first queue pair.
  • the processing unit 601 is further configured to generate a first original marking unit and a first target marking unit, input the first original marking unit into the first original queue, and input the first target marking unit into the first target queue.
  • the input unit 602 is further configured to receive M 1 data units from the first data stream, where M 1 is a positive integer greater than or equal to 1.
  • the processing unit 601 is further configured to, according to the first original marking unit and the first target marking unit, schedule the N 1 data unit and the first original marking unit out of the first original queue and the first target marking unit M 1 and the data unit that the first target scheduling queue, wherein the first prime mark means that the first scheduling queue earlier than the original time of the first scheduled target The unit schedules the time of the first target queue.
  • processing unit 601 For specific functions and advantages of the processing unit 601 and the input unit 602, reference may be made to the embodiment shown in FIG. 1, and details are not described herein.
  • Processing unit 601 can be implemented by a processor, and input unit 602 can be implemented by receiving.
  • FIG. 7 is a structural block diagram of another switching device according to an embodiment of the present application.
  • the switching device 700 shown in FIG. 7 includes a memory 701 and a processor 702.
  • the memory 701 is configured to store a program.
  • the processor 702 is configured to execute a program stored in the memory 701. When the program is executed, the switching device 700 can implement the method provided by the foregoing embodiment of FIG. 1.
  • Some or all of the methods shown in FIG. 1 may be implemented by software using switching device 700.
  • Memory 701 can be a physically separate unit or can be integrated with processor 702.
  • the switching device 700 may also include only the processor 702.
  • the memory 701 for storing programs is located outside the device 700, and the processor 702 is connected to the memory 701 through circuits/wires for reading and executing programs stored in the memory 701.
  • the processor 702 can be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP.
  • CPU central processing unit
  • NP network processor
  • Processor 702 can also further include a hardware chip.
  • the hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof.
  • the PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
  • the memory 701 may include a volatile memory such as a random-access memory (RAM); the memory 701 may also include a non-volatile memory such as a flash memory (flash) Memory), hard disk drive (HDD) or solid-state drive (SSD); the memory 701 may also include a combination of the above types of memories.
  • RAM random-access memory
  • non-volatile memory such as a flash memory (flash) Memory), hard disk drive (HDD) or solid-state drive (SSD)
  • the memory 701 may also include a combination of the above types of memories.
  • Yet another aspect of the present application provides a computer readable storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method illustrated in Figure 1 above.
  • Yet another aspect of the present application provides a computer program product comprising instructions that, when executed on a computer, cause the computer to perform the method as shown in FIG.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product.
  • the technical solution of the present application which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请实施例提供了调度数据的方法和交换设备,该方法包括:接收来自第一数据流的N 1个数据单元;将该N 1个数据单元输入第一原队列;确定该第一数据流从该第一原队列切换为第一目标队列,其中该第一原队列与该第一目标队列属于第一队列对;将第一原标记单元输入该第一原队列并将第一目标标记单元输入该第一目标队列;接收来自该第一数据流的M 1个数据单元;将该M 1个数据单元输入该第一目标队列;根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列并将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列。上述技术方案提供了一种简便的避免数据流乱序的方法。

Description

调度数据的方法和交换设备
本申请要求于2017年11月16日提交中国专利局、申请号为201711137256.7、申请名称为“调度数据的方法和交换设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及信息技术领域,更具体地,涉及调度数据的方法和交换设备。
背景技术
交换设备(例如交换机和路由器)内通常会包含多个队列。该交换设备可能会在接收数据流的过程中切换接收该数据流的队列。
例如,交换设备会根据接收到的数据流的大小来选择该数据流需要被输入的队列。但是,一些情况下,该交换设备在开始接收到数据流时会将该数据流识别老鼠流。在此情况下,该数据流会被输入老鼠流对应的队列。但是随着该交换设备接收到的该数据流的字节数超过一个预定阈值,该交换设备会将该数据流会识别为大象流。这样,该交换设备会将接收该数据流的队列从老鼠流对应的队列切换为大象流对应的队列。
又如,交换设备会根据接收到的数据流是否是引发拥塞的数据流来选择该数据流需要被输入的队列。但是,一些情况下,该交换设备在开始接收到数据流时会认为该数据流是非拥塞数据流。因此,该数据流会被输入非拥塞数据流对应的队列。但是,当发生拥塞时,该交换设备会将该数据流识别为拥塞数据流后,该交换设备会将接收该数据流的队列从非拥塞数据流对应的队列切换为拥塞数据流对应的队列。
虽然数据流对应的队列进行了切换,但是该交换设备输出该数据流中的数据单元时,该交换设备输出的数据单元的输出顺序需要与该数据单元的输入顺序一致。例如,交换设备接收数据流时依次接收到1至7号数据单元。该交换设备输出的数据单元的顺序也需要保证为1至7。
目前,为了保证数据单元的输出顺序与输入顺序一致,一种可行的技术方案是将输入到切换前的队列中的数据单元移动到切换后的队列中。例如,在数据流切换前,数据单元1至6已经被输入到一个队列(以下简称源队列)。当该数据流从该队列切换为另一队列(以下简称目标队列)后,需要先将数据单元1至6从该源队列移动的该目标队列,然后在将数据单元7输入该目标队列。上述技术方案中,交换设备需要遍历访问源队列以确定需要移动的数据单元,这会引入非常大的访问开销,从而严重影响该交换设备正常处理数据流的性能。除此之外,为了简化队列操作,队列通常只支持先入先出的调度方式。但是移动数据包需要支持随机访问,这将大大增加队列管理的复杂度。
因此,需要找到一种简单的避免数据流乱序的方法。
发明内容
本申请实施例提供了调度数据的方法和交换设备,能够避免数据流乱序。
第一方面,本申请实施例提供一种调度数据的方法,该方法包括:接收来自第一数据流的N 1个数据单元,其中该数据单元为数据包或数据包的描述符,N 1为大于或等于1的正整数;将该N 1个数据单元输入第一原队列;确定该第一数据流从该第一原队列切换为第一目标队列,其中该第一原队列与该第一目标队列属于第一队列对;将第一原标记单元输入该第一原队列并将第一目标标记单元输入该第一目标队列;接收来自该第一数据流的M 1个数据单元,其中M 1为大于或等于1的正整数;将该M 1个数据单元输入该第一目标队列;根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列并将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,其中该第一原标记单元调度出该第一原队列的时刻早于该第一目标调度单元调度出该第一目标队列的时刻。上述技术方案仅需要将原标记单元和目标标记单元分别输入原队列和目标队列就可以实现该N个数据单元和该M个数据单元的输入顺序与输出顺序相同。因此,上述技术方案无需将数据单元从一个队列切换为另一个队列。因此,上述技术方案队列管理的复杂度较低。此外,上述技术方案也无需从一个队列中选择部分数据单元,这就无需要求该交换设备支持随机访问。因此,上述技术方案提供了一种简便的避免数据流乱序的方法。
结合第一方面,在第一方面的第一种可能的实现方式中,该根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列并将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,包括:根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列,并在该第一原标记单元调度出该第一原队列后,将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列。
结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,该根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列,并在该第一原标记单元调度出该第一原队列后,将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,包括:确定第一待调度单元是否为该第一原标记单元,其中该第一待调度单元为该原队列中第一个待调度的单元;确定第二待调度单元是否为该第一目标标记单元,其中该第二待调度单元为该目标队列中第一个待调度的单元;在该第一待调度单元不为该第一原标记单元且该第二待调度单元不为该第一目标标记单元的情况下,根据预设规则调度该第一待调度单元和该第二待调度单元,并继续确定第三待调度单元是否为该第一原标记单元,确定第四待调度单元是否为该第一目标标记单元,其中该第三待调度单元为在将该第一待调度单元调度出该第一原队列后该第一原队列中的第一个待调度的单元,该第四待调度单元为在将该第二待调度单元调度出该第一目标队列后该第一目标队列中的第一个待调度的单元;在该第一待调度单元不为该第一原标记单元且该第二待调度单元为该第一目标标记单元的情况下,将该第一待调度单元调度出该原队列,并继续确定该第三待调度单元是否为该第一原标记单元;在该第一待调度单元为该第一原标记单元且该第二待调度单元为该第一目标标记单元的情况下,将该第一原标记单元调度出该第一原队列并在该第一原标记单元调度出该第一原队列后将该第一目标 标记单元调度出该第一目标队列。
结合第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,该方法还包括:在将该第一原标记单元输入该第一原队列的情况下,将第一计数器对中的第一原计数器的值加1;在将该第一目标标记输入该第一目标队列的情况下,将该第一计数器对中的第一目标计数器的值加1,其中该第一计数器对对应于该第一队列对,该第一原计数器对应于该第一原队列,该第一目标计数器对应于该第一目标队列;在该第一原标记单元调度出该第一原队列的情况下,将该第一原计数器的值减1;在该第一目标标记单元调度出该第一目标队列的情况下,将该第一目标计数器的值减1。这样,可以避免当该原队列为另一队列的原队列或另一队列的目标队列时,无法正确选择调度队列的情况发生。
结合第一方面的第三种可能的实现方式,在第一方面的第四种可能的实现方式中,在将该第一目标标记单元调度出该第一目标队列之前,该方法还包括:确定该第一原计数器的值小于该第一目标计数器的值。这样,可以避免当该原队列为另一队列的原队列或另一队列的目标队列时,无法正确选择调度队列的情况发生。
结合第一方面的第三种可能的实现方式或第一方面的第四种可能的实现方式,在第一方面的第五种可能的实现方式中,该原标记单元携带第一编号信息,该目标标记单元携带该第一编号信息和第二编号信息,其中该第一编号信息为该原计数器的编号,该第二编号信息为该目标计数器的编号;该方法还包括:根据该第一编号信息和该第二编号信息确定该原计数器和该目标计数器。当该第一目标标记单元为该第一目标队列的第一个待调度单元的情况下,可以根据该第一编号信息和该第二编号信息确定需要比较的计数器对中的原计数器和目标计数器。
结合第一方面的第四种可能的实现方式或第一方面的第五种可能的实现方式,在第一方面的第六种可能的实现方式中,该方法还包括:接收来自第二数据流的N 2个数据单元,其中N 2为大于或等于1的正整数;将该N 2个数据单元输入该第一原队列;确定该第二数据流从该第一原队列切换为该第一目标队列;将第二原标记单元输入该第一原队列并将第二目标标记单元输入该第一目标队列;接收来自该第二数据流的M 2个数据单元,其中M 1为大于或等于1的正整数;将该M 2个数据单元输入该第一目标队列;根据该第二原标记单元和该第二目标标记单元,将该N 2个数据单元和该第二原标记单元调度出该第一原队列并将该第二目标标记单元和该M 2个数据单元调度出该第一目标队列,其中该第二原标记单元调度出该第一原队列的时刻早于该第二目标调度单元调度出该第一目标队列的时刻;在将该第二原标记单元输入该第一原队列的情况下,将该第一原计数器的值加1;在将该第二目标标记输入该第一目标队列的情况下,将该第一目标计数器的值加1;在该第二原标记单元调度出该第一原队列的情况下,将该第一原计数器的值减1;在该第二目标标记单元调度出该第一目标队列的情况下,将该第一目标计数器的值减1;在将该第二目标标记单元调度出该第一目标队列之前,该方法还包括:确定该第一原计数器的值小于该第一目标计数器的值。
结合第一方面的第四种可能的实现方式至第一方面的第六种可能的实现方式中的任一种可能的实现方式,在第一方面的第七种可能的实现方式中,该方法还包括:接收来自第三数据流的N 3个数据单元,其中N 3为大于或等于1的正整数;将该N 3个数据单元输 入第二原队列;确定该第三数据流从该第二原队列切换为第二目标队列,其中该第二原队列与该第二目标队列属于第二队列对,该第二原队列与该第一原队列不同和/或该第二目标队列与该第一目标队列不同;将第三原标记单元输入该第二原队列并将第三目标标记单元输入该第二目标队列;接收来自该第三数据流的M 3个数据单元,其中M 1为大于或等于1的正整数;将该M 3个数据单元输入该第二目标队列;根据该第三原标记单元和该第三目标标记单元,将该N 3个数据单元和该第三原标记单元调度出该第二原队列并将该第三目标标记单元和该M 3个数据单元调度出该第二目标队列,其中该第三原标记单元调度出该第二原队列的时刻早于该第二目标调度单元调度出该第二目标队列的时刻;在将该第三原标记单元输入该第二原队列的情况下,将第二计数器对中的第二原计数器的值加1;在将该第三目标标记输入该第二目标队列的情况下,将该第二计数器对中的第二目标计数器的值加1,其中该第二计数器对对应于该第二队列对,该第二原计数器对应于该第二原队列,该第二目标计数器对应于该第二目标队列;在该第三原标记单元调度出该第二原队列的情况下,将该第二原计数器的值减1;在该第三目标标记单元调度出该第二目标队列的情况下,将该第二目标计数器的值减1;在将该第三目标标记单元调度出该第二目标队列之前,该方法还包括:确定该第二原计数器的值小于该第二目标计数器的值。
第二方面,本申请实施例还提供一种交换设备,该交换设备包括用于实现第一方面或第一方面的任一种可能的实现方式的单元。
第三方面,本申请实施例提供一种交换设备,该交换设备包括:存储器,用于存储程序;处理器,用于执行所述存储器存储的所述程序,当所述程序被执行时,所述处理器用于执行第一方面或第一方面的任一种可能的实现方式所述的方法。可选的,该交换设备为芯片或集成电路。
第四方面,本申请实施例提供一种芯片用于执行第一方面或第一方面的任一种可能的实现方式所述的方法。
第五方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行上述各个方面所述的方法。
第六方面,本申请实施例提供了一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述各方面所述的方法。
附图说明
图1是根据本申请实施例提供的一种调度数据的方法的示意性流程图。
图2是根据本申请实施例提供的一种调度数据的方法的示意图。
图3是根据本申请实施例提供的一种调度数据的方法的示意图。
图4是根据本申请实施例提供的一种调度数据的方法的示意图。
图5是根据本申请实施例提供的一种调度数据的方法的示意图。
图6是根据本申请实施例提供的一种交换设备的结构框图。
图7是根据本申请实施例提供的另一交换设备的结构框图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。
本申请实施例中所称的交换设备可以是广域网中的交换设备,也可以是局域网中的交换设备。本申请实施例中所称的交换设备可以是交换机,例如以太网交换机、光纤交换机、快速以太网交换机、千兆以太网交换机等。本申请实施例中所称的交换设备也可以是路由器例如接入路由器、骨干级路由器、有线路由器、无线路由器等。本申请实施例中所称的交换设备也可以是与交换机或路由器具有相同功能的其他网络设备。
本申请实施例中所称的数据单元可以是数据包,也可以是数据包的描述符。
图1是根据本申请实施例提供的一种调度数据的方法的示意性流程图。图1所示的方法可以由交换设备执行。
101,接收来自第一数据流的N 1个数据单元,其中该数据单元为数据包或数据包的描述符,N 1为大于或等于1的正整数。
102,将该N 1个数据单元输入第一原队列。
103,确定该第一数据流从该第一原队列切换为第一目标队列,其中该第一原队列与该第一目标队列属于第一队列对。
104,将第一原标记单元输入该第一原队列并将第一目标标记单元输入该第一目标队列。
105,接收来自该第一数据流的M 1个数据单元,其中M 1为大于或等于1的正整数。
106,将该M 1个数据单元输入该第一目标队列。
107,根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列并将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,其中该第一原标记单元调度出该第一原队列的时刻早于该第一目标调度单元调度出该第一目标队列的时刻。
图1所示的方法仅需要将原标记单元和目标标记单元分别输入原队列和目标队列就可以实现该N 1个数据单元和该M 1个数据单元的输入顺序与输出顺序相同。因此,上述技术方案无需将数据单元从一个队列切换为另一个队列。因此,上述技术方案队列管理的复杂度较低。此外,上述技术方案也无需从一个队列中选择部分数据单元,这就无需要求该交换设备支持随机访问。因此,上述技术方案提供了一种简便的避免数据流乱序的方法。
该第一数据流中的数据单元先进入该第一原队列,然后从该第一原队列切换到该第一目标队列。因此,图1所示的方法中,步骤101至步骤107是依次执行的。同时,对于属于同一个队列中的多个数据单元,该多个数据单元是按照先入先出的方式调度出队列的。
原标记单元(例如该第一原标记单元)和目标标记单元(例如该第一目标标记单元)可以是具有特殊格式和/或内容的单元。换句话说,标记单元的格式和/或内容与数据单元的格式和/或内容不同。这样,该交换设备可以根据该原标记单元和该目标标记单元中的格式和/或内容来区分待调度的单元是标记单元或数据单元。
可选的,在一些实施例中,该根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列并将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,包括:根据该第一原标记单元和该第一目标标记单元,将该N 1个数据单元和该第一原标记单元调度出该第一原队列,并在该第一原标记单元调度出该第一原队列后,将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列。
可选的,在一些实施例中,该根据该第一原标记单元和该第一目标标记单元,将该 N 1个数据单元和该第一原标记单元调度出该第一原队列,并在该第一原标记单元调度出该第一原队列后,将该第一目标标记单元和该M 1个数据单元调度出该第一目标队列,包括:确定第一待调度单元是否为该第一原标记单元,其中该第一待调度单元为该原队列中第一个待调度的单元;确定第二待调度单元是否为该第一目标标记单元,其中该第二待调度单元为该目标队列中第一个待调度的单元;在该第一待调度单元不为该第一原标记单元且该第二待调度单元不为该第一目标标记单元的情况下,根据预设规则调度该第一待调度单元和该第二待调度单元,并继续确定第三待调度单元是否为该第一原标记单元,确定第四待调度单元是否为该第一目标标记单元,其中该第三待调度单元为在将该第一待调度单元调度出该第一原队列后该第一原队列中的第一个待调度的单元,该第四待调度单元为在将该第二待调度单元调度出该第一目标队列后该第一目标队列中的第一个待调度的单元;在该第一待调度单元不为该第一原标记单元且该第二待调度单元为该第一目标标记单元的情况下,将该第一待调度单元调度出该原队列,并继续确定该第三待调度单元是否为该第一原标记单元;在该第一待调度单元为该第一原标记单元且该第二待调度单元为该第一目标标记单元的情况下,将该第一原标记单元调度出该第一原队列并在该第一原标记单元调度出该第一原队列后将该第一目标标记单元调度出该第一目标队列。
该预设调度规则可以是轮询调度、加权轮询调度、严格优先级调度等规则。
可选的,在一些实施例中,该调度设备还可以维护一个对应于该队列对的计数器对。例如,第一计数器对对应于该第一队列对。该第一计数器对包括第一原计数器和第一目标计数器。该第一原计数器对应于该第一原队列,该第一目标计数器对应于该第一目标队列。在将该第一原标记单元输入该第一原队列的情况下,将该第一原计数器的值加1;在将该第一目标标记输入该第一目标队列的情况下,将该第一目标计数器的值加1;在该第一原标记单元调度出该第一原队列的情况下,将该第一原计数器的值减1;在该第一目标标记单元调度出该第一目标队列的情况下,将该第一目标计数器的值减1。这样,可以避免当该原队列为另一队列的原队列或另一队列的目标队列时,无法正确选择调度队列的情况发生。
可选的,在一些实施例中,在将该第一目标标记单元调度出该第一目标队列之前,该方法还包括:确定该第一原计数器的值小于该第一目标计数器的值。换句话说,若将该第二带调度单元调度出该目标队列之前该第一原计数器的值大于或等于该第一目标计数器的值,则不将该第二待调度单元调度出该第一目标队列。在此情况下,可以继续将该第一原队列中的待调度单元调度出该第一原队列。这样,可以避免当该第一原队列为另一队列对的原队列或另一队列对的目标队列时,无法正确选择调度队列的情况发生。
可选的,在一些实施例中,该原标记单元携带第一编号信息,该目标标记单元携带该第一编号信息和第二编号信息,其中该第一编号信息为该原计数器的编号,该第二编号信息为该目标计数器的编号;该方法还包括:根据该第一编号信息和该第二编号信息确定该原计数器和该目标计数器。
具体地,当该第一原标记单元输入该第一原队列时,可以根据该第一编号信息,将该第一计数器对中的第一原计数器的值加1;当该第一目标标记单元输入该第一目标队列时,可以根据该第二编号信息,将该第一计数器对中的第一目标计数器的值加1;当该第一原标记单元调度出该第一原队列时,可以根据该第一编号信息,将该第一原计数器的值减1; 当该第一原标记单元调度出该第一目标队列时,可以根据该第二编号细信息,将该第一目标计数器的值减1。当该第一目标标记单元为该第一目标队列的第一个待调度单元的情况下,可以根据该第一编号信息和该第二编号信息确定需要比较的该第一计数器对中的第一原计数器的值和第一目标计数器的值。
可选的,在一些实施例中图1所示的方法还可以包括:接收来自第二数据流的N 2个数据单元,其中N 2为大于或等于1的正整数;将该N 2个数据单元输入该第一原队列;确定该第二数据流从该第一原队列切换为该第一目标队列;将第二原标记单元输入该第一原队列并将第二目标标记单元输入该第一目标队列;接收来自该第二数据流的M 2个数据单元,其中M 1为大于或等于1的正整数;将该M 2个数据单元输入该第一目标队列;根据该第二原标记单元和该第二目标标记单元,将该N 2个数据单元和该第二原标记单元调度出该第一原队列并将该第二目标标记单元和该M 2个数据单元调度出该第一目标队列,其中该第二原标记单元调度出该第一原队列的时刻早于该第二目标调度单元调度出该第一目标队列的时刻;在将该第二原标记单元输入该第一原队列的情况下,将该第一原计数器的值加1;在将该第二目标标记输入该第一目标队列的情况下,将该第一目标计数器的值加1;在该第二原标记单元调度出该第一原队列的情况下,将该第一原计数器的值减1;在该第二目标标记单元调度出该第一目标队列的情况下,将该第一目标计数器的值减1;在将该第二目标标记单元调度出该第一目标队列之前,该方法还包括:确定该第一原计数器的值小于该第一目标计数器的值。该交换设备调度该第二数据流中的数据单元的具体调度方式与调度该第一数据流中的数据单元的具体调度方式类似,在此就不必赘述。
可选的,在一些实施例中图1所示的方法还可以包括:接收来自第三数据流的N 3个数据单元,其中N 3为大于或等于1的正整数;将该N 3个数据单元输入第二原队列;确定该第三数据流从该第二原队列切换为第二目标队列,其中该第二原队列与该第二目标队列属于第二队列对,该第二原队列与该第一原队列不同和/或该第二目标队列与该第一目标队列不同;将第三原标记单元输入该第二原队列并将第三目标标记单元输入该第二目标队列;接收来自该第三数据流的M 3个数据单元,其中M 1为大于或等于1的正整数;将该M 3个数据单元输入该第二目标队列;根据该第三原标记单元和该第三目标标记单元,将该N 3个数据单元和该第三原标记单元调度出该第二原队列并将该第三目标标记单元和该M 3个数据单元调度出该第二目标队列,其中该第三原标记单元调度出该第二原队列的时刻早于该第二目标调度单元调度出该第二目标队列的时刻;在将该第三原标记单元输入该第二原队列的情况下,将第二计数器对中的第二原计数器的值加1;在将该第三目标标记输入该第二目标队列的情况下,将该第二计数器对中的第二目标计数器的值加1,其中该第二计数器对对应于该第二队列对,该第二原计数器对应于该第二原队列,该第二目标计数器对应于该第二目标队列;在该第三原标记单元调度出该第二原队列的情况下,将该第二原计数器的值减1;在该第三目标标记单元调度出该第二目标队列的情况下,将该第二目标计数器的值减1;在将该第三目标标记单元调度出该第二目标队列之前,该方法还包括:确定该第二原计数器的值小于该第二目标计数器的值。该交换设备调度该第三数据流中的数据单元的具体调度方式与调度该第一数据流中的数据单元的具体调度方式类似,在此就不必赘述。在该第二原队列与该第一原队列相同且该第二目标队列与该第一目标队列不同,或者该第二原队列与该第一原队列不同且该第二目标队列与该第一目标队列相同的 情况下,第一队列对和第二队列对所对应的计数器对是不同的。因此,可以通过比较计数器对中的原计数器的值和目标计数器的值,可以避免当该第一原队列为另一队列对的原队列或另一队列对的目标队列时,无法正确选择调度队列的情况发生。
图2是根据本申请实施例提供的一种调度数据的方法的示意图。如图2所示的队列对1包括两个队列,原队列11和目标队列12。数据流1先输入原队列11。如图2所示,输入原队列11的数据单元包括数据流1的中的数据单元10至12。在数据流1从原队列11切换到目标队列12的情况下,标记单元11输入原队列11,标记单元12输入目标队列12。在此之后,获取到的数据流1的数据单元输入目标队列12。如图2所示,输入目标队列12的数据单元包括数据流1中的数据单元13和数据单元14。
如图2所示,原队列11中共包括四个单元,依次为数据单元10、数据单元11、数据单元12和标记单元11且位于的队首的第一个待调度单元为数据单元10。目标队列12中共包括三个单元,依次为标记单元12、数据单元13和数据单元14且位于队首的第一个待调度单元为标记单元12。此外,数据流1输入队列对1中的数据单元的顺序为:数据单元10、数据单元11、数据单元12、数据单元13和数据单元14。
交换设备会确定原队列11中的第一个待调度单元是否为标记单元,确定目标队列12中的第一个待调度单元是否为标记单元。如图2所示,交换设备确定原队列11中的第一个待调度单元不为标记单元,确定目标队列12中的第一个待调度单元为标记单元。在此情况下,交换设备可以将原队列11中的第一个待调度单元调度出原队列11,即将数据单元10调度出原队列11。此外,该交换设备不会调度目标队列12中的第一个待调度单元,即标记单元12。在将数据单元10调度出原队列11后,该交换设备会确定原队列11中下一个待调度单元是否为标记单元。如图2所示,数据单元10之后的待调度单元为数据单元11。在此情况下,该交换设备会继续将数据单元11调度出原队列11。在将数据单元11调度出原队列11后,该交换设备会继续确定队列11中下一个待调度单元是否为标记单元。如图2所示,数据单元11之后的待调度单元为数据单元12。在此情况下,该交换设备会继续将数据单元12调度出原队列11。在将数据单元12调度出原队列11后,该交换设备会继续确定原队列11中下一个待调度单元是否为标记单元。如图2所示,数据单元12之后的待调度单元为标记单元11。在此情况下,该交换设备会将该标记单元11调度出原队列11。在将标记单元11调度出原队列11后,该交换设备可以将位于目标队列12的队首的标记单元12调度出目标队列12。在此之后,目标队列12中的第一个待调度单元为数据单元13。
可选的,作为一个实施例,该交换设备可以停止从原队列11中调度出数据单元。在将该标记单元12调度出目标队列12后,该交换设备可以确定目标队列12中下一个待调度单元是否为标记单元。如图2所示,标记单元12之后的待调度单元为数据单元13。在此情况下,该交换设备会继续将数据单元13调度出目标队列12。在将数据单元13调度出目标队列12后,该交换设备会继续确定目标队列12中下一个待调度单元是否为标记单元。如图2所示,数据单元13之后的待调度单元为数据单元14。在此情况下,该交换设备会将数据单元14调度出目标队列12。
可以理解的是,该交换设备在确定一个待调度单元是否为标记单元之前,会先确定是否还存在该待调度单元,若不存在该待调度单元,则从将另一队列中的单元调度出队列, 若存在该待调度单元,则确定该待调度单元是否为标记单元。例如,在将数据单元14调度出目标队列12后,该交换设备会确定目标队列12中是否还有待调度单元。在目标队列12中没有待调度单元且原队列11还有待调度单元的情况下,可以将原队列11中的待调度单元调度出原队列11。
通过上述过程,从原队列11和目标队列12中调度出的数据单元的顺序为:数据单元10、数据单元11、数据单元12、数据单元13和数据单元14。由此可见,输入到该交换设备的数据单元的输入顺序与该交换设备输出的数据单元的输出顺序是相同的。
如图2所示的实施例中仅涉及了一个数据流输入该交换设备。在一些实施例中,除了数据流1外,该交换设备还可以接收数据流2。
可选的,在一些实施例中,数据流2始终会输入原队列11。在此情况下,输入到该交换设备的数据单元的输入顺序与该交换设备输出的数据单元的输出顺序是相同的。
例如,数据流2中的数据单元20和数据单元21(图2中未示出)在数据单元10之后和数据单元11之前输入到原队列11。在此情况下,按照上述规则,从队列对1中输出的数据单元依次为数据单元10、数据单元20、数据单元21、数据单元11、数据单元12、数据单元13和数据单元14。
又如,数据流2中的数据单元22和数据单元23(图2中未示出)在数据流1从原队列11切换到目标队列12后输入到原队列11。
可选的,在一些实施例中,可以在将目标队列12中的数据单元13和数据单元14调度出目标队列后,再将数据单元22和数据单元23调度出原队列11。这样,根据上述规则,从原队列11和目标队列12中输出的数据单元依次为:数据单元10、数据单元20、数据单元21、数据单元11、数据单元12、数据单元13、数据单元14、数据单元22和数据单元23。由此可见,输入到该交换设备的数据流1的数据单元的输入顺序与该交换设备输出数据流1中的数据单元的输出顺序相同,输入到该交换设备的数据流2的数据单元的输入顺序与该交换设备输出数据流2中的数据单元的输出顺序相同。
可选的,另在一些实施例中,在将标记单元11调度出原队列11后,该交换设备可以将标记单元12调度出目标队列12。在此之后,该交换设备可以继续确定原队列11中的下一个待调度单元是否为标记单元,确定目标队列12中的下一个待调度单元是否为标记单元。此时,原队列11中的下一个待调度单元为数据单元22,目标队列12中的下一个待调度单元为数据单元13。换句话说,原队列11中的下一个待调度单元和目标队列中的下一个待调度单元均不是标记单元。在此情况下,该交换设备可以根据预设规则调度该数据单元22和该数据单元13。例如,假设该预设规则为轮询调度且先调度原队列11再调度目标队列12,则该交换设备可以先将数据单元22调度出原队列11,然后将数据单元13调度出目标队列12。类似的,数据单元22之后的待调度单元为数据单元23,数据单元13之后的待调度单元为数据单元14。该交换设备可以采用相同的方式,先将数据单元23调度出原队列11,然后再将数据单元14调度出目标队列12。这样,根据上述规则,从原队列11和目标队列12中输出的数据单元依次为:数据单元10、数据单元20、数据单元21、数据单元11、数据单元12、数据单元22、数据单元13、数据单元23和数据单元14。由此可见,输入到该交换设备的数据流1的数据单元的输入顺序与该交换设备输出数据流1中的数据单元的输出顺序相同,输入到该交换设备的数据流2的数据单元的输 入顺序与该交换设备输出数据流2中的数据单元的输出顺序相同。
可选的,另在一些实施例中,在将标记单元11调度出原队列11后,该交换设备可以将继续确定原队列11中的下一个待调度单元是否为标记单元。该原队列11中的下一个待调度单元为数据单元22,而目标队列12中的下一个待调度单元为标记单元12。因此,该交换设备可以继续将原队列11中的数据单元22调度出原队列11。原队列11中的数据单元22后的下一个待调度单元为数据单元23。因此,该交换设备可以继续将数据单元23调度出原队列11。数据单元23之后原队列11中没有待调度单元。在此情况下,可以将目标队列12中的单元调度出队列。这样,根据上述规则,从原队列11和目标队列12中输出的数据单元依次为:数据单元10、数据单元20、数据单元21、数据单元11、数据单元12、数据单元22、数据单元23、数据单元13和数据单元14。由此可见,输入到该交换设备的数据流1的数据单元的输入顺序与该交换设备输出数据流1中的数据单元的输出顺序相同,输入到该交换设备的数据流2的数据单元的输入顺序与该交换设备输出数据流2中的数据单元的输出顺序相同。
可选的,在一些实施例中,还可以设置一对计数器对。该计数器对包括原计数器11和目标计数器12。原计数器11对应于原队列11,目标计数器12对应于目标队列12。该交换设备可以每个队列输入一个标记单元后,将该队列对应的计数器的值加1。例如,在将标记单元11输入到队列11的情况下将原计数器11的值加1;在将标记单元12输入到队列12的情况下,将目标计数器12的值加1。该交换设备还可以在将标记单元11调度出原队列11后将原计数器11的值减1,在将标记单元12调度出目标队列12后,将目标计数器12的值减1。
进一步,该交换设备在将位于目标队列中的标记单元调度出该目标队列之前,需要确定目标计数器的值大于原计数器的值。具体地,该交换设备在将标记单元12调度出目标队列12之前,需要确定目标计数器12的值大于原计数器11的值。
进一步,标记单元11可以包括编号信息11,编号信息11为原计数器11的编号。类似的,标记单元12可以包括编号信息12,编号信息12为目标计数器12的编号。可选的,在一些实施例中,标记单元12还可以携带编号信息11。这样,当标记单元12为目标队列12的第一个待调度单元的情况下,可以根据编号信息11和编号信息12确定需要比较的计数器对中的原计数器和目标计数器。
该交换设备可以根据标记单元中的编号信息对相应的原计数器和目标计数器的值进行加减操作。
可选的,在另一些实施例中,数据流2也会从原队列11切换到目标队列12。在此情况下,该交换设备可以采用与处理数据流1相同的方案调度获取到的数据流2的数据单元,具体如图3所示。
图3是根据本申请实施例提供的一种调度数据的方法的示意图。如图3所示的队列对1包括两个队列,原队列11和目标队列12。数据流1先输入原队列11。如图3所示,输入原队列11的数据单元包括数据流1的中的数据单元10至12。在数据流1从原队列11切换到目标队列12的情况下,标记单元11输入原队列11,标记单元12输入目标队列12。在此之后,获取到的数据流1的数据单元输入目标队列12。如图3所示,输入目标队列12的数据单元包括数据流1中的数据单元13和数据单元14。在将数据单元14输入到目 标队列12后,该交换设备接收数据流2。数据流2先输入原队列11。如图3所示,输入原队列11的数据单元包括数据单元20和数据单元21。在数据流2从原队列11切换到目标队列12的情况下,标记单元21输入原队列11,标记单元22输入目标队列12。在此之后,获取到的数据流2的数据单元输入目标队列12。如图3所示,输入目标队列12的数据单元包括数据流2中的数据单元22和数据单元23。
该交换设备处理原队列11和目标队列12中的数据单元10至12以及标记单元11的方式与图2所示的实施例相同,在此就不必赘述。
只要一个数据流的输入到原队列的标记单元早于该数据流输入到目标队列的标记单元输出队列,该数据流中的数据单元的输入顺序与输出顺序就可以相同。以图3为例,只要标记单元11调度出原队列11的时刻早于标记单元12调度出目标队列12的时刻,就可以保证数据流1中的数据单元的输入顺序与输出顺序不发生变化。类似的,只要标记单元21调度出原队列11的时刻早于标记单元22调度出目标队列12的时刻,就可以保证数据流2中的数据单元的输入顺序与输出顺序不发生变化。
因此,在一些实施例中,在标记单元11调度出原队列11后,该交换设备可以继续从原队列11中调度出单元,直到将标记单元21调度出原队列11后,在依次将目标队列12中的标记单元12、数据单元13、数据单元14、标记单元22、数据单元22和数据单元23调度出目标队列12即可。
在另一些实施例中,在将标记单元11调度出原队列11后,可以将标记单元12调度出目标队列12。然后可以采用轮询调度的方式依次将数据单元20、数据单元13、数据单元21和数据单元14调度出各自所在的队列。在此之后,依次将标记单元21、标记单元22、数据单元22和数据单元23调度出各自所在的队列。
在另一些实施例中,在将标记单元11调度出原队列11后,可以将标记单元12调度出目标队列12。然后可以依次将数据单元13和数据单元14调度出目标队列12。在将数据单元14调度出目标队列12之后,可以依次将数据单元20、数据单元21和标记单元21调度出原队列11。在将标记单元21调度出原队列11后,可以依次将标记单元22、数据单元22和数据单元23调度出目标队列12。
无论采用上述哪一种实施例,数据流1中的数据单元的输入顺序与输出顺序不发生变化,数据流2中的数据单元的输入顺序与输出顺序不发生变化。
可选的,在一些实施例中,还可以设置一对计数器对。该计数器对包括原计数器11和目标计数器12。原计数器11对应于原队列11,目标计数器12对应于目标队列12。该交换设备可以每个队列输入一个标记单元后,将该队列对应的计数器的值加1。例如,在将标记单元11输入到队列11的情况下将原计数器11的值加1;在将标记单元12输入到队列12的情况下,将目标计数器12的值加1;在将标记单元21输入到原队列11的情况下将原计数器11的值加1;在将标记单元22输入到目标队列12的情况下将目标计数器12的值加1。该交换设备还可以在将标记单元11调度出队列11后将原计数器11的值减1,在将标记单元12调度出目标队列12后将目标计数器12的值减1,在将标记单元21调度出原队列11后将原计数器11的值减1,在将标记单元22调度出目标队列12后将目标计数器12的值减1。
进一步,该交换设备在将位于目标队列中的标记单元调度出该目标队列之前,需要确 定目标计数器的值大于原计数器的值。具体地,在将标记单元12调度出目标队列12之前,需要确定目标计数器12的值大于原计数器11的值;在将标记单元22调度出目标队列12之前,需要确定目标计数器12的值大于原计数器11的值。
进一步,标记单元11和标记单元21可以包括编号信息11,编号信息11为原计数器11的编号。类似的,标记单元12和标记单元22可以包括编号信息12,编号信息12为目标计数器12的编号。可选的,在一些实施例中,标记单元12还可以携带编号信息11。这样,当标记单元12为目标队列12的第一个待调度单元的情况下,可以根据编号信息11和编号信息12确定需要比较的计数器对中的原计数器和目标计数器。
该交换设备可以根据标记单元中的编号信息对相应的原计数器和目标计数器的值进行加减操作。
可选的,在一些实施例中,两个不同的数据流对应的队列对所包括的队列可以是相同的,但是先入的队列和切换的队列是不同的。例如,数据流1先输入的队列与数据流2切换队列后输入的队列是同一队列;数据流2先输入的队列与数据流1切换队列后输入的队列是同一队列。在此情况下,可以认为数据流1对应队列对1,该队列对1包括原队列11和目标队列12;认为数据流2对应队列对2,该队列对2包括原队列21和目标队列12。原队列21和目标队列12是同一个队列,目标队列12和原队列11是同一个队列。在此情况下,可以设置对应于队列对1的计数器对1和对应于队列对2的计数器对2。交换设备可以利用计数器对中的计数器的值与标记单元调度原队列和目标队列中的单元。具体实现方式可以参见图4所示的实施例。
图4是根据本申请实施例提供的一种调度数据的方法的示意图。如图4所示的队列对1包括两个队列,原队列11和目标队列12。数据流1先输入原队列11。如图4所示,输入原队列11的数据单元包括数据流1的中的数据单元10至12。在数据流1从原队列11切换到目标队列12的情况下,标记单元11输入原队列11,标记单元12输入目标队列12。在此之后,获取到的数据流1的数据单元输入目标队列12。如图4所示,输入目标队列12的数据单元包括数据流1中的数据单元13和数据单元14。在将数据单元14输入到目标队列12后,该交换设备接收数据流2。数据流2对应队列对2。队列对2包括原队列21和目标队列22。原队列21和目标队列12是同一个队列,目标队列12和原队列11是同一个队列。数据流2先输入原队列21。如图4所示,输入原队列21的数据单元包括数据单元20和数据单元21。在数据流2从原队列21切换到目标队列22的情况下,标记单元21输入原队列21,标记单元22输入目标队列22。在此之后,获取到的数据流2的数据单元输入目标队列22。如图4所示,输入目标队列22的数据单元包括数据流2中的数据单元22和数据单元23。
计数器对1包括原计数器11和目标计数器12,原计数器11对应于原队列11,目标计数器12对应于目标队列12。计数器对2包括原计数器21和目标计数器22,原计数器21对应于原队列21,目标计数器22对应于目标队列22。
在标记单元11输入到原队列11的情况下,可以将原计数器11的值加1;在标记单元12输入到目标队列12的情况下,可以将目标计数器12的值加1。在标记单元21输入到原队列21的情况下,可以将原计数器21的值加1;在标记单元22输入到目标队列22的情况下,可以将目标计数器12的值加1。每个计数器对中的两个计数器的初始值是相 同的。换句话说,原计数器11的初始值与目标计数器12的初始值相同,原计数器21的初始值与目标计数器22的初始值相同。假设原计数器11、目标计数器12、原计数器21和目标计数器22的初始值均为0,则在图4所示的情况下,原计数器11、目标计数器12、原计数器21和目标计数器22的值均为1。
标记单元11可以包括编号信息11,编号信息11为原计数器11的编号。类似的,标记单元12可以包括编号信息12,编号信息12为目标计数器12的编号;标记单元21可以包括编号信息21,编号信息21为原计数器21的编号;标记单元22可以包括编号信息22,编号信息22为目标计数器22的编号。
标记单元12还可以携带编号信息11,标记单元22还可以携带编号信息21。这样,当标记单元12为目标队列12的第一个待调度单元的情况下,可以根据标记单元12/标记单元22携带的编号信息确定需要比较的计数器对中的原计数器和目标计数器。
该交换设备可以根据标记单元中的编号信息对相应的原计数器和目标计数器的值进行加减操作。
该交换设备对属于多个数据流的数据单元的调度方式与对属于一个数据流的数据单元的调度方式类似。换句话说,可以认为该交换设备对属于不同的数据流的数据单元可以采用相同的方式调度。
以图4所示的原队列11、目标队列12、原队列12和目标队列22为例。该交换设备确定位于原队列11队首的待调度单元为数据单元,位于目标队列12队首的待调度单元为标记单元。在此情况下,交换设备可以将原队列11中的第一个待调度单元调度出原队列11,即将数据单元10调度出原队列11。在将数据单元10调度出原队列11后,该交换设备会确定原队列11中下一个待调度单元是否为标记单元。如图4所示,数据单元10之后的待调度单元为数据单元11。在此情况下,该交换设备会继续将数据单元11调度出原队列11。在将数据单元11调度出原队列11后,该交换设备会继续确定原队列11中下一个待调度单元是否为标记单元。如图4所示,数据单元11之后的待调度单元为数据单元12。在此情况下,该交换设备会继续将数据单元12调度出原队列11。在将数据单元12调度出原队列11后,该交换设备会确定判断原队列11中下一个待调度单元是否为标记单元。如图4所示,数据单元12之后的待调度单元为标记单元11。在此情况下,该交换设备会将该标记单元11调度出原队列11,将原计数器11的值减1。这样,原计数器11的值小于目标计数器12的值。在标记单元11调度出原队列11后,该交换设备可以确定原队列11中的下一个待调度单位为标记单元22。同时,该交换设备可以根据标记单元22携带的计数器编号信息确定原计数器21的值等于目标计数器22的值。因此,在将标记单元11调度出原队列11后,目标计数器12的值大于原计数器11的值,原计数器21得值等于目标计数器22的值。在此情况下,该交换设备将位于目标队列12的队首的标记单元12调度出目标队列12。同时,该交换设备会停止从原队列11中调度出数据单元。在将该标记单元12调度出目标队列12后,该交换设备会将目标计数器12的值减1。在将该标记单元12调度出目标队列12后,该交换设备确定目标队列12中下一个待调度单元是否为标记单元。如图4所示,标记单元12之后的待调度单元为数据单元13。在此情况下,该交换设备会继续将数据单元13调度出目标队列12。在将数据单元13调度出目标队列12后,该交换设备会继续判断目标队列12中下一个待调度单元是否为标记单元。如图4所示, 数据单元13之后的待调度单元为数据单元14。在此情况下,该交换设备会将数据单元14调度出目标队列12。
在将数据单元14调度出目标队列12后,位于原队列11队首的待调度单元为标记单元22,位于目标队列12队首的待调度单元为数据单元20。
该交换设备可以根据标记单元22中的编号信息确定原计数器21得值等于目标计数器22的值。因此,该交换设备可以将数据单元20从原队列21中调度出来。该交换设备会确定原队列21中下一个待调度单元是否为标记单元。如图4所示,数据单元20之后的待调度单元为数据单元21。在此情况下,该交换设备会继续将数据单元21调度出原队列21。在将数据单元21调度出原队列21后,该交换设备会继续判断队列21中下一个待调度单元是否为标记单元。如图4所示,数据单元21之后的待调度单元为标记单元21。在此情况下,该交换设备会将该标记单元21调度出原队列21,将原计数器21的值减1。这样,原计数器21的值小于目标计数器22的值。在此情况下,该交换设备将位于目标队列22的队首的标记单元22调度出目标队列22。同时,该交换设备会停止从原队列21中调度出数据单元。在将该标记单元22调度出目标队列22后,该交换设备会将目标计数器22的值减1。在将该标记单元22调度出目标队列12后,该交换设备判断目标队列22中下一个待调度单元是否为标记单元。如图4所示,标记单元22之后的待调度单元为数据单元22。在此情况下,该交换设备会继续将数据单元22调度出目标队列22。在将数据单元22调度出目标队列22后,该交换设备会继续判断目标队列22中下一个待调度单元是否为标记单元。如图4所示,数据单元22之后的待调度单元为数据单元23。在此情况下,该交换设备会将数据单元23调度出目标队列22。
通过上述过程,从原队列11和目标队列12中调度出的数据单元的顺序为:数据单元10、数据单元11、数据单元12、数据单元13、数据单元14、数据单元20、数据单元21、数据单元22和数据单元23。由此可见,输入到该交换设备的数据单元的输入顺序与该交换设备输出的数据单元的输出顺序是相同的。
图2至图4所示的实施例中,每个队列是一个队列的原队列或目标队列。在一些实施例中,一个队列可以是多个队列的原队列或目标队列。在此情况下,一个队列对仍然是包括两个队列,即一个原队列和一个目标队列。
例如,存在队列A、队列B和队列C三个队列。数据流1从队列A切换到队列B。在此情况下,对于数据流1而言,数据流1对应于队列对AB,队列对AB中的队列A为数据流1的原队列,队列对AB中的队列B为数据流1的目标队列。数据流2从队列A切换到队列C。在此情况下,对于数据流2而言,数据流量2对应于队列对AC,队列对AC中队列A为数据流2的原队列,队列对AC中的队列C为数据流2的目标队列。
又如,存在队列D、队列E和队列F三个队列。数据流3从队列D切换到队列F。在此情况下,对于数据流1而言,数据流1对应于队列对DF,队列对DF中的队列D为数据流1的原队列,队列对DF中的队列F为数据流1的目标队列。数据流2从队列E切换到队列F。在此情况下,对于数据流2而言,数据流量2对应于队列对EF,队列对EF中队列E为数据流2的原队列,队列对EF中的队列F为数据流2的目标队列。
下面将结合图5对一个队列为多个队列的原队列的情况进行描述。
图5是根据本申请实施例提供的一种调度数据的方法的示意图。如图5所示的队列对 1包括两个队列,原队列11和目标队列12。数据流1先输入原队列11。如图5所示,输入原队列11的数据单元包括数据流1的中的数据单元10至12。在数据流1从原队列11切换到目标队列12的情况下,标记单元11输入原队列11,标记单元12输入目标队列12。在此之后,获取到的数据流1的数据单元输入目标队列12。如图5所示,输入目标队列12的数据单元包括数据流1中的数据单元13和数据单元14。在将数据单元14输入到目标队列12后,该交换设备接收数据流2。数据流2对应队列对2。队列对2包括原队列21和目标队列22。原队列21和原队列11是同一个队列。目标队列22和目标队列12是不同的队列。数据流2先输入原队列21。如图5所示,输入原队列21的数据单元包括数据单元20和数据单元21。在数据流2从原队列21切换到目标队列22的情况下,标记单元21输入原队列21,标记单元22输入目标队列22。在此之后,获取到的数据流2的数据单元输入目标队列22。如图5所示,输入目标队列22的数据单元包括数据流2中的数据单元22和数据单元23。
在标记单元11输入到原队列11的情况下,可以将原计数器11的值加1;在标记单元12输入到目标队列12的情况下,可以将目标计数器12的值加1。在标记单元21输入到原队列21的情况下,可以将原计数器21的值加1;在标记单元22输入到目标队列22的情况下,可以将目标计数器12的值加1。每个计数器对中的两个计数器的初始值是相同的。换句话说,原计数器11的初始值与目标计数器12的初始值相同,原计数器21的初始值与目标计数器22的初始值相同。假设原计数器11、目标计数器12、原计数器21和目标计数器22的初始值均为0,则在图5所示的情况下,原计数器11、目标计数器12、原计数器21和目标计数器22的值均为1。
标记单元11可以包括编号信息11,编号信息11为原计数器11的编号。类似的,标记单元12可以包括编号信息12,编号信息12为目标计数器12的编号;标记单元21可以包括编号信息21,编号信息21为原计数器21的编号;标记单元22可以包括编号信息22,编号信息22为目标计数器22的编号。
标记单元12还可以携带编号信息11,标记单元22还可以携带编号信息21。这样,当标记单元12为目标队列12的第一个待调度单元的情况下,可以根据标记单元12/标记单元22携带的编号信息确定需要比较的计数器对中的原计数器和目标计数器。
该交换设备可以根据标记单元中的编号信息对相应的原计数器和目标计数器的值进行加减操作。
可选的,在一些实施例中,该交换设备处理数据单元10至14以及标记单元11和12的具体过程可以与图4所示实施例中该交换设备处理数据单元10至14以及标记单元11和12的具体过程相同,在此就不必赘述。
在将数据单元14调度出目标队列12后,位于原队列11队首的待调度单元为数据单元20,位于目标队列22队首的待调度单元为标记单元22。
该交换设备可以根据标记单元22中的编号信息确定出标记单元22对应的计数器为目标计数器22。同时,原计数器21的值与目标计数器22的值相同。在此情况下,交换设备会将原队列21中的第一个待调度单元调度出原队列21,即将数据单元20调度出原队列21。在将数据单元20调度出原队列21后,该交换设备会确定原队列21中下一个待调度单元是否为标记单元。如图5所示,数据单元20之后的待调度单元为数据单元21。在 此情况下,该交换设备会继续将数据单元21调度出原队列21。在将数据单元21调度出原队列21后,该交换设备会继续确定原队列21中下一个待调度单元是否为标记单元。如图5所示,数据单元21之后的待调度单元为标记单元21。在此情况下,该交换设备会将该标记单元21调度出原队列21,将原计数器21的值减1。这样,原计数器21的值小于目标计数器22的值。在此情况下,该交换设备将位于目标队列22的队首的标记单元22调度出目标队列22。同时,该交换设备会停止从原队列21中调度出数据单元。在将该标记单元22调度出目标队列22后,该交换设备会将目标计数器22的值减1。在将该标记单元22调度出目标队列12后,该交换设备确定目标队列22中下一个待调度单元是否为标记单元。如图5所示,标记单元22之后的待调度单元为数据单元22。在此情况下,该交换设备会继续将数据单元22调度出目标队列22。在将数据单元22调度出目标队列22后,该交换设备会继续确定目标队列22中下一个待调度单元是否为标记单元。如图5所示,数据单元22之后的待调度单元为数据单元23。在此情况下,该交换设备会将数据单元23调度出目标队列22。
通过上述过程,从原队列11和目标队列12中调度出的数据单元的顺序为:数据单元10、数据单元11、数据单元12、数据单元13、数据单元15、数据单元20、数据单元21、数据单元22和数据单元23。由此可见,数据流1中的数据单元的输入顺序与输出顺序不发生变化,数据流2中的数据单元的输入顺序与输出顺序不发生变化。
可选的,在另一些实施例中,该交换设备也可以先将原队列11中所有的单元全部调度出原队列11,即将数据单元10、数据单元11、数据单元12、标记单元11、数据单元20、数据单元21和标记单元21全部调度出原队列11。在此之后,该交换设备再将目标队列12和目标队列22中的全部单元调度出各自所在的队列。在此情况下,数据流1中的数据单元的输入顺序与输出顺序不发生变化,数据流2中的数据单元的输入顺序与输出顺序不发生变化。
可选的,在另一些实施例中,该交换设备将原队列11中的数据单元11至12调度出原队列11,将标记单元11调度出原队列11之后,可以先将目标队列12中的标记单元12调度出目标队列12。然后,该交换设备可以根据预设规则(例如轮训调度)来调度原队列21中剩余的数据单元和目标队列12剩余的数据单元。在将标记单元21调度出原队列21后,该交换设备可以将目标队列22中的标记单元22、数据单元22和数据单元23依次调度出目标队列22。
本领域技术人员可以理解的是,一个队列为多个队列的目标队列的情况与一个队列为多个队列原队列的情况类似,在此就不必赘述。
图6是根据本申请实施例提供的一种交换设备的结构框图。如图6所示交换设备600包括处理单元601和输入单元602。
输入单元602,用于接收来自第一数据流的N 1个数据单元,其中所述数据单元为数据包或数据包的描述符,N 1为大于或等于1的正整数。
输入单元602,还用于将所述N 1个数据单元输入第一原队列。
处理单元601,用于确定所述第一数据流从所述第一原队列切换为第一目标队列,其中所述第一原队列与所述第一目标队列属于第一队列对。
处理单元601,还用于生成第一原标记单元和第一目标标记单元,将所述第一原标记 单元输入所述第一原队列并将所述第一目标标记单元输入所述第一目标队列。
输入单元602,还用于接收来自所述第一数据流的M 1个数据单元,其中M 1为大于或等于1的正整数。
输入单元602,还用于将所述M 1个数据单元输入所述第一目标队列。
处理单元601,还用于根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列并将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列,其中所述第一原标记单元调度出所述第一原队列的时刻早于所述第一目标调度单元调度出所述第一目标队列的时刻。
处理单元601和输入单元602的具体功能和有益效果,可以参见图1所示的实施例,在此就不必赘述。
处理单元601可以由处理器实现,输入单元602可以由接收实现。
图7是根据本申请实施例提供的另一交换设备的结构框图。如图7所示的交换设备700包括存储器701和处理器702。
存储器701,用于存储程序。
处理器702,用于执行存储器701存储的程序,当程序被执行时,使得交换设备700可以实现上述图1实施例提供的方法。
利用交换设备700可以将图1所示的方法中的部分或全部通过软件来实现。
存储器701可以是物理上独立的单元,也可以与处理器702集成在一起。
可选的,当图1所示的方法中的部分或全部通过软件实现时,交换设备700也可以只包括处理器702。用于存储程序的存储器701位于装置700之外,处理器702通过电路/电线与存储器701连接,用于读取并执行存储器701中存储的程序。
处理器702可以是中央处理器(central processing unit,CPU),网络处理器(network processor,NP)或者CPU和NP的组合。
处理器702还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。
存储器701可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器701也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储器701还可以包括上述种类的存储器的组合。
本申请的又一方面提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令在计算机上运行时,使得计算机执行上述如图1所示的方法。
本申请的又一方面提供了一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行如图1所示的方法。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可 以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (17)

  1. 一种调度数据的方法,其特征在于,所述方法包括:
    接收来自第一数据流的N 1个数据单元,其中所述数据单元为数据包或数据包的描述符,N 1为大于或等于1的正整数;
    将所述N 1个数据单元输入第一原队列;
    确定所述第一数据流从所述第一原队列切换为第一目标队列,其中所述第一原队列与所述第一目标队列属于第一队列对;
    将第一原标记单元输入所述第一原队列并将第一目标标记单元输入所述第一目标队列;
    接收来自所述第一数据流的M 1个数据单元,其中M 1为大于或等于1的正整数;
    将所述M 1个数据单元输入所述第一目标队列;
    根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列并将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列,其中所述第一原标记单元调度出所述第一原队列的时刻早于所述第一目标调度单元调度出所述第一目标队列的时刻。
  2. 如权利要求1所述的方法,其特征在于,所述根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列并将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列,包括:
    根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列,并在所述第一原标记单元调度出所述第一原队列后,将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列。
  3. 如权利要求2所述的方法,其特征在于,所述根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列,并在所述第一原标记单元调度出所述第一原队列后,将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列,包括:
    确定第一待调度单元是否为所述第一原标记单元,其中所述第一待调度单元为所述原队列中第一个待调度的单元;
    确定第二待调度单元是否为所述第一目标标记单元,其中所述第二待调度单元为所述目标队列中第一个待调度的单元;
    在所述第一待调度单元不为所述第一原标记单元且所述第二待调度单元不为所述第一目标标记单元的情况下,根据预设规则调度所述第一待调度单元和所述第二待调度单元,并继续确定第三待调度单元是否为所述第一原标记单元,确定第四待调度单元是否为所述第一目标标记单元,其中所述第三待调度单元为在将所述第一待调度单元调度出所述第一原队列后所述第一原队列中的第一个待调度的单元,所述第四待调度单元为在将所述第二待调度单元调度出所述第一目标队列后所述第一目标队列中的第一个待调度的单元;
    在所述第一待调度单元不为所述第一原标记单元且所述第二待调度单元为所述第一目标标记单元的情况下,将所述第一待调度单元调度出所述原队列,并继续确定所述第三 待调度单元是否为所述第一原标记单元;
    在所述第一待调度单元为所述第一原标记单元且所述第二待调度单元为所述第一目标标记单元的情况下,将所述第一原标记单元调度出所述第一原队列并在所述第一原标记单元调度出所述第一原队列后将所述第一目标标记单元调度出所述第一目标队列。
  4. 如权利要求2或3所述的方法,其特征在于,所述方法还包括:在将所述第一原标记单元输入所述第一原队列的情况下,将第一计数器对中的第一原计数器的值加1;
    在将所述第一目标标记输入所述第一目标队列的情况下,将所述第一计数器对中的第一目标计数器的值加1,其中所述第一计数器对对应于所述第一队列对,所述第一原计数器对应于所述第一原队列,所述第一目标计数器对应于所述第一目标队列;
    在所述第一原标记单元调度出所述第一原队列的情况下,将所述第一原计数器的值减1;
    在所述第一目标标记单元调度出所述第一目标队列的情况下,将所述第一目标计数器的值减1。
  5. 如权利要求4所述的方法,其特征在于,在将所述第一目标标记单元调度出所述第一目标队列之前,所述方法还包括:确定所述第一原计数器的值小于所述第一目标计数器的值。
  6. 如权利要求4或5所述的方法,其特征在于,所述原标记单元携带第一编号信息,所述目标标记单元携带所述第一编号信息和第二编号信息,其中所述第一编号信息为所述原计数器的编号,所述第二编号信息为所述目标计数器的编号;
    所述方法还包括:根据所述第一编号信息和所述第二编号信息确定所述原计数器和所述目标计数器。
  7. 如权利要求5或6所述的方法,其特征在于,所述方法还包括:接收来自第二数据流的N 2个数据单元,其中N 2为大于或等于1的正整数;
    将所述N 2个数据单元输入所述第一原队列;
    确定所述第二数据流从所述第一原队列切换为所述第一目标队列;
    将第二原标记单元输入所述第一原队列并将第二目标标记单元输入所述第一目标队列;
    接收来自所述第二数据流的M 2个数据单元,其中M 1为大于或等于1的正整数;
    将所述M 2个数据单元输入所述第一目标队列;
    根据所述第二原标记单元和所述第二目标标记单元,将所述N 2个数据单元和所述第二原标记单元调度出所述第一原队列并将所述第二目标标记单元和所述M 2个数据单元调度出所述第一目标队列,其中所述第二原标记单元调度出所述第一原队列的时刻早于所述第二目标调度单元调度出所述第一目标队列的时刻;
    在将所述第二原标记单元输入所述第一原队列的情况下,将所述第一原计数器的值加1;
    在将所述第二目标标记输入所述第一目标队列的情况下,将所述第一目标计数器的值加1;
    在所述第二原标记单元调度出所述第一原队列的情况下,将所述第一原计数器的值减1;
    在所述第二目标标记单元调度出所述第一目标队列的情况下,将所述第一目标计数器的值减1;
    在将所述第二目标标记单元调度出所述第一目标队列之前,所述方法还包括:确定所述第一原计数器的值小于所述第一目标计数器的值。
  8. 如权利要求5至7中任一项所述的方法,其特征在于,所述方法还包括:接收来自第三数据流的N 3个数据单元,其中N 3为大于或等于1的正整数;
    将所述N 3个数据单元输入第二原队列;
    确定所述第三数据流从所述第二原队列切换为第二目标队列,其中所述第二原队列与所述第二目标队列属于第二队列对,所述第二原队列与所述第一原队列不同和/或所述第二目标队列与所述第一目标队列不同;
    将第三原标记单元输入所述第二原队列并将第三目标标记单元输入所述第二目标队列;
    接收来自所述第三数据流的M 3个数据单元,其中M 1为大于或等于1的正整数;
    将所述M 3个数据单元输入所述第二目标队列;
    根据所述第三原标记单元和所述第三目标标记单元,将所述N 3个数据单元和所述第三原标记单元调度出所述第二原队列并将所述第三目标标记单元和所述M 3个数据单元调度出所述第二目标队列,其中所述第三原标记单元调度出所述第二原队列的时刻早于所述第二目标调度单元调度出所述第二目标队列的时刻;
    在将所述第三原标记单元输入所述第二原队列的情况下,将第二计数器对中的第二原计数器的值加1;
    在将所述第三目标标记输入所述第二目标队列的情况下,将所述第二计数器对中的第二目标计数器的值加1,其中所述第二计数器对对应于所述第二队列对,所述第二原计数器对应于所述第二原队列,所述第二目标计数器对应于所述第二目标队列;
    在所述第三原标记单元调度出所述第二原队列的情况下,将所述第二原计数器的值减1;
    在所述第三目标标记单元调度出所述第二目标队列的情况下,将所述第二目标计数器的值减1;
    在将所述第三目标标记单元调度出所述第二目标队列之前,所述方法还包括:确定所述第二原计数器的值小于所述第二目标计数器的值。
  9. 一种交换设备,其特征在于,所述交互设备包括:
    输入单元,用于接收来自第一数据流的N 1个数据单元,其中所述数据单元为数据包或数据包的描述符,N 1为大于或等于1的正整数;
    所述输入单元,还用于将所述N 1个数据单元输入第一原队列;
    处理单元,用于确定所述第一数据流从所述第一原队列切换为第一目标队列,其中所述第一原队列与所述第一目标队列属于第一队列对;
    所述处理单元,还用于生成第一原标记单元和第一目标标记单元,将所述第一原标记单元输入所述第一原队列并将所述第一目标标记单元输入所述第一目标队列;
    所述输入单元,还用于接收来自所述第一数据流的M 1个数据单元,其中M 1为大于或等于1的正整数;
    所述输入单元,还用于将所述M 1个数据单元输入所述第一目标队列;
    所述处理单元,还用于根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列并将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列,其中所述第一原标记单元调度出所述第一原队列的时刻早于所述第一目标调度单元调度出所述第一目标队列的时刻。
  10. 如权利要求9所述的交换设备,其特征在于,所述处理单元,具体用于根据所述第一原标记单元和所述第一目标标记单元,将所述N 1个数据单元和所述第一原标记单元调度出所述第一原队列,并在所述第一原标记单元调度出所述第一原队列后,将所述第一目标标记单元和所述M 1个数据单元调度出所述第一目标队列
  11. 如权利要求10所述的交换设备,其特征在于,所述处理单元,具体用于:
    确定第一待调度单元是否为所述第一原标记单元,其中所述第一待调度单元为所述原队列中第一个待调度的单元;
    确定第二待调度单元是否为所述第一目标标记单元,其中所述第二待调度单元为所述目标队列中第一个待调度的单元;
    在所述第一待调度单元不为所述第一原标记单元且所述第二待调度单元不为所述第一目标标记单元的情况下,根据预设规则调度所述第一待调度单元和所述第二待调度单元,并继续确定第三待调度单元是否为所述第一原标记单元,确定第四待调度单元是否为所述第一目标标记单元,其中所述第三待调度单元为在将所述第一待调度单元调度出所述第一原队列后所述第一原队列中的第一个待调度的单元,所述第四待调度单元为在将所述第二待调度单元调度出所述第一目标队列后所述第一目标队列中的第一个待调度的单元;
    在所述第一待调度单元不为所述第一原标记单元且所述第二待调度单元为所述第一目标标记单元的情况下,将所述第一待调度单元调度出所述原队列,并继续确定所述第三待调度单元是否为所述第一原标记单元;
    在所述第一待调度单元为所述第一原标记单元且所述第二待调度单元为所述第一目标标记单元的情况下,将所述第一原标记单元调度出所述第一原队列并在所述第一原标记单元调度出所述第一原队列后将所述第一目标标记单元调度出所述第一目标队列。
  12. 如权利要求10或11所述的交换设备,其特征在于,所述处理单元,还用于在将所述第一原标记单元输入所述第一原队列的情况下,将第一计数器对中的第一原计数器的值加1;
    在将所述第一目标标记输入所述第一目标队列的情况下,将所述第一计数器对中的第一目标计数器的值加1,其中所述第一计数器对对应于所述第一队列对,所述第一原计数器对应于所述第一原队列,所述第一目标计数器对应于所述第一目标队列;
    在所述第一原标记单元调度出所述第一原队列的情况下,将所述第一原计数器的值减1;
    在所述第一目标标记单元调度出所述第一目标队列的情况下,将所述第一目标计数器的值减1。
  13. 如权利要求12所述的交换设备,其特征在于,所述处理单元,还用于在将所述第一目标标记单元调度出所述第一目标队列之前,确定所述第一原计数器的值小于所述第一目标计数器的值。
  14. 如权利要求12或13所述的交换设备,其特征在于,所述原标记单元携带第一编号信息,所述目标标记单元携带所述第一编号信息和第二编号信息,其中所述第一编号信息为所述原计数器的编号,所述第二编号信息为所述目标计数器的编号;
    所述处理单元,还用于根据所述第一编号信息和所述第二编号信息确定所述原计数器和所述目标计数器。
  15. 如权利要求13或14所述的交换设备,其特征在于,所述输入单元,还用于接收来自第二数据流的N 2个数据单元,其中N 2为大于或等于1的正整数;
    所述输入单元,还用于将所述N 2个数据单元输入所述第一原队列;
    所述处理单元,还用于确定所述第二数据流从所述第一原队列切换为所述第一目标队列;
    所述处理单元,还用于生成第二原标记单元和第二目标标记单元,并将所述第二原标记单元输入所述第一原队列并将所述第二目标标记单元输入所述第一目标队列;
    所述输入单元,还用于接收来自所述第二数据流的M 2个数据单元,其中M 1为大于或等于1的正整数;
    所述输入单元,还用于将所述M 2个数据单元输入所述第一目标队列;
    所述处理单元,还用于根据所述第二原标记单元和所述第二目标标记单元,将所述N 2个数据单元和所述第二原标记单元调度出所述第一原队列并将所述第二目标标记单元和所述M 2个数据单元调度出所述第一目标队列,其中所述第二原标记单元调度出所述第一原队列的时刻早于所述第二目标调度单元调度出所述第一目标队列的时刻;
    所述处理单元,还用于在将所述第二原标记单元输入所述第一原队列的情况下,将所述第一原计数器的值加1;
    所述处理单元,还用于在将所述第二目标标记输入所述第一目标队列的情况下,将所述第一目标计数器的值加1;
    所述处理单元,还用于在所述第二原标记单元调度出所述第一原队列的情况下,将所述第一原计数器的值减1;
    所述处理单元,还用于在所述第二目标标记单元调度出所述第一目标队列的情况下,将所述第一目标计数器的值减1;
    所述处理单元,还用于在将所述第二目标标记单元调度出所述第一目标队列之前,确定所述第一原计数器的值小于所述第一目标计数器的值。
  16. 如权利要求13至15中任一项所述的交换设备,其特征在于,所述输入单元,还用于接收来自第三数据流的N 3个数据单元,其中N 3为大于或等于1的正整数;
    所述输入单元,还用于将所述N 3个数据单元输入第二原队列;
    所述处理单元,还用于确定所述第三数据流从所述第二原队列切换为第二目标队列,其中所述第二原队列与所述第二目标队列属于第二队列对,所述第二原队列与所述第一原队列不同和/或所述第二目标队列与所述第一目标队列不同;
    所述处理单元,还用于生成第三原标记单元和第三目标标记单元,并将所述第三原标记单元输入所述第二原队列并将所述第三目标标记单元输入所述第二目标队列;
    所述输入单元,还用于接收来自所述第三数据流的M 3个数据单元,其中M 1为大于或等于1的正整数;
    所述输入单元,还用于将所述M 3个数据单元输入所述第二目标队列;
    所述处理单元,还用于根据所述第三原标记单元和所述第三目标标记单元,将所述N 3个数据单元和所述第三原标记单元调度出所述第二原队列并将所述第三目标标记单元和所述M 3个数据单元调度出所述第二目标队列,其中所述第三原标记单元调度出所述第二原队列的时刻早于所述第二目标调度单元调度出所述第二目标队列的时刻;
    所述处理单元,还用于在将所述第三原标记单元输入所述第二原队列的情况下,将第二计数器对中的第二原计数器的值加1;
    所述处理单元,还用于在将所述第三目标标记输入所述第二目标队列的情况下,将所述第二计数器对中的第二目标计数器的值加1,其中所述第二计数器对对应于所述第二队列对,所述第二原计数器对应于所述第二原队列,所述第二目标计数器对应于所述第二目标队列;
    所述处理单元,还用于在所述第三原标记单元调度出所述第二原队列的情况下,将所述第二原计数器的值减1;
    所述处理单元,还用于在所述第三目标标记单元调度出所述第二目标队列的情况下,将所述第二目标计数器的值减1;
    所述处理单元,还用于在将所述第三目标标记单元调度出所述第二目标队列之前,确定所述第二原计数器的值小于所述第二目标计数器的值。
  17. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行权利要求1至权利要求9中任一项所述的方法。
PCT/CN2018/115887 2017-11-16 2018-11-16 调度数据的方法和交换设备 WO2019096246A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP18879244.4A EP3700149B1 (en) 2017-11-16 2018-11-16 Data scheduling method and switching device
US16/875,215 US11218417B2 (en) 2017-11-16 2020-05-15 Data scheduling method and switching device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711137256.7 2017-11-16
CN201711137256.7A CN109802896B (zh) 2017-11-16 2017-11-16 调度数据的方法和交换设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/875,215 Continuation US11218417B2 (en) 2017-11-16 2020-05-15 Data scheduling method and switching device

Publications (1)

Publication Number Publication Date
WO2019096246A1 true WO2019096246A1 (zh) 2019-05-23

Family

ID=66540059

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115887 WO2019096246A1 (zh) 2017-11-16 2018-11-16 调度数据的方法和交换设备

Country Status (4)

Country Link
US (1) US11218417B2 (zh)
EP (1) EP3700149B1 (zh)
CN (1) CN109802896B (zh)
WO (1) WO2019096246A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090213732A1 (en) * 2008-02-27 2009-08-27 Bryan Veal Preserving packet order when migrating network flows between cores
CN103546392A (zh) * 2012-07-12 2014-01-29 中兴通讯股份有限公司 队列单周期调度方法和装置
US20140233383A1 (en) * 2013-02-15 2014-08-21 Broadcom Corporation Management of Traffic Buffering in Internal and External Memories in a Passive Optical Network

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5226041A (en) * 1991-02-21 1993-07-06 International Business Machines Corporation Method for efficiently simulating the dynamic behavior of a data communications network
US6799200B1 (en) * 2000-07-18 2004-09-28 International Business Machines Corporaiton Mechanisms for efficient message passing with copy avoidance in a distributed system
US20020089927A1 (en) * 2001-01-11 2002-07-11 Fischer Michael A. System and method for synchronizing data trasnmission across a variable delay interface
US7567508B2 (en) * 2005-05-23 2009-07-28 Cisco Technology, Inc. Method and system for providing delay bound and priortized packet dropping
EP2328074A1 (en) * 2009-11-27 2011-06-01 STMicroelectronics S.r.l. Queue management
CN102088412B (zh) * 2011-03-02 2014-09-03 华为技术有限公司 交换单元芯片、路由器及信元信息的发送方法
WO2012109880A1 (zh) * 2011-08-04 2012-08-23 华为技术有限公司 队列调度方法和装置
CN106921586B (zh) * 2015-12-25 2020-02-14 华为技术有限公司 一种数据流整形方法、数据调度方法以及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090213732A1 (en) * 2008-02-27 2009-08-27 Bryan Veal Preserving packet order when migrating network flows between cores
CN103546392A (zh) * 2012-07-12 2014-01-29 中兴通讯股份有限公司 队列单周期调度方法和装置
US20140233383A1 (en) * 2013-02-15 2014-08-21 Broadcom Corporation Management of Traffic Buffering in Internal and External Memories in a Passive Optical Network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3700149A4

Also Published As

Publication number Publication date
EP3700149A4 (en) 2020-11-11
US11218417B2 (en) 2022-01-04
CN109802896B (zh) 2022-04-22
EP3700149A1 (en) 2020-08-26
US20200280523A1 (en) 2020-09-03
EP3700149B1 (en) 2022-08-24
CN109802896A (zh) 2019-05-24

Similar Documents

Publication Publication Date Title
US11258685B1 (en) Packet generation-based bidirectional forwarding detection
US10326713B2 (en) Data enqueuing method, data dequeuing method, and queue management circuit
US7836195B2 (en) Preserving packet order when migrating network flows between cores
EP3028417B1 (en) Data packet processing
US9639403B2 (en) Receive-side scaling in a computer system using sub-queues assigned to processing cores
CN111130946B (zh) 一种深度报文识别的加速方法、装置和存储介质
EP3238386B1 (en) Apparatus and method for routing data in a switch
US9336006B2 (en) High-performance parallel traffic management for multi-core platforms
US9916178B2 (en) Technologies for integrated thread scheduling
US11134021B2 (en) Techniques for processor queue management
US8930604B2 (en) Reliable notification of interrupts in a network processor by prioritization and policing of interrupts
WO2019096246A1 (zh) 调度数据的方法和交换设备
US20170295113A1 (en) Longest queue identification
WO2017016300A1 (zh) 令牌申请处理方法、装置和计算机存储介质
US8902899B2 (en) Input buffered switching device including bypass logic
US7881197B2 (en) Interface scheduling and traffic-shaping
US10270701B2 (en) Management node, terminal, communication system, communication method, and program storage medium
US20240137333A1 (en) Method for performing switching function and switching device
US9319327B2 (en) Packet transmission method, packet transmission apparatus, and storage medium
EP4068703B1 (en) Method and device for performing software-based switching functions in a local area network
EP4203432A1 (en) Multi-stream scheduling for time sensitive networking
US20160173401A1 (en) Scheduling packets with multiple destinations in a virtual output queue network switch
CN117278491A (zh) 一种数据报文处理方法、装置、存储介质及电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18879244

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2018879244

Country of ref document: EP

Effective date: 20200518