WO2023108479A1 - 确定性流传输方法及装置 - Google Patents

确定性流传输方法及装置 Download PDF

Info

Publication number
WO2023108479A1
WO2023108479A1 PCT/CN2021/138338 CN2021138338W WO2023108479A1 WO 2023108479 A1 WO2023108479 A1 WO 2023108479A1 CN 2021138338 W CN2021138338 W CN 2021138338W WO 2023108479 A1 WO2023108479 A1 WO 2023108479A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
current
cft
queue
dbq
Prior art date
Legal status (The legal status 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 status listed.)
Ceased
Application number
PCT/CN2021/138338
Other languages
English (en)
French (fr)
Inventor
郭道荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
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 New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to PCT/CN2021/138338 priority Critical patent/WO2023108479A1/zh
Priority to EP21967616.0A priority patent/EP4336796A4/en
Priority to JP2023574657A priority patent/JP7752189B2/ja
Priority to US18/569,822 priority patent/US20240275728A1/en
Priority to CN202180003976.2A priority patent/CN116615899A/zh
Publication of WO2023108479A1 publication Critical patent/WO2023108479A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • 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/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/34Source routing
    • 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/621Individual queue per connection or flow, e.g. per VC

Definitions

  • This application relates to network communication technology, in particular to a method and device for deterministic traffic (DT: Deterministic Traffic) transmission.
  • DT Deterministic Traffic
  • Deterministic Network can provide deterministic service functions for carried services in a network domain. These deterministic business functions may include delay, packet loss rate, etc. Taking the deterministic network based on the local area network, that is, the time-sensitive network (TSN: Timesensitive Network) as an example, in TSN, the transmission delay on the entire forwarding path at the forwarding level is ensured by using Cyclic Queuing and Forwarding (CQF: Cyclic Queuing and Forwarding) Ok wait.
  • TSN Timesensitive Network
  • a service flow with deterministic service functions such as delay and packet loss rate transmitted in a deterministic network is called a deterministic flow.
  • deterministic flow For other service flows other than deterministic flows, combined with existing forwarding devices such as software forwarding devices or hardware forwarding devices based on switching chips or NPs, etc., according to the best-effort forwarding method, other service flows that are different from deterministic flows can be forwarded. Traffic flows are called best effort flows.
  • the present application provides a deterministic stream transmission method, system and device, so as to realize the deterministic stream transmission of CSQF queued and forwarded at a specified period based on segment routing SR.
  • An embodiment of the present application provides a deterministic stream DT transmission method, which is applied to a network device, and the method includes:
  • the deterministic flow cache queue DBQ distributes the packets belonging to the best-effort flow to the corresponding best-effort flow cache queue BTQ; the packets in the packet receiving queue refer to the packets received through the local interface of the network device Messages from outside;
  • the device Put the message in the DTQ bound to the CFT into the corresponding specified periodic queue CSQ through the awakened periodic forwarding thread CFT on the device, and select the message from the sending queue SQ through the CFT and send it by using The message is forwarded on the outgoing interface of the forwarded message; the SQ is the CSQ currently pointed to by the queue sending pointer SQP corresponding to the CFT.
  • the embodiment of the present application also provides an electronic device.
  • the electronic device includes: a processor and a machine-readable storage medium;
  • the machine-readable storage medium stores machine-executable instructions executable by the processor
  • the processor is used to execute machine-executable instructions to implement the steps of the methods disclosed above.
  • this embodiment implements the forwarding of deterministic flows on the basis of existing best-effort flow forwarding
  • FIG. 1 is a schematic diagram of a best-effort forwarding structure
  • Fig. 2 is the flow chart of the method provided by the embodiment of the present application.
  • FIG. 3 is a structural schematic diagram of determined flow forwarding and best-effort flow forwarding provided by the embodiment of the present application;
  • FIG. 4 is a flowchart for implementing a distribution thread provided by an embodiment of the present application.
  • Fig. 5 is the DFT implementation flowchart provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of the fast forwarding table, OutIfInfo and SRLists association provided by the embodiment of the present application;
  • Fig. 7 is the CFT implementation flowchart provided by the embodiment of the present application.
  • FIG. 8 is a schematic diagram of the relationship between CSQP and CSQ provided by the embodiment of the present application.
  • FIG. 9 is a schematic structural diagram among SQ, RQ, and TQ provided by the embodiment of the present application.
  • FIG. 10 is a schematic diagram of the interaction between threads provided in the embodiment of the present application.
  • Fig. 11 is a device structure diagram provided by the embodiment of the present application.
  • FIG. 12 is a structural diagram of an electronic device provided by an embodiment of the present application.
  • the hardware controller such as the controller on the interface board
  • the hardware controller receives the message
  • it will first store the message in the corresponding message receiving queue (RcvQueue : Receiving Queue).
  • the calculation result can be obtained by performing a hash (Hash) operation on the message quintuple, and the queue number can be searched in the message receiving queue in the memory
  • Hash hash
  • the queue number can be searched in the message receiving queue in the memory
  • store the message in the found message receiving queue store the message in the found message receiving queue. It should be noted that this is just an example to describe how to store the message into the corresponding message receiving queue in the memory according to the message characteristic parameters of the message, and it is not used for limitation.
  • the hardware controller after the above-mentioned hardware controller receives the message, it will also trigger the interrupt controller to generate an interrupt, so as to call the interrupt handler in the driver software (such as CPU, etc.) to wake up at least one best-effort And for forwarding thread (BFT: Best-effort Forwarding Thread).
  • the interrupt handler in the driver software (such as CPU, etc.) to wake up at least one best-effort And for forwarding thread (BFT: Best-effort Forwarding Thread).
  • BFT Best-effort Forwarding Thread
  • the awakened BFT takes out the message from the bound message receiving queue, converts the taken out message into a message of a specified structure and sends it to the platform software (also called the platform interface).
  • platform software also called the platform interface
  • the platform software queries the FIB table to determine the outgoing interface used to forward the message, and calls the transmission interface (Transmod) of the driver software to send the message to the hardware queue corresponding to the outgoing interface for transmission.
  • Transmod transmission interface
  • a high-priority hardware queue is set, and packets therein are sent preferentially.
  • the storage resource occupied by the sent message can be further released by calling the release resource software (Free Buffer Pool).
  • an embodiment of the present application provides a deterministic stream transmission method, which superimposes deterministic stream forwarding on the basis of best-effort stream forwarding, ensures compatibility between best-effort stream forwarding and deterministic stream forwarding, and ensures Deterministic flow forwarding is not affected by best effort flow forwarding.
  • FIG. 2 is a flowchart of a deterministic stream transmission method provided in an embodiment of the present application.
  • This process applies to network devices.
  • the embodiment of the present application does not specifically limit the specific structural form of the network device.
  • it can be a low-end router, etc., or it can be a high-end router with high performance requirements and supports more CPU cores.
  • This embodiment does not specifically limit , so that the embodiment of the present application has wide applicability and expansibility.
  • the embodiment of this application superimposes deterministic flow forwarding on the basis of best-effort flow forwarding.
  • the following is the superposition of deterministic flow forwarding on the basis of best-effort flow forwarding.
  • the following transformations have been newly added for sex flow forwarding:
  • Deterministic streams are very sensitive to delay and jitter, and are easily affected by platform business processing such as best-effort stream forwarding.
  • the embodiment of the present application adds a new distribution thread to the above-mentioned network devices.
  • the number of distribution threads is set according to the number of message receiving queues, and one distribution thread is bound to at least one message receiving queue.
  • the distribution thread is used to distribute the messages in the bound message receiving queue, so as to distribute the messages belonging to the deterministic flow in the message receiving queue to the corresponding deterministic flow cache queue (DBQ: Deterministic Traffic Queue), which distributes the packets belonging to the best-effort flow to the corresponding best-effort flow buffer queue (BTQ: Best-Effort Traffic Queue).
  • DBQ Deterministic Traffic Queue
  • BTQ Best-Effort Traffic Queue
  • DBQ there is a one-to-one correspondence between DBQ and message receiving queues.
  • the messages belonging to the deterministic flow in the message receiving queue 1 are distributed to DBQ1
  • the messages belonging to the deterministic flow in the message receiving queue 2 are distributed to DBQ2.
  • analogy. DBQ is used to cache the packets belonging to the determined flow distributed by the distribution thread.
  • the work of dispatching messages by the distribution thread is decoupled from the work of the platform to process the messages belonging to the deterministic flow, so that the processing of the distribution thread is single, so that it is efficient and non-blocking.
  • the processing of the messages belonging to the deterministic flow is independent.
  • BTQ packets belonging to best-effort flow in packet receiving queue 1 are distributed to BTQ1
  • packets belonging to best-effort flow in packet receiving queue 2 are distributed to BTQ2, and so on....
  • BTQ is used to cache the best-effort packets distributed by the distribution thread.
  • the work of dispatching messages by the distribution thread is decoupled from the work of the platform processing messages belonging to the best-effort flow, so as to avoid the blockage of the distribution thread by the platform's uncertain processing work.
  • the process of distributing packets by the distribution thread is a non-blocking process. Even if there may be platform business processing uncertainty, the distribution thread can still ensure that packets such as those belonging to deterministic flows are distributed in a timely manner.
  • a deterministic stream forwarding core module can be added to the driver software of the network device.
  • the deterministic flow forwarding core module at least includes: a deterministic flow forwarding thread (DFT: Deterministic Forwarding Thread), and a periodic forwarding thread (CFT: Cycle Forwarding Thread).
  • the number of DFTs is set according to the number of DBQs and the deterministic flow load.
  • a DFT binds at least one DBQ. DFT is used to put the packets in the bound DBQ into the corresponding deterministic traffic queue (DTQ: Deterministic Traffic Queue).
  • the number of CFTs is set according to the number of DTQs and deterministic flow load.
  • a CFT binds at least one DTQ.
  • CFT is used to put the messages in the bound DTQ into the corresponding specified cycle queue (CSQ: Cycle Specified Queue).
  • CSQ Cycle Specified Queue
  • the CFT is also bound to at least one CSQ of at least one interface, and is used to take out a message from a specified CSQ within a specified period, and forward the message through the outgoing interface used to forward the message .
  • Transmitting Module Transform the Transmitting Module (TransMod: Transmitting Module) so that the Transmitting Module can provide deterministic stream forwarding (such as adding hardware adaptation for deterministic stream forwarding, etc.).
  • deterministic stream forwarding such as adding hardware adaptation for deterministic stream forwarding, etc.
  • packets belonging to deterministic flows can be assigned the highest priority on the outbound interface, so as to ensure that packets belonging to deterministic flows are forwarded preferentially, and at the same time, the Best-effort traffic forwarding rate limiting.
  • Fig. 3 shows an example of a modified frame structure based on the frame shown in Fig. 1 .
  • the process may include the following steps:
  • Step 201 Distribute the packets in the message receiving queue bound to the distribution thread through the awakened distribution thread on the local device, so as to distribute the messages belonging to the deterministic flow in the message receiving queue to the corresponding
  • the DBQs that belong to the best-effort flow are distributed to the corresponding BTQs.
  • the message receiving queue here is as described above, and it stores the external messages received by the network device through the local interface.
  • the distribution thread distributes the messages in the bound message receiving queue
  • the distribution thread may be awakened through an interrupt, or may be awakened through other methods such as polling, which is not specifically limited in this embodiment.
  • Step 202 put the message in the DBQ bound to the DFT into the corresponding DTQ through the awakened DFT on the device.
  • the DFT can be woken up by the dispatch thread at an appropriate time, and an example will be described below.
  • the DFT may also be awakened in other ways, which is not specifically limited in this embodiment.
  • Step 203 put the message in the DTQ bound to the CFT into the corresponding designated cycle queue (CSQ: Cyclic Specific Queue) through the awakened periodic forwarding thread CFT on the device, and send the message from the CFT through the CFT
  • CSQ Cyclic Specific Queue
  • the message is selected from the queue SQ and forwarded through the outbound interface used to forward the message.
  • SQ is the CSQ currently pointed to by the sending pointer SQP of the queue corresponding to the CFT.
  • the CFT can be woken up by the DFT at an appropriate time, and an example will be described below.
  • the CFT can also be woken up in other ways, for example, the CFT is woken up by default directly after being newly created, or if the CFT detects a specified event after being newly created, it is also woken up by default, etc., which are not specifically limited in this embodiment.
  • the specified event here refers to the event that there is a message in the CSQ that needs to be forwarded in time. The event will be described with an example below, and will not be repeated here.
  • each interface corresponds to multiple CSQs, such as 3 CSQs.
  • each CSQ includes at least:
  • CSQD Cyclic Specific Queue Descriptors
  • the queue element in the BDQ describes the information of a data block, which may at least include: the information of the memory block where the data is located, the starting position of the data, the length of the data, etc., which are not specifically limited in this embodiment.
  • each specified periodic queue descriptor may at least include:
  • Queue head used to point to the corresponding BDQ
  • Head (Head), pointing to the current head position of the team.
  • CSQ When CSQ is empty, Head is 0, indicating that the next data packet to be enqueued occupies the 0th position, and Head increases by 1 after each enqueue of data;
  • QLen queue length
  • MaxBytes the byte capacity of the current queue.
  • CSQP Cyclic Specific Queue Pointers
  • SQP Sending Queue Pointer (Sending Queue Pointer), the CSQ pointed to by SQP, indicating when
  • the CSQ being sent in the previous cycle (the CSQ is also called the sending queue SQ).
  • RQP Receiving Queue Pointer (Receiving Queue Pointer), the CSQ pointed to by RQP indicates the CSQ being received in the current cycle (the CSQ is also called the receiving queue RQ).
  • TQP Tolerating Queue Pointer (Tolerating Queue Pointer), the CSQ pointed to by TQP, indicates the CSQ to be received in the current cycle after the RQ is full (also called the tolerating queue TQ at this time).
  • FIG. 8 shows a schematic diagram of the relationship between CSQP and CSQ by way of example.
  • this embodiment realizes the forwarding of deterministic flows added on the basis of existing best-effort flow forwarding
  • FIG. 4 is a flowchart for implementing a dispatch thread provided by an embodiment of the present application.
  • the distribution thread is set with a corresponding thread polling flag (marked as bPoll_1), initially, bPoll_1 is set to FALSE.
  • bPoll_1 is also FALSE at this time.
  • the dispatch thread can be woken up by interrupt or other methods.
  • the awakened distribution thread can perform the following steps:
  • Step 401 the distribution thread traverses the bound message receiving queues in order, determines the currently traversed message receiving queue as the current queue, and inquires whether there are messages in the current queue, if yes, executes step 402, if not, executes Step 407.
  • Step 402 set bPoll_1 to TRUE, and traverse the current queue, and determine the traversed message as the current message, when it is recognized that the current message belongs to the deterministic flow, then perform step 403, when it is recognized that the current message belongs to the best effort If it is a stream, go to step 405.
  • This step 402 is executed when it is found that there are messages in the current queue.
  • set bPoll_1 to TRUE, which means that the distribution thread is currently entering the polling process.
  • the shutdown specified function is used to indicate that the dispatch thread is prevented from going to sleep.
  • Step 403 put the current message into the DBQ corresponding to the current queue. Then step 404 is executed.
  • a packet belonging to a deterministic flow will carry a deterministic flow attribute (DetProperty: Deterministic Property).
  • the deterministic flow attributes are not fixed, and the current specification does not provide specific specifications, but are set according to actual needs, such as setting the values of fields such as DSCP to represent the deterministic flow attributes.
  • This embodiment does not specifically limit the deterministic flow attribute.
  • the deterministic flow attribute is set, it is applied to step 403 to identify whether the current message carries the deterministic flow attribute. If so, it is identified that the current message belongs to the deterministic flow, and the current message is put into The DBQ corresponding to the current queue. Finally, the packet belonging to the deterministic flow is distributed to DBQ.
  • DBQs correspond to message receiving queues one by one, for example, the message in the message receiving queue numbered 1 is put into the DBQ numbered 1, and the numbered message is placed into the DBQ numbered 2. The messages in the message receiving queue are put into the DBQ numbered 2, and so on. Finally, based on the above-mentioned corresponding relationship between the DBQ and the message receiving queue, it is realized that the identified current message belonging to the deterministic flow is put into the DBQ corresponding to the current queue.
  • Step 404 if the DFT wake-up flag set by the DFT bound to the above-mentioned DBQ is False, then the DFT wake-up flag is set to True, and the DFT wake-up flag is True to wake up the DFT, and then check whether there is still a DFT in the current queue. For the untraversed message, if yes, continue to traverse the untraversed message and return to the step of determining the traversed message as the current message in step 402, if not, execute step 407.
  • the distribution thread will set a corresponding DFT wake-up flag for each DFT. Initially, the DFT wake-up flag corresponding to each DFT is set to FALSE.
  • the corresponding DFT can be woken up in time, so that the awakened DFT can put the message in the bound DBQ into the corresponding DTQ in time.
  • the following DFT process please refer to the following DFT process, which will not be repeated here.
  • step 404 can directly traverse the untraversed message when there are still untraversed messages in the current queue. message, return to the step of determining the traversed message as the current message in step 402, and if there is no untraversed message in the current queue, then step 407 is executed.
  • Step 405 put the current message into the BTQ corresponding to the current queue. Then step 406 is executed.
  • the BTQ corresponds to the message receiving queue one by one, for example, the message in the message receiving queue numbered 1 is put into the BTQ numbered 1, and the BTQ numbered 2 The packets in the packet receiving queue are put into the BTQ numbered 2, and so on.
  • the identified current message belonging to the best-effort flow is put into the BTQ corresponding to the current queue.
  • Step 406 if the BFT wake-up flag set by the BFT bound to the above-mentioned BTQ is False, then set the BFT wake-up flag to True, wake up the BFT whose BFT wake-up flag is True, and check whether there are still unused BFTs in the current queue. For the traversed message, if yes, traverse the untraversed message, and return to the step of determining the traversed message as the current message in step 401, if not, execute step 407.
  • step 406 the BFT bound to the BTQ can be awakened in time, so that the awakened BFT forwards the message in the BTQ in time.
  • Step 407 if there is no message in the current queue or there is no message that has not been traversed in the current queue, then it is detected that there is still a message receiving queue that has not been traversed in all message receiving queues bound to the distribution thread, if yes, Continue traversing other message receiving queues that are bound to the distribution thread and have not been traversed, and return to the step of determining the currently traversed message receiving queue as the current queue in step 401 , otherwise, execute step 408 .
  • Step 408 for the DFT whose DFT wake-up flag is TRUE, wake up the DFT, and set the DFT wake-up flag of the DFT to FALSE; and, for the BFT whose BFT wake-up flag is TRUE, wake up the BFT, and wake up the BFT of the BFT flag is set to FALSE. Then step 409 is executed.
  • step 408 The reason why step 408 is executed here is to wake up the DFT and BFT that have been woken up before but go to sleep while the distribution thread traverses the message receiving queue, so as to ensure that both the deterministic flow and the best-effort flow are forwarded in time.
  • step 408 directly sets the DFT wake-up flag of the DFT to FALSE for the DFT whose DFT wake-up flag is TRUE.
  • the principle of BFT with the BFT wake-up flag set to TRUE is similar and will not be repeated here.
  • Step 409 if bPoll_1 is TRUE, set bPoll_1 to False, and return to the above step 401, if bPoll_1 is False, enable the above specified function, and the specified function is used to instruct the distribution thread to wait to be woken up.
  • the implementation process of the distribution process is described through the process shown in FIG. 4 .
  • FIG. 5 is a flow chart of DFT implementation provided by the embodiment of the present application.
  • the DFT can be awakened by the distribution thread (see the process shown in FIG. 4 above for details).
  • the DFT may also be awakened in other ways, which are not specifically limited here.
  • the awakened DFT is set with a corresponding thread polling flag (denoted as DFT polling flag), wherein, when the DFT is awakened, the DFT polling flag is FALSE at this time.
  • DFT polling flag denoted thread polling flag
  • the awakened DFT can perform the following steps:
  • Step 501 DFT traverses the bound DBQs in order, determines the currently traversed DBQ as the current DBQ, and inquires whether the current DBQ has a message, if yes, executes step 502, if not, executes step 505.
  • Step 502 setting the DFT polling flag as TRUE, and traversing the current DBQ, determining the traversed message as the current DBQ message, calling the set message repetition elimination and sorting (PREOF: Packet Replication, Elimination, and Ordering Functions ) function recognizes that the current DBQ message is not a repeated message and generates a message output chain.
  • PREOF Packet Replication, Elimination, and Ordering Functions
  • This step 502 is executed when it is found that the current DBQ has messages.
  • set the DFT polling flag to TRUE, which means that DFT is currently in the polling process.
  • the off designation function is used to indicate that the DFT is prevented from entering the sleep state.
  • DFT is set with a PREOF function. Based on the PREOF function, it can be identified whether the current DBQ message is a repeated message. Among them, the PREOF function can be used to identify whether the current DBQ message and the message processed by calling the PREOF function are repeated messages. When it is recognized that the current DBQ message is a repeated message, the current DBQ message is discarded, and When there are untraversed messages in the current DBQ, continue to traverse the untraversed messages, and return to the step of determining the traversed messages as the current DBQ messages in step 502 .
  • the current DBQ message is a repeated message based on the PREOF function, for example, to identify whether the message sequence number of the current DBQ message is less than the recorded maximum sequence corresponding to the service flow to which the current DBQ message belongs number, if yes, identify the current DBQ message as a repeated message, etc., which are not specifically limited in this embodiment.
  • the PREOF function may be called to generate a message output chain.
  • the PREOF function may be called to generate a message output chain.
  • each message in the message output chain can be packaged into a message and put into the DTQ corresponding to the outgoing interface used to forward the message. For details, refer to step 503 .
  • Step 503 traversing the messages in the message output chain, recording the traversed messages as target messages, encapsulating the target messages, and putting the encapsulated target messages into the output box for forwarding the target messages.
  • the interface corresponds to DTQ, check whether the target message is the last untraversed message in the message output chain, if yes, execute step 504, if not, traverse the untraversed message in the message output chain, and return the The traversed message is recorded as the step of the target message.
  • a corresponding DTQ is set for each outgoing interface.
  • the DTQ corresponding to outbound interface 1 is denoted as DTQ1
  • the DTQ corresponding to outbound interface 2 is denoted as DTQ2, and so on.
  • the target message is encapsulated and the encapsulated target message is put into the DTQ corresponding to the outbound interface for forwarding the target message.
  • the outbound interface for forwarding the target message is outbound interface 1, then the encapsulated target message is put into the DTQ corresponding to the outbound interface for forwarding the target message, that is, DTQ1.
  • Step 504 if the CFT wake-up flag set by the CFT bound to the above-mentioned DTQ is False, then the CFT wake-up flag is set to True, and the CFT wake-up flag that wakes up is True, and checks whether there is still an unavailable For the traversed message, if yes, continue to traverse the untraversed message and return to the step of determining the traversed message as the current DBQ message in step 502, if not, execute step 505.
  • the DFT will set a corresponding CFT wake-up flag for each CFT. Initially, the CFT wake-up flag corresponding to each CFT is set to FALSE.
  • step 504 the CFT bound to the above-mentioned DTQ can be woken up in time, so that the awakened CFT can put the message in the bound DTQ into the corresponding CSQ queue in time, and select the message from the SQ and pass the output of the message.
  • the interface is forwarded. For details, see the process shown in Figure 7 below.
  • step 504 when there are still untraversed messages in the current DBQ, continue traversing the untraversed messages and Return to the step of determining the traversed packet as the current DBQ packet in step 502, and execute step 505 when there is no untraversed packet in the current DBQ.
  • Step 505 if there is no message in the current DBQ or there is no untraversed message in the current DBQ, then check whether there are untraversed DBQs in all DBQs bound to the DFT, if yes, continue to traverse the untraversed and return to the step of determining the currently traversed DBQ as the current DBQ in step 501; otherwise, execute step 506.
  • Step 506 wake up the CFT whose CFT wakeup flag is TRUE, and set the CFT wakeup flag of the CFT to FALSE. Then step 507 is executed.
  • step 506 is performed here is to wake up the CFT that has been woken up before but goes to sleep during the DFT traversal of the DBQ, so as to ensure the reliability of deterministic flow forwarding.
  • Step 507 if the CFT polling flag is TRUE, set the CFT polling flag to False, and return to the above step 501, if the CFT polling flag is False, enable the above specified function to instruct DFT to wait to be woken up.
  • an example of calling the PREOF function to generate a message output chain may include:
  • Step a11 identify whether the current DBQ message is an out-of-sequence message, if not, perform step a12, and if yes, perform step a13.
  • identifying whether the current DBQ message is an out-of-sequence message such as identifying the service flow to which the current DBQ message belongs, and finding that the message sequence number of the current DBQ message is greater than the recorded
  • the maximum serial number of the message belonging to the above-mentioned business flow processed by calling the PREOF function then when the message serial number of the current DBQ message is not adjacent to the above-mentioned maximum serial number, it is determined that the current DBQ message is an out-of-sequence message, Otherwise, it is determined that the current DBQ message is not an out-of-sequence message.
  • Step a12 put the current DBQ message into the above message output chain.
  • This step a12 is performed on the premise that it is recognized that the current DBQ message is not an out-of-sequence message. Once it is recognized that the current DBQ message is not an out-of-sequence message, the current DBQ message can be directly put into the above-mentioned message output chain, and at the same time, the above-mentioned maximum sequence number that has been recorded is further updated to the message sequence of the current DBQ message number, so as to judge whether the subsequent DBQ message is an out-of-sequence message.
  • Step a13 determine the business flow to which the current DBQ message belongs, if the current DBQ message meets the condition, the condition means that the current DBQ message and the recorded service flow belong to the business flow and the PREOF function is called within the set time window At least one message processed is successfully sorted, then the current DBQ message, at least one message that has been successfully sorted with the current DBQ message, and the recorded message belonging to the business flow and at the set time Call the PREOF function outside the window to process but have not yet put the message into the message output chain into the message output chain.
  • This step a13 is performed on the premise that the current DBQ message is identified as an out-of-sequence message.
  • identify the service flow to which the current DBQ message belongs the specific service flow information can be carried in the message
  • the sequence number of the message is 8, and the sequence number of a recorded message belonging to the above service flow and processed by calling the PREOF function within the set time window is found to be 7, which means that the recorded message belongs to the above service flow and At least one message processed by calling the PREOF function within the set time window is successfully sorted with the current DBQ message.
  • the above-mentioned setting time window can be set according to actual needs, such as setting the closest 10us to the current time, which is not specifically limited in this embodiment.
  • the current DBQ message is successfully sorted with at least one message that belongs to the above-mentioned service flow that has been recorded and is processed by calling the PREOF function within the set time window
  • the current DBQ message, the recorded and the current At least one message that has been successfully sorted by DBQ messages, and the recorded messages that belong to the above-mentioned business flow and are processed by calling the PREOF function outside the above-mentioned set time window but have not yet been put into the message output chain are put into the message output chain .
  • a message output chain is generated.
  • the recorded message belonging to the above-mentioned service flow can be And call the PREOF function processing outside the above-mentioned set time window but put the message that has not been put into the message output chain into the message output chain. Finally, a message output chain is generated. It should be noted that if the current DBQ message cannot be successfully sorted with at least one recorded message belonging to the above business flow and processed by calling the PREOF function within the set time window, then optionally, the current DBQ message can be further recorded. DBQ message, and call the PREOF function to process the timestamp of the current DBQ message.
  • encapsulating the target message in step 503 may include:
  • Step b11 judging whether the target packet is an edge access packet, if yes, execute step b12, otherwise, execute step b13.
  • Step b12 performing the first type of encapsulation on the target packet.
  • This step b12 is performed on the premise that it is determined that the target packet is an edge access packet.
  • the first type of encapsulation may be performed on the target packet.
  • this embodiment introduces a new concept: fast forwarding table (FastFwdTbl).
  • the fast forwarding table can be obtained by converting routing information in a deterministic network.
  • the DFT can quickly obtain the outgoing interface of the target message by looking up the fast forwarding table, so as to find the relevant DTQ (that is, the DTQ corresponding to the outgoing interface).
  • the deterministic flow is forwarded through the fast forwarding table.
  • the speed of deterministic flow forwarding provides guarantee for deterministic flow forwarding.
  • the fast forwarding table has a smaller capacity and faster lookup, and the overhead of the lookup table is not much different, thereby reducing uncertainty factors.
  • the fast forwarding table can at least include: Destination IP (purpose IP address), Source IP (source IP address), Destination Port (purpose port), Source Port (source port), Proto (protocol) , Differentiated Services Code Point (DSCP: Differentiated Services Code Point), Out Interface (OutIf: Out Interface), Tunnel Index (LIndex).
  • Destination IP purpose IP address
  • Source IP source IP address
  • Destination Port purpose port
  • Source Port source port
  • Proto Proto
  • DSCP Differentiated Services Code Point
  • Out Interface OutIf: Out Interface
  • LIndex Tunnel Index
  • step b12 can be: based on the message characteristic information carried by the target message such as source IP address, destination IP address, etc., find OutIf and LIndex in the fast forwarding table; Find the OutIfInfo corresponding to OutIf in the outbound interface information (OutIfInfo); here, OutIfInfo includes at least the outbound interface information such as MAC address, the pointer of the segment route list (SRLists) based on the outbound interface (here, the segment route SR is used as an example to describe); and then Obtain the corresponding SRList according to the LIndex and SRLists pointers, encapsulate the target message based on the MAD address in SRList and OutIfInfo, and finally realize the first type of encapsulation of the target message.
  • FIG. 6 shows an example of the association relationship between the fast forwarding table and OutIfInfo and SRLists.
  • Step b13 performing second-type encapsulation on the target packet.
  • This step b13 is performed on the premise that it is determined that the target packet is not an edge access packet.
  • it means that the above-mentioned first type of encapsulation has been performed on the target packet.
  • the OutIf can be determined according to the SID in the SRLists of the target message being encapsulated, and the corresponding OutIfInfo (such as at least including the MAC address) can be found through the OutIf query.
  • the target message is encapsulated and replaced, such as replacing the source MAC address in the encapsulated layer 2 header with the MAC address of the outgoing interface in the OutIfInfo, etc., this implementation Examples are not specifically limited.
  • FIG. 7 is a flow chart of CFT implementation provided by the embodiment of the present application.
  • the CFT may be awakened by the DFT as described in step 504 or step 506 in the process shown in FIG. 5 above.
  • the CFT can also be directly awakened to be awakened. For example, when a CFT is newly created on a network device, if it is detected that there is a message in the CSQ bound to the CFT If it is forwarded in time, the CFT can be directly awakened.
  • CFT_Jiffies CFT_prev_Jiffies
  • CFT_Rcv_Jiffies CFT_Rcv_Jiffies
  • CFT_Jiffies may indicate the period currently being processed, and may be recorded as a variable of the current processing period.
  • CFT_prev_Jiffies is used to indicate the historical period and can be recorded as a historical period variable.
  • CFT_Rcv_Jiffies is used to record the current cycle of processing and receiving, which can be recorded as a message receiving cycle variable.
  • the process may include the following steps:
  • Step 701 after the CFT wakes up, reads the current value of CSQF_Jiffies, and updates CFT_Jiffies to the read current value of CSQF_Jiffies. Then step 702 is executed.
  • Step 702 check whether the message sending period is updated, if yes, execute step 703, if not, execute step 704.
  • CFT_Jiffies represents the current processing cycle variable
  • CFT_Prev_Jiffies represents the historical cycle variable. Therefore, based on CFT_Jiffies and CFT_Prev_Jiffies, it can be determined whether the packet sending cycle has been updated.
  • the message sending period has been updated, for example, the period is cycled from the first period to the second period; and when CFT_Jiffies and CFT_Prev_Jiffies are equal, it means that the message sending period has not been updated.
  • Step 703 readjust the CSQP corresponding to the CFT, and update the value of CFT_Prev_Jiffies to the current value of CFT_Jiffies. Then step 704 is executed.
  • the CSQP includes at least: SQP, RQP, and TQP.
  • the number of the CSQ pointed to by the readjusted SQP is modeled according to the total number d of CSQs bound to CFT_Jiffies and CFT. The remainder obtained by the operation is determined. This remainder may be denoted as Rem here.
  • the serial number of the CSQ pointed to by the readjusted RQP is determined based on the result obtained by performing a modulo operation on the upper number d based on the sum of Rem and the specified number of jitter cycles Jitter.
  • the serial number of the CSQ pointed to by the readjusted RQP is obtained by the following formula: (Rem+Jitter) mod d.
  • serial number of the CSQ pointed to by the readjusted TQP can be determined according to the following formula: (d-1+Rem-Jitter) mod d.
  • Step 704 traversing the messages in the SQ, determining the traversed message as the current SQ message, sending the current SQ message to the outgoing interface for forwarding the current SQ message for forwarding, and then checking whether the SQ is still There are untraversed messages, if yes, continue traversing the untraversed messages and return to the step of determining the traversed message as the current SQ message in step 704, if not, execute step 705.
  • Step 705 traversing the DTQ bound to the CFT, determining the traversed DTQ as the current DTQ, querying whether the current DTQ has a message, if yes, performing step 706, and if not, performing step 708.
  • This step 705 is executed when there is no message that has not been traversed in the SQ (that is, the SQ is empty).
  • Step 706 update the value of CFT_Rcv_Jiffies to the current value of CSQF_Jiffies, traverse the current DTQ, determine the traversed message as the current DTQ message, and determine the current DTQ message according to the specified cycle queue (Cycle) parameter carried by the current DTQ message The target CSQ corresponding to the text. Then step 707 is executed.
  • CFT_Rcv_Jiffies Based on the CSQF_Jiffies and CFT_Rcv_Jiffies described above, the value of CFT_Rcv_Jiffies is updated to the current value of CSQF_Jiffies here, the purpose of which is to control the timely execution of CFT threads and reduce scheduling delays.
  • the specified cycle queue (Cycle) parameter carried by the current DTQ message indicates the target CSQ. Based on this, it is easy to determine the target CSQ corresponding to the current DTQ message based on the indication of the Cycle parameter.
  • Step 707 if the target CSQ is between SQ and RQ, then put the current DTQ message into RQ, if the target CSQ is between TQ and SQ, then put the current DTQ message into TQ, if the target CSQ is between RQ and TQ Between, then put the current DTQ message into the target CSQ; Afterwards, check whether there is a message that has not been traversed in the current DTQ, if yes, continue to traverse the message that has not been traversed and return to the traversed message in step 706 The step of determining the received message as the current DTQ message, if not, go to step 708.
  • FIG. 9 shows an example of the structure among SQ, RQ, and TQ.
  • Step 708 check whether there is still a DTQ that has not been traversed in all DTQs bound to the CFT, if yes, continue to traverse the DTQ that has not been traversed and return to step 705 to determine the traversed DTQ as the current DTQ, otherwise, execute the step 709.
  • Step 709 detecting whether there is an event that a message needs to be forwarded in time in the CSQ bound to the CFT
  • the CFT goes to sleep and waits to be woken up; if yes, returns to step 701 above.
  • the event that the message needs to be forwarded in time is determined according to the above CFT_Jiffies and CFT_Rcv_Jiffies; optionally, when the difference between the value of CFT_Jiffies and the value of CFT_Rcv_Jiffies is less than or equal to the specified difference, it is determined that there is an event that the message needs to be forwarded in time , otherwise, it is determined that there is no event that the message needs to be forwarded in time.
  • the specified difference is set in advance, for example, it can be set to 10 cycles (the cycle in which the above-mentioned timer generates an interrupt), etc., which is not specifically limited in this embodiment.
  • the above is an example description of the execution process after the distribution thread, DFT, and CFT are awakened.
  • the BFT after being awakened, it can directly obtain the message from the BTQ and forward it to the outgoing interface used for the message for forwarding. No more details here.
  • each DBQ there is generally only one distribution thread. Based on the correspondence between the DBQ and the message receiving queue described above, one-to-one correspondence between DBQ, distribution thread, and message receiving queue can be realized.
  • Each distribution thread is responsible for The packets belonging to the deterministic flow in the packet receiving queue are distributed to the DBQ corresponding to the distribution thread.
  • one DBQ is generally only bound to one DFT.
  • a DTQ generally only has one DFT responsible for processing the messages it enters the queue, and binds one CFT to be responsible for processing the messages going out from the DTQ.
  • FIG. 10 shows an example of operations between threads based on the above restrictions.
  • FIG. 10 shows an example that one port (interface) is associated with one CFT, and packets output through each port are scheduled by the CFT associated with the port.
  • DBQ and DTQ are designed as circular queues to achieve lock-free operations and improve concurrency
  • DisThr, DFT, and CFT are real-time priority scheduling threads; among them, DFT and CFT threads do not share CPU cores with other real-time priority threads, nor do they share CPU cores with threads that occupy CPU resources for a long time and do not release them. .
  • FIG. 11 is a structural diagram of a device provided by an embodiment of the present application.
  • the device is applied to network equipment, and the device may include:
  • the distribution thread after being awakened, distributes the messages in the bound message receiving queue, so as to distribute the messages belonging to the deterministic flow in the message receiving queue to the corresponding DBQ, which will belong to best effort Distributing the packets for the flow to the corresponding BTQ;
  • the packets in the packet receiving queue refer to the packets received from the outside through the local interface of the network device;
  • the deterministic forwarding thread DFT after being awakened, puts the message in the bound DBQ into the corresponding DTQ;
  • the periodic forwarding thread CFT after being woken up, puts the message in the bound DTQ into the corresponding designated periodic queue CSQ, and selects the message from the sending queue SQ and forwards it through the outgoing interface used to forward the message ;
  • the SQ is the CSQ currently pointed to by the queue sending pointer SQP corresponding to the CFT.
  • the distributing thread distributing the messages in the bound message receiving queue includes:
  • the distribution thread is set to a corresponding thread polling flag, and the thread polling flag has been set to False when the distribution thread is woken up;
  • the thread polling flag is further set to be True to indicate that the specified function that the distribution thread is closed is set; the specified function that is closed is used to indicate that the distribution thread is blocked go to sleep;
  • the thread polling flag is True, then the thread polling flag is set as False, and return traversal is bound with the distribution thread.
  • the distribution thread distributes the packets belonging to the deterministic flow in the packet receiving queue to the corresponding DBQ
  • the DFT wakeup flag set by the DFT bound to the DBQ is False
  • Set the DFT wake-up flag to True and wake up the DFT whose DFT wake-up flag is True;
  • the DFT whose DFT wakeup flag is TRUE is further awakened, and the DFT wakeup flag of the DFT is set to FALSE.
  • the DFT puts the message in the bound DBQ into the corresponding DTQ including:
  • the message output chain is generated through the following steps:
  • the DFT is set with a corresponding DFT polling flag, and the DFT polling flag has been set to False when the DFT is woken up;
  • the DFT inquires that the current DBQ has a message, it further sets the DFT polling flag as True, and closes the specified function set by the DFT, and closes the specified function to indicate that the DFT is prevented from entering the sleep state ;
  • Described DFT is after the DBQ of binding is all traversed, further in DFT polling sign is True, then setting described thread polling sign is False, and returns the step of traversing the DBQ bound with this awakened DFT ;
  • the DFT polling flag is False, enable the specified function, and the specified function is used to instruct the DFT to wait to be woken up.
  • the CFT wake-up flag that is further set in the CFT bound to the DTQ is False, then set the The CFT wake-up flag is True, and wake up the CFT whose CFT wake-up flag is True;
  • the CFT putting the message in the bound DTQ into the corresponding designated periodic queue CSQ includes:
  • traverse the current DTQ determine the traversed message as the current DTQ message, and determine the target CSQ corresponding to the current DTQ message according to the specified period queue Cycle parameter carried by the current DTQ message, if the target CSQ is between SQ and RQ If the target CSQ is between TQ and SQ, put the current DTQ message into TQ; if the target CSQ is between RQ and TQ, put the current DTQ message into Target CSQ; wherein, the RQ is the CSQ currently pointed to by the queue receiving pointer RQP corresponding to the CFT; the TQ is the CSQ currently pointed to by the queue tolerance pointer TQP corresponding to the CFT; after that, in the current DTQ When there is an untraversed message, continue to traverse the untraversed message and return to the step of determining the traversed message as the current DTQ message;
  • the CFT puts the packets in the bound DTQ into the corresponding designated periodic queue CSQ when the SQ is empty.
  • the CFT selecting a message from the sending queue SQ and forwarding the message through an outgoing interface for forwarding the message includes:
  • the CSQP includes at least: SQP; traverse the message in the SQ pointed to by the adjusted SQP, and traverse the message The text is determined as the current SQ message, and the current SQ message is forwarded by calling the outbound interface used to forward the current SQ message; after that, if there are still untraversed messages in the SQ, continue to traverse the untraversed message And return to the step of determining the traversed message as the current SQ message;
  • the CSQP also includes a receive queue pointer RQP and a queue tolerance pointer TQP; the RQP points to the CSQ as the receive queue RQ, and the TQP points to the CSQ as the queue tolerance TQ;
  • serial number of the CSQ pointed to by the readjusted SQP is determined according to the remainder obtained by modulo operation of the current processing cycle variable CFT_Jiffies set for the CFT and the number d of CSQs bound to the CFT;
  • serial number of the CSQ pointed to by the readjusted RQP is determined according to the result obtained by performing a modulo operation on the d according to the sum of the remainder and the specified number of jitter cycles Jitter;
  • serial number of the CSQ pointed to by the readjusted TQP is determined according to the following formula:
  • the CFT puts all the messages in all bound DTQs into the corresponding designated periodic queue CSQ, and further detects whether there is an event that a message needs to be forwarded in time in the CSQ bound to the CFT, If yes, return to the step of selecting a message from the sending queue SQ through the CFT and forward it through the outgoing interface for forwarding the message; if not, wait for being woken up again.
  • the event that the message needs to be forwarded in time is determined according to the current processing period variable CFT_Jiffies set by the CFT and the current message receiving period variable CFT_Rcv_Jiffies, when the value of the CFT_Jiffies is different from the value of the CFT_Rcv_Jiffies
  • the difference is less than or equal to the specified difference, it is determined that there is an event that the message needs to be forwarded in time, otherwise, it is determined that there is no event that the message needs to be forwarded in time;
  • the value of the CFT_Jiffies is updated to the current value of the set CSQF_Jiffies, and the CSQF_Jiffies It is used to indicate the queuing and forwarding cycle count of the specified cycle based on segment routing;
  • whether the message sending period is updated is determined in the following manner:
  • the method further includes: updating the value of the CFT_Prev_Jiffies to the current value of the CFT_Jiffies.
  • FIG. 12 is a structural diagram of an electronic device provided by an embodiment of the present application.
  • the hardware structure may include: a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; Instructions to implement the methods disclosed in the above examples of the present application.
  • the embodiment of the present application also provides a machine-readable storage medium, on which several computer instructions are stored, and when the computer instructions are executed by a processor, the present invention can be realized. Apply the method disclosed by the above example.
  • the above-mentioned machine-readable storage medium may be any electronic, magnetic, optical or other physical storage device, which may contain or store information, such as executable instructions, data, and so on.
  • the machine-readable storage medium can be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as CD, DVD, etc.), or similar storage media, or a combination of them.
  • a typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
  • embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • these computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means,
  • the instruction means implements the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operational steps are performed on the computer or other programmable equipment to produce computer-implemented processing, so that the information executed on the computer or other programmable equipment
  • the instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

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

本申请提供了确定性流传输方法及装置。通过本申请实施例,可以实现在现有尽力而为流转发的基础上增加确定性流的转发;进一步地,通过网络设备中的分发线程、DFT、CFT,保证了确定性流转发不受尽力而为流转发的影响,保证了现有尽力而为流转发和确定性流转发的相互兼容。

Description

确定性流传输方法及装置 技术领域
本申请涉及网络通信技术,特别涉及确定性流(DT:Deterministic Traffic)传输方法及装置。
背景技术
确定性网络(DetNet:Deterministic Network)可以在一个网络域内为承载的业务提供确定性业务功能。这些确定性业务功能可包括时延、丢包率等。以基于局域网实现的确定性网络即时间敏感型网络(TSN:Timesensitive Network)为例,在TSN中通过采用周期排队转发(CQF:Cyclic Queuing and Forwarding)确保转发层面上整个转发路径上的传输时延确定等。
为便于描述,确定性网络中传输的具有确定性业务功能比如时延、丢包率等的业务流称为确定性流。而针对不同于确定性流的其他业务流,结合现有转发设备比如软件转发设备或者基于交换芯片或NP实现的硬件转发设备等按照尽力而为转发的方式,可将不同于确定性流的其他业务流称为尽力而为流。
发明内容
本申请提供了确定性流传输方法、系统及装置,以实现基于分段路由SR实现指定周期排队转发CSQF的确定性流传输。
本申请实施例提供一种确定性流DT传输方法,该方法应用于网络设备,该方法包括:
通过本设备上已被唤醒的分发线程对与该分发线程相绑定的报文接收队列中的报文进行分发,以将所述报文接收队列中属于确定性流的报文分发至对应的确定性流缓存队列DBQ,将属于尽力而为流的报文分发至对应的尽力而为流缓存队列BTQ;所述报文接收队列中的报文是指通过所述网络设备本地接口接收到的来自外部的报文;
通过本设备上已被唤醒的确定性转发线程DFT将与该DFT相绑定的DBQ中的报文放入对应的确定性流队列DTQ;
通过本设备上已被唤醒的周期转发线程CFT将与该CFT相绑定的DTQ中的报文放入对应的指定周期队列CSQ,以及通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发;所述SQ为所述CFT对应的队列发送指针SQP当前指向的CSQ。
本申请实施例还提供了一种电子设备。该电子设备包括:处理器和机器可读存储介质;
所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;
所述处理器用于执行机器可执行指令,以实现上述公开的方法的步骤。
由以上技术方案可以看出,本实施例实现了在现有尽力而为流转发的基础上增加了确定性流的转发;
进一步地,通过上述分发线程、DFT、CFT,保证了确定性流转发不受尽力而为流转发的影响,保证了现有尽力而为流转发和确定性流转发的相互兼容。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
图1为尽力而为转发结构示意图;
图2为本申请实施例提供的方法流程图;
图3为本申请实施例提供的确定流转发和尽力而为流转发结构示意图;
图4为本申请实施例提供的分发线程实现流程图;
图5为本申请实施例提供的DFT实现流程图;
图6为本申请实施例提供的快速转发表、OutIfInfo及SRLists关联示意图;
图7为本申请实施例提供的CFT实现流程图;
图8为本申请实施例提供的CSQP与CSQ之间的关系示意图;
图9为本申请实施例提供的SQ、RQ、TQ之间的结构示意图;
图10为本申请实施例提供的各线程交互之间的示意图;
图11为本申请实施例提供的装置结构图;
图12为本申请实施例提供的电子设备结构图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,并使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面先对基于尽力而为转发设计的转发流程进行描述:
对软件转发设备(比如中低端路由器)而言,通常是按照如图1所示的尽力而为转发方式转发报文:
如图1所示,硬件控制器(比如接口板上的控制器)在接收到报文后,会先根据报文的报文特征参数将报文存放至内存中对应的报文接收队列(RcvQueue:Receiving Queue)。可选地,以报文特征参数为报文五元组为例,则可通过对报文五元组进行哈希(Hash)运算得到运算结果,在内存中的报文接收队列中查找队列编号为该运算结果的报文接收队列,将报文存放至该查找到的报文接收队列。需要说明的是,这里只是举例描述如何根据报文的报文特征参数将报文存放至对应的内存中的报文接收队列,并非用于限定。
在一个例子中,上述硬件控制器在接收到报文后,还会触发中断控制器产生中断,以通过中断控制器产生的中断调用驱动软件(比如CPU等)中的中断处理程序唤醒至少一个尽力而为转发线程(BFT:Best-effort Forwarding Thread)。其中,该
被唤醒的BFT从相绑定的报文接收队列中取出报文,将取出的报文转换为指定结构的报文并发送至平台软件(也可称为平台接口)。
平台软件查询FIB表确定用于转发报文的出接口,并调用驱动软件的发送接口(Transmod)将报文发往该出接口对应的硬件队列进行发送。可选地,在本实施例中,被设置高优先级的硬件队列,其中的报文被优先发送。在发送报文之后,还可通过调用释放资源软件(Free Buffer Pool)进一步释放已被发送的报文占用的存储资源。
以上对按照尽力而为转发方式转发报文(也称尽力而为流)的转发流程进行了描述。
但是,目前尽力而为流的转发流程缺乏对确定性网络的支持,不能实现确定性流的转发。
基于此,本申请实施例提供了一种确定性流传输方法,其在尽力而为流转发基础上叠加了确定性流转发,保证了尽力而为流转发和确定性流转发的兼容,同时确保确定性流转发不受尽力而为流转发的影响。下面对本申请实施例提供的确定性流传输方法进行描述:
参见图2,图2为本申请实施例提供的确定性流传输方法流程图。该流程应用于网络设备。本申请实施例并不具体限定该网络设备的具体结构形式,比如可为中低端路由器等,或者可为对性能要求高,支持更多CPU核的高端路由器等,本实施例并不具体限定,以让本申请实施例具有广泛的适用性和扩展性。
如上描述,本申请实施例是在尽力而为流转发基础上叠加了确定性流转发,为保证本申请实施例提供的方法更加容易理解,下面先对为在尽力而为流转发基础上叠加确定性流转发而新增加的如下改造:
1)增加分发线程(DisThr)。确定性流对时延和抖动非常敏感,非常容易受平台业务处理比如尽力而为流转发等的影响。为了避免平台业务处理影响确定性流的转发,本申请实施例在上述网络设备新增加了分发线程。
可选地,在本实施例中,分发线程的数量根据报文接收队列的数量设置,一个分发线程至少绑定一个报文接收队列。具体地,分发线程用于对相绑定的报文接收队列中的报文进行分发,以将报文接收队列中属于确定性流的报文分发至对应的确定性流缓存队列(DBQ:Deterministic Traffic Queue),将属于尽力而为流的报文分发至对应的尽力而为流缓存队列(BTQ:Best-Effort Traffic Queue)。
可选地,DBQ和报文接收队列一一对应,比如,报文接收队列1中属于确定流的报文分发至DBQ1,报文接收队列2中属于确定性流的报文分发至DBQ2,依次类推……。DBQ用于缓存分发线程分发的属于确定流的报文。分发线程分发报文工作与平台处理属于确定流的报文的工作解耦,使分发线程处理单一,从而高效且无阻塞,同时确定属于确定性流的报文的处理具有独立性。
可选地,BTQ和报文接收队列一一对应,比如,报文接收队列1中属于尽力而为流的报文分发至BTQ1,报文接收队列2中属于尽力而为流的报文分发至BTQ2,依次类推……。BTQ用于缓存分发线程分发的属于尽力而为流的报文。分发线程分发报文工作与平台处理属于尽力而为流的报文的工作解耦,避免平台的不确定性的处理工作阻塞分发线程。
如上可见,分发线程分发报文的过程是一个无阻塞的过程,既使可能会出现平台业务处理不确定性等,分发线程仍能确保报文比如属于确定性流的报文被及时分发。
需要注意的是,为防止尽力而为流过多而导致确定性流分发不及时,在具体实现时,需要保证上述分发线程占用足够的CPU资源,比如一个分发线程尽量独占CPU核,分配给某一个分发线程的CPU核不再分配给其它线程。
2)增加确定性流转发核心模块。可选地,本申请实施例可在网络设备的驱动软件 中增加确定性流转发核心模块。在一个例子中,确定性流转发核心模块至少包括:确定性流转发线程(DFT:Deterministic Forwarding Thread)、周期性转发线程(CFT:Cycle Forwarding Thread)。
可选地,在本实施例中,DFT的数量依据DBQ的数量和确定性流负载设置。在应用中,一个DFT至少绑定一个DBQ。DFT用于将相绑定的DBQ中的报文放入对应的确定性流队列(DTQ:Deterministic Traffic Queue)。
可选地,在本实施例中,CFT的数量依据DTQ的数量和确定性流负载设置。在应用中,一个CFT绑定至少一个DTQ。CFT用于将相绑定的DTQ中的报文放入对应的指定周期队列(CSQ:Cycle Specified Queue)。可选地,在本实施例中,CFT还与至少一个接口的至少一个CSQ绑定,用于在指定周期内从指定CSQ中取出报文,并通过用于转发该报文的出接口进行转发。
3)对现有BFT进行改造:之前,BFT从报文接收队列中取出报文进行转发,而在本实施例中,BFT被改造为从相绑定的BTQ中取出报文进行转发。
4)对发送模块(TransMod:Transmitting Module)进行改造,以使发送模块提供确定性流转发(比如新增确定性流转发的硬件适配等)。可选地,在一个实施例中,在确定性流转发时,可在出接口指定属于确定性流的报文的优先级最高,以保证属于确定性流的报文优先转发,同时可实现对尽力而为流的转发进行限速。
以上简单描述了为在尽力而为流转发基础上叠加确定性流转发而新增加的改造。通过上述改造,可以实现在兼容现有尽力而为的QOS转发前提下,增加确定性流的转发,且保证确定性流转发不受尽力而为流转发的影响。图3举例示出了在图1所示框架基础上改造后的框架结构图。
基于上述改造,下面对本申请实施例提供的方法进行描述:
如图2所示,该流程可包括以下步骤:
步骤201,通过本设备上已被唤醒的分发线程对与该分发线程相绑定的报文接收队列中的报文进行分发,以将报文接收队列中属于确定性流的报文分发至对应的DBQ,将属于尽力而为流的报文分发至对应的BTQ。
这里的报文接收队列如上描述,其存放的是网络设备通过本地接口接收到的来自外部的报文。
至于分发线程如何对相绑定的报文接收队列中的报文进行分发,具体可参见下文图4举例描述的分发线程的实现流程,这里不再赘述。
在本实施例中,分发线程可通过中断被唤醒,也可通过其他方式比如轮询方式被唤醒等,本实施例并不具体限定。
步骤202,通过本设备上已被唤醒的DFT将与该DFT相绑定的DBQ中的报文放入对应的DTQ。
在本实施例中,DFT可由分发线程在适当时机唤醒,下文会有举例描述。当然,DFT也可通过其他方式被唤醒,本实施例并不具体限定。
至于DFT如何将相绑定的DBQ中的报文放入对应的DTQ,具体可参见下文图5举例描述的DFT的实现流程,这里不再赘述。
步骤203,通过本设备上已被唤醒的周期转发线程CFT将与该CFT相绑定的DTQ中的报文放入对应的指定周期队列(CSQ:Cyclic Specific Queue),以及通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发,SQ为CFT对应的 队列发送指针SQP当前指向的CSQ。
在本实施例中,CFT可由DFT在适当时机唤醒,下文会举例描述。当然,CFT还会通过其他方式被唤醒,比如CFT在新创建后直接默认是被唤醒、或者CFT在新创建后如果检测到指定事件,则也默认被唤醒等,本实施例并不具体限定。这里的指定事件是指CSQ中有报文需要及时转发的事件。下文会举例描述该事件,这里暂不赘述。
至于如何通过CFT将CFT相绑定的DTQ中的报文放入对应的CSQ队列,以及如何从发送队列(SQ:Sending Queue)中选择报文并通过用于转发报文的出接口进行转发,具体可参见下文图7举例描述的CFT的实现流程,这里暂不赘述。
在本实施例中,每一接口对应多个CSQ比如对应3个CSQ。其中,每个CSQ至少包括:
(1)指定周期队列描述符(CSQD:Cyclic Specific Queue Descriptors),用于描述CSQ。
(2)数据缓存块描述符队列(BDQ:Buffer Descriptor Queue)。在本实施例中,BDQ中的队列元素描述了一个数据块的信息,其可至少包括:数据所处的内存块信息、数据起始位置、数据长度等,本实施例并不具体限定。
可选地,在本实施例中,每个指定周期队列描述符可至少包括:
队列头(QH),用于指向对应的BDQ;
头部(Head),指向当前队首位置,当CSQ为空时,Head为0,表明下一个要入队的数据包占用第0个位置,每入队一个数据后Head增加1;
QLen,队列长度,标识队列能存放的报文数量,Head长度为QLen时,表明队列满。
CurBytes,当前入队列的字节数;
MaxBytes,当前队列的字节数容量。
另外,在本实施例中,CFT管理指定周期队列指针结构(Cyclic Specific Queue Pointers,简记为CSQP)。CSQP由3个成员组成:
SQP:发送队列指针(Sending Queue Pointer),SQP指向的CSQ,表示当
前周期内正在发送的CSQ(该CSQ也称发送队列SQ)。
RQP:接收队列指针(Receiving Queue Pointer),RQP指向的CSQ,表示当前周期内正在接收的CSQ(该CSQ也称接收队列RQ)。
TQP:容忍队列指针(Tolerating Queue Pointer),TQP指向的CSQ,表示RQ接收满后当前周期内容忍接收的CSQ(此时也称容忍队列TQ)。基于上面描述,图8举例示出了CSQP与CSQ之间的关系示意图。
至此,完成图2所示流程。
通过图2所示流程,本实施例实现了在现有尽力而为流转发的基础上增加了确定性流的转发;
进一步地,通过上述分发线程、DFT、CFT,保证了确定性流转发不受尽力而为流转发的影响,保证了现有尽力而为流转发和确定性流转发的相互兼容。
下面通过图4所示流程对分发线程实现流程进行描述:
参见图4,图4为本申请实施例提供的分发线程实现流程图。在本实施例中,分发 线程被设置一个对应的线程轮询标志(记为bPoll_1),初始,bPoll_1被设置为FALSE。当分发线程被唤醒时,bPoll_1此时也为FALSE。在本实施例中,分发线程可通过中断或其他方式被唤醒。
如图4所示,被唤醒的分发线程可执行以下步骤:
步骤401,分发线程按顺序遍历相绑定的报文接收队列,将当前遍历到的报文接收队列确定为当前队列,查询当前队列是否有报文,如果是,执行步骤402,如果否,执行步骤407。
步骤402,设置bPoll_1为TRUE,并遍历当前队列,将遍历到的报文确定为当前报文,当识别出当前报文属于确定性流,则执行步骤403,当识别出当前报文属于尽力而为流,则执行步骤405。
本步骤402是在查询出当前队列有报文时执行的。在当前队列有报文时,设置bPoll_1为TRUE,则表示分发线程当前进入轮询过程,为减少线程调度开销,避免唤醒操作影响分发线程的轮询,此时需要指示关闭分发线程被设置的指定功能。这里,关闭指定功能用于指示阻止分发线程进入睡眠状态。
步骤403,将当前报文放入与当前队列对应的DBQ。之后执行步骤404。
在本实施例中,对于属于确定性流的报文,其会携带确定性流属性(DetProperty:Deterministic Property)。在本实施例中,确定性流属性不是固定的,目前规范也不提供具体的指定,而是根据实际需求统筹设置,比如设置DSCP等字段的值来表征确定性流属性。本实施例并不具体限定确定性流属性。但一旦设置好确定性流属性,则应用于本步骤403,则可识别当前报文是否携带确定性流属性,如果是,则识别出当前报文属于确定性流,将当前报文放入与当前队列对应的DBQ。最终实现了属于确定性流的报文分发至DBQ。
可选地,作为一个实施例,在本实施例中,DBQ和报文接收队列一一对应,比如编号为1的报文接收队列中的报文放入编号为1的DBQ,编号为2的报文接收队列中的报文放入编号为2的DBQ,依次类推。最终依据上述DBQ和报文接收队列的对应关系,实现了将识别出的属于确定性流的当前报文放入与当前队列对应的DBQ。
步骤404,若此时上述DBQ相绑定的DFT被设置的DFT唤醒标志为False,则将该DFT唤醒标志设置为True,唤醒DFT唤醒标志为True的该DFT,之后检查当前队列中是否还存在未被遍历的报文,如果是,继续遍历该未被遍历的报文并返回步骤402中将该遍历到的报文确定为当前报文的步骤,如果否,则执行步骤407。
本实施例中,分发线程会针对每一DFT设置一个对应的DFT唤醒标志。初始,各DFT对应的DFT唤醒标志被设置为FALSE。
通过步骤404能够及时唤醒对应的DFT,以使被唤醒的DFT及时将相绑定的DBQ中的报文放入对应的DTQ,具体可参见下文DFT的流程,这里不再赘述。
需要说明的是,若此时上述DBQ相绑定的DFT被设置的DFT唤醒标志为True,则本步骤404可直接在当前队列中还存在未被遍历的报文时,遍历该未被遍历的报文,返回步骤402中将该遍历到的报文确定为当前报文的步骤,而在当前队列中不存在未被遍历的报文,则执行步骤407。
步骤405,将当前报文放入与当前队列对应的BTQ。之后执行步骤406。
可选地,作为一个实施例,在本实施例中,BTQ和报文接收队列一一对应,比如编号为1的报文接收队列中的报文放入编号为1的BTQ,编号为2的报文接收队列中的报 文放入编号为2的BTQ,依次类推。最终,依据上述BTQ和报文接收队列的对应关系,实现了将识别出的属于尽力而为流的当前报文放入与当前队列对应的BTQ。
步骤406,若此时上述BTQ相绑定的BFT被设置的BFT唤醒标志为False,则将该BFT唤醒标志设置为True,唤醒BFT唤醒标志为True的BFT,并检查当前队列中是否还存在未被遍历的报文,如果是,遍历该未被遍历的报文,返回步骤401中将该遍历到的报文确定为当前报文的步骤,如果否,执行步骤407。
通过步骤406能够及时唤醒上述BTQ相绑定的BFT,以使被唤醒的BFT及时转发BTQ中的报文。
步骤407,若当前队列无报文或者当前队列中不存在未被遍历的报文,则检测分发线程相绑定的所有报文接收队列中还存在未被遍历的报文接收队列,如果是,继续遍历分发线程相绑定的且未被遍历的其它报文接收队列,并返回步骤401中将当前遍历到的报文接收队列确定为当前队列的步骤,否则,执行步骤408。
步骤408,针对DFT唤醒标志为TRUE的DFT,唤醒该DFT,并将该DFT的DFT唤醒标志设置为FALSE;以及,针对BFT唤醒标志为TRUE的BFT,唤醒该BFT,并将该BFT的BFT唤醒标志设置为FALSE。之后执行步骤409。
这里之所以执行步骤408,是为了唤醒之前已唤醒但在分发线程遍历报文接收队列过程中进入睡眠的DFT和BFT,保证确定性流和尽力而为流均被及时转发。当然,若DFT唤醒标志为TRUE的DFT当前未进入睡眠(比如还在运行状态),则本步骤408针对DFT唤醒标志为TRUE的DFT,直接将该DFT的DFT唤醒标志设置为FALSE即可。BFT唤醒标志为TRUE的BFT原理类似,不再赘述。
步骤409,若bPoll_1为TRUE,则设置bPoll_1为False,并返回上述步骤401,若bPoll_1为False,则开启上述指定功能,指定功能用于指示分发线程等待被唤醒。
至此,完成图4所示流程。
通过图4所示流程描述了分发流程的实现流程。
下面通过图5所示流程对DFT实现流程进行描述:
参见图5,图5为本申请实施例提供的DFT实现流程图。在本实施例中,DFT可由分发线程唤醒(具体见上述图4所示流程)。在本实施例中,DFT也可通过其他方式被唤醒,这里不具体限定。在本实施例中,被唤醒的DFT被设置一个对应的线程轮询标志(记为DFT轮询标志),其中,当DFT被唤醒时,此时DFT轮询标志为FALSE。
如图5所示,被唤醒的DFT可执行以下步骤:
步骤501,DFT按顺序遍历相绑定的DBQ,将当前遍历到的DBQ确定为当前DBQ,查询当前DBQ是否有报文,如果是,执行步骤502,如果否,执行步骤505。
步骤502,设置DFT轮询标志为TRUE,并遍历当前DBQ,将遍历到的报文确定为当前DBQ报文,调用已设置的报文重复消除和排序(PREOF:Packet Replication,Elimination,and Ordering Functions)功能识别出当前DBQ报文不为重复报文时生成报文输出链。
本步骤502是在查询出当前DBQ有报文时执行的。在当前DBQ有报文时,则设置DFT轮询标志为TRUE,则表示DFT当前进入轮询过程。为减少线程调度开销,避免唤醒操作影响DFT的轮询,此时需要指示关闭DFT被设置的指定功能。这里,关闭指定功能用于指示阻止DFT进入睡眠状态。
在本实施例中,DFT被设置了PREOF功能。基于PREOF功能可识别出当前 DBQ报文是否为重复报文。其中,PREOF功能可用于识别出当前DBQ报文与之前已调用该PREOF功能处理的报文是否为重复报文,当识别出当前DBQ报文为重复报文时,则丢弃当前DBQ报文,并在当前DBQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文,并返回步骤502中将该遍历到的报文确定为当前DBQ报文的步骤。可选地,基于PREOF功能识别当前DBQ报文是否为重复报文有很多方式,比如,识别当前DBQ报文的报文序列号是否小于已记录的该当前DBQ报文所属业务流对应的最大序列号,如果是,则识别当前DBQ报文为重复报文,等等,本实施例并不具体限定。
可选地,在本实施例中,假若基于PREOF功能识别出当前DBQ报文不为重复报文,则可调用PREOF功能生成报文输出链。至于如何调用PREOF功能生成报文输出链,下文会举例描述,这里暂不赘述。
本实施例中,在生成报文输出链后,可将报文输出链中的每一报文进行报文封装并放入用于转发该报文的出接口对应的DTQ,具体可参见步骤503。
步骤503,遍历报文输出链中的报文,将遍历到的报文记为目标报文,对目标报文进行封装,将封装后的目标报文放入用于转发该目标报文的出接口对应DTQ,检查目标报文是否为报文输出链中最后一个未被遍历的报文,如果是,则执行步骤504,如果否,遍历报文输出链中未被遍历的报文,返回将遍历到的报文记为目标报文的步骤。
可选地,在本实施例中,每个出接口设置一个对应的DTQ。为了方便描述,比如出接口1对应的DTQ记为DTQ1,出接口2对应的DTQ记为DTQ2,依次类推。基于此,在确定用于转发目标报文的出接口后,对目标报文进行封装并将封装后的目标报文放入用于转发该目标报文的出接口对应的DTQ,比如确定用于转发目标报文的出接口为出接口1,则将封装后的目标报文放入用于转发该目标报文的出接口对应的DTQ即DTQ1。
至于如何对目标报文进行封装,下文会举例描述,这里暂不赘述。
最终通过上述步骤503实现了将DBQ中的报文放入DTQ。
步骤504,若此时上述DTQ相绑定的CFT被设置的CFT唤醒标志为False,则将该CFT唤醒标志设置为True,唤醒CFT唤醒标志为True的该CFT,检查当前DBQ中是否还存在未被遍历的报文,如果是,继续遍历该未被遍历的报文并返回步骤502中将该遍历到的报文确定为当前DBQ报文的步骤,如果否,执行步骤505。
本实施例中,DFT会针对每一CFT设置一个对应的CFT唤醒标志。初始,各CFT对应的CFT唤醒标志被设置为FALSE。
通过步骤504能够及时唤醒上述DTQ相绑定的CFT,以使被唤醒的CFT及时将绑定的DTQ中的报文放入对应的CSQ队列,以及从SQ中选择报文并通过报文的出接口进行转发,具体见下文图7所示流程。
需要说明的是,假若上述DTQ相绑定的CFT的CFT唤醒标志为True,则本步骤504可直接在当前DBQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回步骤502中将该遍历到的报文确定为当前DBQ报文的步骤,而在当前DBQ中不存在未被遍历的报文时,执行步骤505。
步骤505,若当前DBQ无报文或者当前DBQ中不存在未被遍历的报文,则检查DFT相绑定的所有DBQ中是否还存在未被遍历的DBQ,如果是,继续遍历该未被遍历的DBQ并返回步骤501中将当前遍历到的DBQ确定为当前DBQ的步骤;否则,执行步骤506。
步骤506,针对CFT唤醒标志为TRUE的CFT,唤醒该CFT,并将该CFT的 CFT唤醒标志设置为FALSE。之后执行步骤507。
这里之所以执行步骤506,是为了唤醒之前已唤醒但在DFT遍历DBQ过程中进入睡眠的CFT,保证确定性流转发的可靠性。
步骤507,若CFT轮询标志为TRUE,则设置CFT轮询标志为False,并返回上述步骤501,若CFT轮询标志为False,则开启上述指定功能以指示DFT等待被唤醒。
至此,完成图5所示流程。
通过图5所示流程描述了DFT的实现流程。
下面对图5所示流程中如何调用PREOF功能生成报文输出链进行描述:
可选地,作为一个实施例,调用PREOF功能生成报文输出链举例可包括:
步骤a11,识别当前DBQ报文是否为乱序报文,如果否,执行步骤a12,如果是,执行步骤a13。
可选地,在本实施例中,识别当前DBQ报文是否为乱序报文有很多实现方式,比如识别当前DBQ报文所属的业务流,发现当前DBQ报文的报文序列号大于已记录的通过调用PREOF功能处理的属于上述业务流的报文的最大序列号,则在当前DBQ报文的报文序列号与上述最大序列号不相邻时确定当前DBQ报文为乱序报文,否则,确定当前DBQ报文不为乱序报文。
步骤a12,将当前DBQ报文放入上述报文输出链。
本步骤a12是在识别出当前DBQ报文不为乱序报文的前提下执行的。一旦识别出当前DBQ报文不为乱序报文,则可直接将当前DBQ报文放入上述报文输出链,同时进一步将已记录的上述最大序列号更新为当前DBQ报文的报文序列号,以便于判断后续的DBQ报文是否为乱序报文。
步骤a13,确定当前DBQ报文所属的业务流,若当前DBQ报文满足条件,所述条件是指当前DBQ报文与已记录的属于所述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文成功排序,则将当前DBQ报文、已记录的与所述当前DBQ报文成功排序的至少一个报文、以及已记录的属于所述业务流且在所述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入所述报文输出链,若当前DBQ报文不满足所述条件,则将已记录的属于上述业务流且在上述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入上述报文输出链。
本步骤a13是在识别出当前DBQ报文为乱序报文的前提下执行的。一旦识别出当前DBQ报文为乱序报文,则识别当前DBQ报文所属的业务流(具体业务流信息可携带在报文中),之后查找已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文是否能够成功与当前DBQ报文进行排序(即该至少一个报文的序列号与当前DBQ报文的序列号是否连续),比如当前DBQ报文的报文序列号为8,查找出已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的一个报文的报文序列号为7,则表示已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文成功与当前DBQ报文进行排序。需要说明的是,上述设定时间窗口可根据实际需求设置,比如设置距离当前时间最近的10us等,本实施例并不具体限定。
作为一个实施例,假若当前DBQ报文与已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文成功排序,则将当前DBQ报文、已记录的与当前DBQ报文成功排序的至少一个报文、以及已记录的属于上述业务流且在上 述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入报文输出链。最终生成了报文输出链。
作为一个实施例,假若当前DBQ报文与已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文并不能成功排序,则可将已记录的属于上述业务流且在上述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入报文输出链。最终生成了报文输出链。需要说明的是,假若当前DBQ报文与已记录的属于上述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文并不能成功排序,则可选地,则可进一步记录当前DBQ报文、以及调用PREOF功能处理当前DBQ报文的时间戳。
最终,通过上述步骤a11至步骤a13实现了报文输出链的生成。
下面对对上述步骤503中如何对目标报文进行封装进行描述:
可选地,本实施例中,上述步骤503中对目标报文进行封装可包括:
步骤b11,判断目标报文是否是边缘接入包,如果是,执行步骤b12,否则,执行步骤b13。
可选地,在本实施例中,可依赖于目标报文是否被封装网络信息判断目标报文是否是边缘接入包,比如,目标报文未被封装网络信息比如SR信息等,则确定目标报文是边缘接入包,否则,确定目标报文不是边缘接入包。需要说明的是,这里只是举例描述如何判断目标报文是否是边缘接入包,并非用于限定。
步骤b12,对目标报文进行第一类封装。
本步骤b12是在确定目标报文是边缘接入包的前提下执行的。当确定目标报文是边缘接入包,则如步骤b12描述,可对目标报文进行第一类封装。
可选地,在对目标报文进行第一类封装时,本实施例引入一个新的概念:快速转发表(FastFwdTbl)。作为一个实施例,快速转发表可通过对确定性网络中的路由信息进行转化而得到。DFT通过查询表快速转发表可以很快获得目标报文的出接口,从而找到相关的DTQ(也即该出接口对应的DTQ)。
在本实施例中,通过快速转发表转发确定性流,其目的是与尽力而为转发的流程相分离,避免确定性流受尽力而为流转发的影响,缩短确定性流转发流程,加快确定性流转发速度,为确定性流转发提供保障。
在具体实现时,快速转发表相对于尽力而为的FIB表,容量更小,查找更快,查找表的开销相差不大,从而减小不确定性因素。
作为一个实施例,可选地,快速转发表可至少包括:Destination IP(目的IP地址)、Source IP(源IP地址)、Destination Port(目的端口)、Source Port(源端口)、Proto(协议)、差分服务代码点(DSCP:Differentiated Services Code Point)、出接口(OutIf:Out Interface)、隧道索引(LIndex)。
基于上述快速转发表,则步骤b12举例可为:基于目标报文携带的报文特征信息比如源IP地址、目的IP地址等,在快速转发表查找到OutIf,以及LIndex;之后在已创建的所有出接口信息(OutIfInfo)中查找OutIf对应的OutIfInfo;这里,OutIfInfo至少包括出接口信息比如MAC地址、基于出接口的段路由列表(SRLists)的指针(这里以段路由SR为例描述);之后再根据LIndex及SRLists指针获取对应的SRList,基于SRList、OutIfInfo中的MAD地址封装目标报文,最终实现了目标报文的第一类封装。图6举例示出了快速转发表与OutIfInfo及SRLists关联关系示意图。
步骤b13,对目标报文进行第二类封装。
本步骤b13是在确定目标报文不是边缘接入包的前提下执行的。当确定目标报文不是边缘接入包,则意味着目标报文已被执行上述第一类封装。基于此,对应上述步骤b12举例示出的第一类封装,则本步骤b13中,可根据目标报文被封装的SRLists中的SID确定OutIf,通过OutIf查询到对应的OutIfInfo(比如至少包括MAC地址等);根据获取的OutIfInfo(比如至少包括MAC地址等)对目标报文执行封装更换,比如将已封装的二层头中的源MAC地址替换为该OutIfInfo中出接口的MAC地址等,本实施例并不具体限定。
最终通过上述步骤b11至步骤b13实现了如何对步骤503中的目标报文进行封装。
下面通过图7所示流程对CFT实现流程进行描述:
参见图7,图7为本申请实施例提供的CFT实现流程图。在本实施例中,CFT可按照如上图5所示流程中步骤504或步骤506的描述被DFT唤醒。作为另一实施例,当在网络设备上新创建CFT时,也可直接唤醒CFT被唤醒,比如当在网络设备上新创建CFT时,若检测到该CFT相绑定的CSQ中有报文需要及时转发,则可直接唤醒该CFT。
在描述图7所示流程之前,先针对每一CFT的设置进行描述:
作为一个实施例,可针对每一CFT设置对应的三个局部变量:CFT_Jiffies、CFT_prev_Jiffies、CFT_Rcv_Jiffies。
其中,CFT_Jiffies可指示当前正在处理的周期,可记为当前处理周期变量。CFT_prev_Jiffies用于指示历史周期,可记为历史周期变量。CFT_Rcv_Jiffies用于记录当前处理接收的周期,可记为报文接收周期变量。
基于上面描述,如图7所示,该流程可包括以下步骤:
步骤701,CFT在被唤醒后,读取CSQF_Jiffies的当前值,将CFT_Jiffies更新为该读取的CSQF_Jiffies的当前值。之后执行步骤702。
步骤702,检查报文发送周期是否发生更新,如果是,执行步骤703,如果否,执行步骤704。
如上描述,CFT_Jiffies表示当前处理周期变量,CFT_Prev_Jiffies表示历史周期变量,因此,基于CFT_Jiffies、CFT_Prev_Jiffies可确定报文发送周期是否发生更新,比如,当CFT_Jiffies和CFT_Prev_Jiffies不等时,表示已执行了周期循环,报文发送周期已发生更新,比如周期从第一周期循环到第二周期;而当CFT_Jiffies和CFT_Prev_Jiffies相等时,表示报文发送周期没有发生更新。
步骤703,重新调整CFT对应的CSQP,并将CFT_Prev_Jiffies的取值更新为CFT_Jiffies的当前值。之后执行步骤704。
如前描述,CSQP至少包括:SQP、RQP、TQP,则可选地,作为一个实施例,重新调整后的SQP指向的CSQ的编号,是根据CFT_Jiffies与CFT绑定的CSQ的总数量d进行模运算得到的余数确定。这里可将该余数记为Rem。
重新调整后的RQP指向的CSQ的编号,是根据Rem与指定抖动周期数Jitter之和对上数d进行模运算得到的结果确定。比如,重新调整后的RQP指向的CSQ的编号通过以下公式得到:(Rem+Jitter)mod d。
重新调整后的TQP指向的CSQ的编号,可据如下公式确定:(d-1+Rem-Jitter) mod d。
需要说明的是,上述重新调整CFT对应的CSQP的方式只是一种举例,并非用于限定。
步骤704,遍历SQ中的报文,将遍历到的报文确定为当前SQ报文,将当前SQ报文发送至用于转发当前SQ报文的出接口进行转发,之后,检查SQ中是否还存在未被遍历的报文,如果是,继续遍历该未被遍历的报文并返回本步骤704中将该遍历到的报文确定为当前SQ报文的步骤,如果否,执行步骤705。
步骤705,遍历CFT相绑定的DTQ,将遍历到的DTQ确定为当前DTQ,查询当前DTQ是否有报文,如果是,执行步骤706,如果否,执行步骤708。
本步骤705是在SQ中不存在未被遍历的报文(也即SQ为空)时执行的。
步骤706,将CFT_Rcv_Jiffies的取值更新为CSQF_Jiffies的当前值,遍历当前DTQ,将遍历到的报文确定为当前DTQ报文,依据当前DTQ报文携带的指定周期队列(Cycle)参数确定当前DTQ报文对应的目标CSQ。之后执行步骤707。
基于如上描述的CSQF_Jiffies、CFT_Rcv_Jiffies,这里将CFT_Rcv_Jiffies的取值更新为CSQF_Jiffies的当前值,其目的是用于控制CFT线程及时执行,减少调度时延。
在本实施例中,当前DTQ报文携带的指定周期队列(Cycle)参数,该Cycle参数指示了目标CSQ,基于此,基于Cycle参数的指示很容易确定当前DTQ报文对应的目标CSQ。
步骤707,若目标CSQ处于SQ和RQ之间,则将当前DTQ报文放入RQ,若目标CSQ处于TQ和SQ之间,则将当前DTQ报文放入TQ,若目标CSQ处于RQ和TQ之间,则将当前DTQ报文放入目标CSQ;之后,检查当前DTQ中是否还存在未被遍历的报文,如果是,继续遍历该未被遍历的报文并返回步骤706中将该遍历到的报文确定为当前DTQ报文的步骤,如果否,执行步骤708。
在本实施例中,当目标CSQ处于SQ和RQ之间,则表明当前DTQ报文可能是延迟到达,为保证延迟到达的当前DTQ报文等待少的时间被转发,则可将当前DTQ报文放入RQ。而当目标CSQ处于TQ和SQ之间,则表明当前DTQ报文可能是提前到达,为保证其他报文及时转发,则可限制提前到达的当前DTQ报文等待比较多的时间被转发,即将当前DTQ报文放入TQ。图9举例示出了SQ、RQ、TQ之间的结构。
步骤708,检查CFT相绑定的所有DTQ中是否还存在未被遍历的DTQ,如果是,继续遍历未被遍历的DTQ并返回步骤705中将遍历到的DTQ确定为当前DTQ,否则,执行步骤709。
步骤709,检测CFT相绑定的CSQ中是否有报文需要及时转发的事件,
如果否,则CFT进入睡眠并等待被唤醒,如果是,返回执行上述步骤701。
这里,所述报文需要及时转发的事件依据上述CFT_Jiffies和CFT_Rcv_Jiffies确定;可选地,当CFT_Jiffies的取值与CFT_Rcv_Jiffies的取值之差小于或等于指定差时,确定有报文需要及时转发的事件,否则,确定不存在报文需要及时转发的事件。这里,指定差预先设置,比如可以预先设置为10个周期(上述定时器产生中断的周期)等,本实施例并不具体限定。
至此,完成图7所示流程。
通过图7描述了CFT被唤醒后执行的流程。
以上对分发线程、DFT、CFT被唤醒后执行的流程进行举例描述,至于BFT,其在被唤醒之后,即可直接从BTQ中获取报文并转发至用于该报文的出接口进行转发,这里不再详述。
可选地,在本实施例中,可保证可靠性,可优选以下限制:
1)针对每个DBQ,一般只对应一个分发线程,基于前面描述DBQ与报文接收队列的对应关系,则最终可实现DBQ、分发线程、报文接收队列一一对应,每一分发线程负责将报文接收队列中属于确定性流的报文分发至该分发线程对应的DBQ。
2)针对DBQ,一个DBQ一般只与一个DFT绑定。
3)针对DTQ,一个DTQ一般只由一个DFT负责处理其入队的报文,并绑定一个CFT负责处理从该DTQ出去的报文。
4)针对CSQ,一个CSQ一般只由一个CFT负责处理其入队的报文,并由同一个CFT负责处理从该CSQ出去的报文。
基于上面描述,图10举例示出了基于上述限制各线程之间的操作。在图10中举例示出一个端口(interface)与一个CFT关联,经由每一端口输出的报文由该端口关联的CFT调度。
另外,在本实施例中,DBQ和DTQ被设计为循环队列,以实现无锁操作,提高并发性;
还需要说明的是,DisThr、DFT、CFT为实时优先级调度线程;其中,DFT、CFT线程不与其它实时优先级线程共享CPU核,也不与长时间占用CPU资源不释放的线程共用CPU核。
至此,完成本申请实施例提供的方法描述。下面对本申请实施例提供的装置进行描述:
参见图11,图11为本申请实施例提供的装置结构图。该装置应用于网络设备,该装置可包括:
分发线程,在被唤醒后,对相绑定的报文接收队列中的报文进行分发,以将所述报文接收队列中属于确定性流的报文分发至对应的DBQ,将属于尽力而为流的报文分发至对应的BTQ;所述报文接收队列中的报文是指通过所述网络设备本地接口接收到的来自外部的报文;
确定性转发线程DFT,在被唤醒后将相绑定的DBQ中的报文放入对应的DTQ;
周期转发线程CFT,在被唤醒后,将相绑定的DTQ中的报文放入对应的指定周期队列CSQ,以及从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发;所述SQ为所述CFT对应的队列发送指针SQP当前指向的CSQ。
可选地,所述分发线程对相绑定的报文接收队列中的报文进行分发包括:
遍历与所述分发线程相绑定的报文接收队列,将当前遍历到的报文接收队列确定为当前队列,查询所述当前队列是否有报文;
若当前队列有报文,则遍历当前队列,将遍历到的报文确定为当前报文,若当前报文属于确定性流,则将当前报文放入与当前队列对应的DBQ,若当前报文属于尽力而为流,则将当前报文放入与当前队列对应的BTQ;之后,在当前队列中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将该遍历到的报文确定为当前报文的步骤;
若当前队列无报文或者当前队列中不存在未被遍历的报文,在所述分发线程相绑定的所有报文接收队列中还存在未被遍历的报文接收队列时,继续遍历所述分发线程相绑定的且未被遍历的其它报文接收队列,并返回将当前遍历到的报文接收队列确定为当前队列的步骤。
可选地,所述分发线程被设对应的线程轮询标志,线程轮询标志在所述分发线程被唤醒时已被置为False;
所述分发线程在查询当前队列有报文时,进一步设置所述线程轮询标志为True,以指示关闭所述分发线程被设置的指定功能;关闭所述指定功能用于指示阻止所述分发线程进入睡眠状态;
所述分发线程在相绑定的报文接收队列均被遍历后,进一步在所述线程轮询标志为True,则设置所述线程轮询标志为False,并返回遍历与所述分发线程相绑定的报文接收队列的步骤;在所述线程轮询标志为False,则指示开启所述指定功能,所述开启指定功能用于指示所述分发线程等待被唤醒。
可选地,所述分发线程在将所述报文接收队列中属于确定性流的报文分发至对应的DBQ时进一步在与该DBQ相绑定的DFT被设置的DFT唤醒标志为False时,将该DFT唤醒标志设置为True,唤醒DFT唤醒标志为True的该DFT;和/或,
在所述分发线程相绑定的所有报文接收队列均被遍历后,进一步针对DFT唤醒标志为TRUE的DFT,唤醒该DFT,并将该DFT的DFT唤醒标志置为FALSE。
所述DFT将相绑定的DBQ中的报文放入对应的DTQ包括:
遍历与所述DFT相绑定的DBQ,将遍历到的DBQ确定为当前DBQ,查询当前DBQ是否有报文;
若当前DBQ有报文,遍历当前DBQ,将遍历到的报文确定为当前DBQ报文,调用已设置的报文重复消除和排序PREOF功能识别出当前DBQ报文不为重复报文时生成报文输出链,所述报文输出链至少包括当前DBQ报文;对所述报文输出链中的每一DBQ报文进行报文封装,将封装后的DBQ报文放入用于转发该DBQ报文的出接口对应的DTQ;之后,在当前DBQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将该遍历到的报文确定为当前DBQ报文的步骤;
若当前DBQ无报文或者当前DBQ中不存在未被遍历的报文时,在所述DFT相绑定的所有DBQ中还存在未被遍历的DBQ时,继续遍历该未被遍历的DBQ并返回将当前遍历到的DBQ确定为当前DBQ的步骤。
可选地,所述报文输出链通过以下步骤生成:
识别当前DBQ报文是否为乱序报文,如果否,将当前DBQ报文放入所述报文输出链;如果是,
确定当前DBQ报文所属的业务流,若当前DBQ报文与已记录的属于所述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文成功排序,则将当前DBQ报文、已记录的与所述当前DBQ报文成功排序的至少一个报文、以及已记录的属于所述业务流且在所述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入所述报文输出链,否则,将已记录的属于所述业务流且在所述设定时间窗口之外调用PREOF功能处理但还未放入报文输出链的报文放入所述报文输出链。
可选地,所述DFT被设置对应的DFT轮询标志,所述DFT轮询标志在所述DFT被唤醒时已被置为False;
所述DFT在查询当前DBQ有报文时,进一步设置所述DFT轮询标志为True,并关闭所述述DFT被设置的指定功能,关闭所述指定功能用于指示阻止所述DFT进入睡眠状态;
所述DFT在相绑定的DBQ均被遍历后,进一步在DFT轮询标志为True,则设置所述线程轮询标志为False,并返回遍历与该被唤醒的DFT相绑定的DBQ的步骤;在所述DFT轮询标志为False,则开启所述指定功能,所述开启指定功能用于指示DFT等待被唤醒。
可选地,所述DFT在将DBQ报文放入用于转发该DBQ报文的出接口对应的DTQ之后进一步在与该DTQ相绑定的CFT被设置的CFT唤醒标志为False,则设置该CFT唤醒标志为True,并唤醒该CFT唤醒标志为True的CFT;以及,
在所述DFT相绑定的DBQ均被遍历后,进一步针对CFT唤醒标志被设置为TRUE的CFT,唤醒该CFT,并将该CFT的CFT唤醒标志置为FALSE。
可选地,所述CFT将相绑定的DTQ中的报文放入对应的指定周期队列CSQ包括:
遍历所述CFT相绑定的DTQ,将遍历到的DTQ确定为当前DTQ,查询当前DTQ是否有报文,
如果是,遍历当前DTQ,将遍历到的报文确定为当前DTQ报文,依据当前DTQ报文携带的指定周期队列Cycle参数确定当前DTQ报文对应的目标CSQ,若目标CSQ处于SQ和RQ之间,则将当前DTQ报文放入RQ,若目标CSQ处于TQ和SQ之间,则将当前DTQ报文放入TQ,若目标CSQ处于RQ和TQ之间,则将当前DTQ报文放入目标CSQ;其中,所述RQ为所述CFT对应的队列接收指针RQP当前指向的CSQ;所述TQ为所述CFT对应的队列容忍指针TQP当前指向的CSQ;之后,在所述当前DTQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将该遍历到的报文确定为当前DTQ报文的步骤;
如果否,或者在所述当前队列中不存在未被遍历的报文,则在所述CFT相绑定的所有DTQ中还存在未被遍历的DTQ时,继续遍历未被遍历的DTQ并返回将遍历到的DTQ确定为当前DTQ。
可选地,所述CFT将相绑定的DTQ中的报文放入对应的指定周期队列CSQ是在所述SQ为空时执行的。
可选地,所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发包括:
在确定报文发送周期发生更新时,重新调整所述CFT对应的指定周期队列指针结构CSQP;所述CSQP至少包括:SQP;遍历调整后的SQP指向的SQ中的报文,将遍历到的报文确定为当前SQ报文,通过调用用于转发当前SQ报文的出接口转发当前SQ报文;之后,在SQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将该遍历到的报文确定为当前SQ报文的步骤;
在确定所述报文发送周期未发生更新时,遍历SQ中的报文,将遍历到的报文确定为当前SQ报文,通过调用用于转发当前SQ报文的出接口转发当前SQ报文;之后,在SQ中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将该遍历到的报文确定为当前SQ报文的步骤。
可选地,所述CSQP还包括接收队列指针RQP、队列容忍指针TQP;所述RQP指向作为接收队列RQ的CSQ,所述TQP指向作为队列容忍TQ的CSQ;
其中,重新调整后的SQP指向的CSQ的编号,是根据针对所述CFT设置的当前处理周期变量CFT_Jiffies与所述CFT绑定的CSQ的数量d进行模运算得到的余数确定;
重新调整后的RQP指向的CSQ的编号,是根据所述余数与指定抖动周期数Jitter之和对所述d进行模运算得到的结果确定;
重新调整后的TQP指向的CSQ的编号,是根据如下公式确定:
(d-1+Rem-Jitter)mod d;其中,Rem为所述余数。
可选地,所述CFT将相绑定的所有DTQ中的所有报文放入对应的指定周期队列CSQ之后,进一步检测所述CFT相绑定的CSQ中是否有报文需要及时转发的事件,如果是,则返回执行通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发的步骤,如果否,则等待再次被唤醒。
可选地,所述报文需要及时转发的事件依据所述CFT被设置的当前处理周期变量CFT_Jiffies和当前报文接收周期变量CFT_Rcv_Jiffies确定,当所述CFT_Jiffies的取值与所述CFT_Rcv_Jiffies的取值之差小于或等于指定差时,确定有报文需要及时转发的事件,否则,确定不存在报文需要及时转发的事件;
其中,当所述CFT被唤醒时,或者当检测出CFT相绑定的CSQ中有报文需要及时转发的事件时,所述CFT_Jiffies的取值更新为已设置的CSQF_Jiffies的当前值,所述CSQF_Jiffies用于指示基于分段路由实现指定周期排队转发周期计数;
当查询出所述当前DTQ有报文时,CFT_Rcv_Jiffies的取值更新为CFT_Jiffies的取值。
可选地,所述报文发送周期是否发生更新通过以下方式确定:
检查所述CFT被设置的当前处理周期变量CFT_Jiffies的取值和历史周期变量CFT_Prev_Jiffies的取值是否相等,如果是,确定报文发送周期未发生更新,如果否,确定报文发送周期发生更新;
当重新调整所述CFT对应的指定周期队列指针结构CSQP后,该方法进一步包括:将所述CFT_Prev_Jiffies的取值更新为所述CFT_Jiffies的当前值。
至此,完成本申请实施例提供的装置结构描述。
本申请实施例还提供了图11所示装置的硬件结构。参见图12,图12为本申请实施例提供的电子设备结构图。如图12所示,该硬件结构可包括:处理器和机器可读存储介质,机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;所述处理器用于执行机器可执行指令,以实现本申请上述示例公开的方法。
基于与上述方法同样的申请构思,本申请实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本申请上述示例公开的方法。
示例性的,上述机器可读存储介质可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体 形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备上,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (16)

  1. 一种确定性流DT传输方法,其特征在于,该方法应用于网络设备,该方法包括:
    通过本设备上已被唤醒的分发线程对与该分发线程相绑定的报文接收队列中的报文进行分发,以将所述报文接收队列中属于确定性流的报文分发至对应的确定性流缓存队列DBQ,将属于尽力而为流的报文分发至对应的尽力而为流缓存队列BTQ;所述报文接收队列中的报文是指通过所述网络设备本地接口接收到的来自外部的报文;
    通过本设备上已被唤醒的确定性转发线程DFT将与该DFT相绑定的DBQ中的报文放入对应的确定性流队列DTQ;
    通过本设备上已被唤醒的周期转发线程CFT将与该CFT相绑定的DTQ中的报文放入对应的指定周期队列CSQ,以及通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发;所述SQ为所述CFT对应的队列发送指针SQP当前指向的CSQ。
  2. 根据权利要求1所述的方法,其特征在于,所述通过所述分发线程对与该分发线程相绑定的报文接收队列中的报文进行分发包括:
    遍历与所述分发线程相绑定的报文接收队列,将遍历到的报文接收队列确定为当前队列,查询所述当前队列是否有报文;
    若当前队列有报文,则遍历当前队列,将遍历到的报文确定为当前报文,若当前报文属于确定性流,则将当前报文放入与当前队列对应的DBQ,若当前报文属于尽力而为流,则将当前报文放入与当前队列对应的BTQ;之后,在当前队列中还存在未被遍历的报文时,继续遍历该未被遍历的报文并返回将遍历到的报文确定为当前报文的步骤;
    若当前队列无报文或者当前队列中不存在未被遍历的报文,在所述分发线程相绑定的所有报文接收队列中还存在未被遍历的报文接收队列时,继续遍历所述分发线程相绑定的且未被遍历的报文接收队列,并返回将遍历到的报文接收队列确定为当前队列的步骤。
  3. 根据权利要求2所述的方法,其特征在于,所述分发线程被设对应的线程轮询标志,线程轮询标志在所述分发线程被唤醒时已被置为False;
    在查询当前队列有报文时,进一步设置所述线程轮询标志为True,以指示关闭所述分发线程被设置的指定功能;关闭所述指定功能用于指示阻止所述分发线程进入睡眠状态;
    在所述分发线程相绑定的报文接收队列均被遍历后,该方法进一步包括:
    若所述线程轮询标志为True,则设置所述线程轮询标志为False,并返回遍历与所述分发线程相绑定的报文接收队列的步骤;若所述线程轮询标志为False,则指示开启所述指定功能,所述开启指定功能用于指示所述分发线程等待被唤醒。
  4. 根据权利要求2或3所述的方法,其特征在于,所述分发线程在将所述报文接收队列中属于确定性流的报文分发至对应的DBQ时进一步包括:若与该DBQ相绑定的DFT被设置的DFT唤醒标志为False,则将该DFT唤醒标志设置为True,唤醒DFT唤醒标志为True的该DFT;和/或,
    在所述分发线程相绑定的所有报文接收队列均被遍历后,该方法进一步包括:针对DFT唤醒标志为TRUE的DFT,唤醒该DFT,并将该DFT的DFT唤醒标志置为FALSE。
  5. 根据权利要求1所述的方法,其特征在于,所述通过本设备上已被唤醒的确定性转发线程DFT将与该DFT相绑定的DBQ中的报文放入对应的确定性流队列DTQ包括:
    遍历与所述DFT相绑定的DBQ,将遍历到的DBQ确定为当前DBQ,查询当前DBQ是否有报文;
    若当前DBQ有报文,遍历当前DBQ,将遍历到的报文确定为当前DBQ报文,调 用已设置的报文重复消除和排序PREOF功能识别出当前DBQ报文不为重复报文时生成报文输出链;对所述报文输出链中的每一DBQ报文进行报文封装,将封装后的DBQ报文放入用于转发该DBQ报文的出接口对应的DTQ;之后,在当前DBQ中还存在未被遍历的报文时,继续遍历当前DBQ中未被遍历的报文并返回将该遍历到的报文确定为当前DBQ报文的步骤;
    若当前DBQ无报文或者当前DBQ中不存在未被遍历的报文时,在所述DFT相绑定的所有DBQ中还存在未被遍历的DBQ时,继续遍历该未被遍历的DBQ并返回将当前遍历到的DBQ确定为当前DBQ的步骤。
  6. 根据权利要求5所述的方法,其特征在于,所述报文输出链通过以下步骤生成:
    当通过调用所述PREOF功能识别当前DBQ报文不为乱序报文时,将当前DBQ报文放入所述报文输出链;
    当通过调用所述PREOF功能识别当前DBQ报文为乱序报文时,确定当前DBQ报文所属的业务流,若当前DBQ报文满足条件,所述条件是指当前DBQ报文与已记录的属于所述业务流且在设定时间窗口内通过调用PREOF功能处理的至少一个报文成功排序,则将当前DBQ报文、已记录的与所述当前DBQ报文成功排序的至少一个报文、以及已记录的属于所述业务流且在所述设定时间窗口之外调用PREOF功能处理的报文放入所述报文输出链;若当前DBQ报文不满足所述条件,则将已记录的属于所述业务流且在所述设定时间窗口之外调用PREOF功能处理的报文放入所述报文输出链。
  7. 根据权利要求5所述的方法,其特征在于,所述DFT被设置对应的DFT轮询标志,所述DFT轮询标志在所述DFT被唤醒时已被置为False;
    在查询当前DBQ有报文时,进一步设置所述DFT轮询标志为True,并关闭所述述DFT被设置的指定功能,关闭所述指定功能用于指示阻止所述DFT进入睡眠状态;
    在所述DFT相绑定的DBQ均被遍历后,该方法进一步包括:若所述DFT轮询标志为True,则设置所述线程轮询标志为False,并返回遍历与该被唤醒的DFT相绑定的DBQ的步骤;若所述DFT轮询标志为False,则开启所述指定功能,所述开启指定功能用于指示DFT等待被唤醒。
  8. 根据权利要求5所述的方法,其特征在于,所述DFT在将DBQ报文放入用于转发该DBQ报文的出接口对应的DTQ之后进一步包括:若与该DTQ相绑定的CFT被设置的CFT唤醒标志为False,则设置该CFT唤醒标志为True,并唤醒该CFT唤醒标志为True的CFT;
    在所述DFT相绑定的DBQ均被遍历后,该方法进一步包括:针对CFT唤醒标志被设置为TRUE的CFT,唤醒该CFT,并将该CFT的CFT唤醒标志置为FALSE。
  9. 根据权利要求1所述的方法,其特征在于,所述通过本设备上已被唤醒的周期转发线程CFT将与该CFT相绑定的DTQ中的报文放入对应的指定周期队列CSQ包括:
    遍历所述CFT相绑定的DTQ,将遍历到的DTQ确定为当前DTQ,查询当前DTQ是否有报文,
    如果是,遍历当前DTQ,将遍历到的报文确定为当前DTQ报文,依据当前DTQ报文携带的指定周期队列Cycle参数确定当前DTQ报文对应的目标CSQ,若目标CSQ处于SQ和RQ之间,则将当前DTQ报文放入RQ,若目标CSQ处于TQ和SQ之间,则将当前DTQ报文放入TQ,若目标CSQ处于RQ和TQ之间,则将当前DTQ报文放入目标CSQ;其中,所述RQ为所述CFT对应的队列接收指针RQP当前指向的CSQ;所述TQ为所述CFT对应的队列容忍指针TQP当前指向的CSQ;之后,在所述当前DTQ中还存在未被遍历的报文时,遍历该未被遍历的一个报文,返回将该遍历到的报文确定为当前DTQ报文的步骤;
    如果否,或者在所述当前队列中不存在未被遍历的报文,则在所述CFT相绑定的所有DTQ中还存在未被遍历的DTQ时,继续遍历未被遍历的一个DTQ,返回将遍历 到的DTQ确定为当前DTQ。
  10. 根据权利要求1或9所述的方法,其特征在于,所述通过本设备上已被唤醒的周期转发线程CFT将与该CFT相绑定的DTQ中的报文放入对应的指定周期队列CSQ是在所述SQ为空时执行的。
  11. 根据权利要求9所述的方法,其特征在于,所述通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发包括:
    在确定报文发送周期发生更新时,重新调整所述CFT对应的指定周期队列指针结构CSQP;所述CSQP至少包括:SQP;遍历调整后的SQP指向的SQ中的报文,将遍历到的报文确定为当前SQ报文,通过调用用于转发当前SQ报文的出接口转发当前SQ报文;之后,在SQ中还存在未被遍历的报文时,遍历该未被遍历的一个报文,返回将该遍历到的报文确定为当前SQ报文的步骤;
    在确定所述报文发送周期未发生更新时,遍历SQ中的报文,将遍历到的报文确定为当前SQ报文,通过调用用于转发当前SQ报文的出接口转发当前SQ报文;之后,在SQ中还存在未被遍历的报文时,遍历该未被遍历的一个报文,返回将该遍历到的报文确定为当前SQ报文的步骤。
  12. 根据权利要求11所述的方法,其特征在于,所述CSQP还包括接收队列指针RQP、队列容忍指针TQP;所述RQP指向作为接收队列RQ的CSQ,所述TQP指向作为队列容忍TQ的CSQ;
    其中,重新调整后的SQP指向的CSQ的编号,是根据针对所述CFT设置的当前处理周期变量CFT_Jiffies与所述CFT绑定的CSQ的数量d进行模运算得到的余数确定;
    重新调整后的RQP指向的CSQ的编号,是根据所述余数与指定抖动周期数Jitter之和对所述d进行模运算得到的结果确定;
    重新调整后的TQP指向的CSQ的编号,是根据如下公式确定:
    (d-1+Rem-Jitter)mod d;其中,Rem为所述余数。
  13. 根据权利要求9所述的方法,其特征在于,在通过本设备上已被唤醒的周期转发线程CFT将该CFT相绑定的所有DTQ中的所有报文放入对应的指定周期队列CSQ之后,该方法进一步包括:
    检测所述CFT相绑定的CSQ中是否有报文需要及时转发的事件,如果是,则返回执行通过所述CFT从发送队列SQ中选择报文并通过用于转发报文的出接口进行转发的步骤,如果否,则等待再次被唤醒。
  14. 根据权利要求11或13所述的方法,其特征在于,所述报文需要及时转发的事件依据所述CFT被设置的当前处理周期变量CFT_Jiffies和当前报文接收周期变量CFT_Rcv_Jiffies确定,当所述CFT_Jiffies的取值与所述CFT_Rcv_Jiffies的取值之差小于或等于指定差时,确定有报文需要及时转发的事件,否则,确定不存在报文需要及时转发的事件;
    其中,当所述CFT被唤醒时,或者当检测出CFT相绑定的CSQ中有报文需要及时转发的事件时,所述CFT_Jiffies的取值更新为已设置的CSQF_Jiffies的当前值,所述CSQF_Jiffies用于指示基于分段路由实现指定周期排队转发周期计数;
    当查询出所述当前DTQ有报文时,CFT_Rcv_Jiffies的取值更新为CFT_Jiffies的取值。
  15. 根据权利要求11所述的方法,其特征在于,所述报文发送周期是否发生更新通过以下方式确定:
    检查所述CFT被设置的当前处理周期变量CFT_Jiffies的取值和历史周期变量CFT_Prev_Jiffies的取值是否相等,如果是,确定报文发送周期未发生更新,如果否,确定报文发送周期发生更新;
    当重新调整所述CFT对应的指定周期队列指针结构CSQP后,该方法进一步包括: 将所述CFT_Prev_Jiffies的取值更新为所述CFT_Jiffies的当前值。
  16. 一种电子设备,其特征在于,该电子设备包括:处理器和机器可读存储介质;
    所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;
    所述处理器用于执行机器可执行指令,以实现权利要求1-15任一项的方法步骤。
PCT/CN2021/138338 2021-12-15 2021-12-15 确定性流传输方法及装置 Ceased WO2023108479A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
PCT/CN2021/138338 WO2023108479A1 (zh) 2021-12-15 2021-12-15 确定性流传输方法及装置
EP21967616.0A EP4336796A4 (en) 2021-12-15 2021-12-15 DETERMINISTIC TRAFFIC TRANSMISSION METHOD AND APPARATUS
JP2023574657A JP7752189B2 (ja) 2021-12-15 2021-12-15 決定論的フロー伝送方法および装置
US18/569,822 US20240275728A1 (en) 2021-12-15 2021-12-15 Method and apparatus for transmitting detnet flow
CN202180003976.2A CN116615899A (zh) 2021-12-15 2021-12-15 确定性流传输方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/138338 WO2023108479A1 (zh) 2021-12-15 2021-12-15 确定性流传输方法及装置

Publications (1)

Publication Number Publication Date
WO2023108479A1 true WO2023108479A1 (zh) 2023-06-22

Family

ID=86775009

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/138338 Ceased WO2023108479A1 (zh) 2021-12-15 2021-12-15 确定性流传输方法及装置

Country Status (5)

Country Link
US (1) US20240275728A1 (zh)
EP (1) EP4336796A4 (zh)
JP (1) JP7752189B2 (zh)
CN (1) CN116615899A (zh)
WO (1) WO2023108479A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119948850A (zh) * 2023-09-05 2025-05-06 新华三技术有限公司 一种数据包传输方法及网络设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20240160468A1 (en) * 2021-03-18 2024-05-16 Nippon Telegraph And Telephone Corporation Server delay control device, server delay control method, and program
US20230116614A1 (en) * 2022-11-09 2023-04-13 Intel Corporation Deterministic networking node
CN119948843B (zh) * 2023-09-05 2025-11-25 新华三技术有限公司 确定性流传输方法、装置及网络节点
CN117155883B (zh) * 2023-10-31 2024-01-30 国网湖北省电力有限公司电力科学研究院 一种实现报文定时发送的tsn网卡装置、方法及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202685A (zh) * 2017-11-06 2021-01-08 华为技术有限公司 报文转发方法、转发设备和网络设备
US20210014177A1 (en) * 2020-09-26 2021-01-14 Intel Corporation Deterministic packet scheduling and dma for time sensitive networking
CN113411270A (zh) * 2021-06-07 2021-09-17 中国人民解放军国防科技大学 一种面向时间敏感网络的报文缓冲区管理方法
CN113785538A (zh) * 2019-05-03 2021-12-10 微芯片技术股份有限公司 用于时间敏感型和尽力服务型数据分组的介质访问及相关系统、方法和设备

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100490421C (zh) * 2004-10-20 2009-05-20 华为技术有限公司 Mpls环网中实现流量公平传送的方法
US9641351B2 (en) * 2014-12-18 2017-05-02 Cisco Technology, Inc. Jitter removal in deterministic networks
CN106612236B (zh) * 2015-10-21 2020-02-07 深圳市中兴微电子技术有限公司 众核网络处理器及其微引擎的报文调度方法、系统
KR102748588B1 (ko) * 2018-09-21 2025-01-02 텔레호낙티에볼라게트 엘엠 에릭슨(피유비엘) 무선 액세스 네트워크들에서 리소스들을 스케줄링하기 위한 방법들 및 장치들
US11743174B2 (en) * 2019-01-29 2023-08-29 Cisco Technology, Inc. Supporting asynchronous packet operations in a deterministic network
EP3981133B1 (en) * 2019-07-22 2024-09-25 Huawei Technologies Co., Ltd. Control device, switch device, methods and computer-readable storage medium
US11463370B2 (en) * 2020-02-12 2022-10-04 Nokia Solutions And Networks Oy Scalable deterministic services in packet networks
CN113382442B (zh) * 2020-03-09 2023-01-13 中国移动通信有限公司研究院 报文传输方法、装置、网络节点及存储介质
US12255973B2 (en) * 2020-09-10 2025-03-18 Fisher-Rosemount Systems, Inc. Highly-versatile field devices and communication networks for use in control and automation systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202685A (zh) * 2017-11-06 2021-01-08 华为技术有限公司 报文转发方法、转发设备和网络设备
CN113785538A (zh) * 2019-05-03 2021-12-10 微芯片技术股份有限公司 用于时间敏感型和尽力服务型数据分组的介质访问及相关系统、方法和设备
US20210014177A1 (en) * 2020-09-26 2021-01-14 Intel Corporation Deterministic packet scheduling and dma for time sensitive networking
CN113411270A (zh) * 2021-06-07 2021-09-17 中国人民解放军国防科技大学 一种面向时间敏感网络的报文缓冲区管理方法

Non-Patent Citations (1)

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

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119948850A (zh) * 2023-09-05 2025-05-06 新华三技术有限公司 一种数据包传输方法及网络设备

Also Published As

Publication number Publication date
CN116615899A (zh) 2023-08-18
US20240275728A1 (en) 2024-08-15
EP4336796A1 (en) 2024-03-13
EP4336796A4 (en) 2024-06-26
JP2024520146A (ja) 2024-05-21
JP7752189B2 (ja) 2025-10-09

Similar Documents

Publication Publication Date Title
WO2023108479A1 (zh) 确定性流传输方法及装置
US8830829B2 (en) Parallel processing using multi-core processor
US8565092B2 (en) Dynamic flow redistribution for head of line blocking avoidance
CN116686272B (zh) 一种报文传输方法及网络设备
US20230254263A1 (en) Packet forwarding method, packet forwarding apparatus and electronic device
US20180227247A1 (en) Early queueing network device
KR102177574B1 (ko) 컴퓨팅 디바이스에서 패킷 수명을 예측하기 위한 큐잉 시스템
US11516145B2 (en) Packet control method, flow table update method, and node device
TW200920035A (en) Enhancement of end-to-end network QoS
US8953625B2 (en) Applying backpressure to a subset of nodes in a deficit weighted round robin scheduler
CN107454014A (zh) 一种优先级队列调度的方法及装置
CN103685062A (zh) 缓存管理方法及装置
US8879578B2 (en) Reducing store and forward delay in distributed systems
WO2016150020A1 (zh) 基于调度流标识的报文调度方法和装置
WO2021120764A1 (zh) 一种收发数据的方法及装置
WO2019109902A1 (zh) 队列调度方法及装置、通信设备、存储介质
CN117793583A (zh) 报文转发方法、装置、电子设备及计算机可读存储介质
EP4425897A1 (en) Deterministic flow transmission method and apparatus, and electronic device
CN119484418A (zh) 基于时间基准的同步和异步融合的流量整形方法和装置
CN121217661A (zh) 通信方法及装置

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202180003976.2

Country of ref document: CN

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

Ref document number: 21967616

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2023574657

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 2021967616

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2021967616

Country of ref document: EP

Effective date: 20231205

WWE Wipo information: entry into national phase

Ref document number: 18569822

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE