Patent Description:
Deterministic networking (deterministic networking, DetNet) can provide a highly reliable path for an application. The deterministic networking can provide a bounded latency guarantee and ensure an ultra low packet loss rate. The bounded latency guarantee means that in an end-to-end packet forwarding process, a packet forwarding latency is within a fixed and required range. In other words, the packet forwarding latency needs to be within the latency range. A bounded latency is implemented by using end-to-end reserved bandwidth resources and a queue management algorithm. Cyclic queuing and forwarding (cyclic queuing and forwarding, CQF) is a queue management method that is applied to the deterministic networking in a prior art. According to a core of the CQF technology, a packet is sent in a cycle time (cycle time) of a node on a forwarding path, is received in a same cycle time of a next-hop node of the node, and is sent in a next cycle time of the next-hop node. Therefore, a maximum latency per hop is one cycle time, and a maximum end-to-end latency is (N + <NUM>) x cycle time, where N is a quantity of intermediate nodes on the forwarding path that the packet passes through. However, because there is a link latency, the packet may be sent in an nth cycle time of a node, and may be received in an (n + <NUM>)th cycle time of a next-hop node. Therefore, by using the CQF, a deterministic latency guarantee cannot be accurately implemented during packet forwarding. An example of method for packet forwarding with latency guarantee is described in document "Ultra-low latency (ULL) networks: The IEEE TSN and IETF DetNet standards and related <NUM> Ull research" from A.

This application provides a packet sending method, a network node, and a system, to accurately implement a latency guarantee during packet forwarding.

As an example, the application describes a packet sending method.

The method includes: obtaining, by a controller, a forwarding latency requirement of a service flow and a destination address of the service flow, and determining, based on the forwarding latency requirement and the destination address, a forwarding path for forwarding the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow, the forwarding path passes through a first network node and a second network node, the first network node is an ingress node on the forwarding path, and the second network node is an intermediate node on the forwarding path; determining, by the controller, a number of a first cycle time in which the first network node forwards a packet and a number of a second cycle time in which the second network node forwards the packet, where the packet is a packet in the service flow; generating, by the controller, a first entry and a second entry, where the first entry includes a correspondence between a sequence number of the packet and the first cycle time number, and the second entry includes a correspondence between the sequence number of the packet and the second cycle time number; sending, by the controller, the first entry to the first network node, where the first entry is used to indicate the first network node to send the packet in a time period corresponding to the first cycle time number; and sending, by the controller, the second entry to the second network node, where the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.

According to the foregoing technical solution, the controller determines the forwarding path based on the forwarding latency requirement of the service flow, and separately determines a cycle time number corresponding to a forwarding time point of the ingress node on the forwarding path and a cycle time number corresponding to a forwarding time point of the intermediate node on the forwarding path. Then, the controller sends, to the ingress node and the intermediate node on the forwarding path, a cycle time number, including a packet sequence number, corresponding to a packet sending time point. In this way, the ingress node and the intermediate node on the forwarding path may send a packet corresponding to the sequence number in a time period corresponding to a corresponding cycle time number, to implement a deterministic latency guarantee during packet forwarding.

In a possible design, the controller obtains a node latency of the first network node and a node latency of the second network node, and the node latency includes a packet processing latency and a packet sending latency. The controller obtains a link latency of a link on the forwarding path. That the latency of the forwarding path meets a forwarding latency requirement of the packet includes: a sum of the node latency of the first network node, the node latency of the second network node, and the link latency of the link on the forwarding path falls within a range of the forwarding latency requirement of the packet.

In a possible design, the controller obtains duration of a cycle time of the first network node and duration of a cycle time of the second network node. The controller obtains a third cycle time number of the first network node and a fourth cycle time number of the second network node that correspond to a current time of the controller. The controller determines the first cycle time number based on the duration of the cycle time of the first network node and the third cycle time number. The controller determines the second cycle time number based on the duration of the cycle time of the first network node, a latency of a link from the first network node to the second network node, the packet processing latency of the second network node, the fourth cycle time number, and the duration of the cycle time of the second network node.

In a possible design, the controller determines a first adjacent segment identifier of the first network node and a second adjacency segment identifier of the second network node. The controller generates a label stack, and the label stack includes the first adjacency segment identifier and the second adjacency segment identifier. The controller sends the label to the first network node, and the label stack is used to indicate the first network node to forward the packet through the forwarding path.

In a possible design, the controller sends information about the forwarding path to the first network node, to trigger the first network node to generate, based on the information about the forwarding path, a label switched path corresponding to the forwarding path. The label switched path is used to forward the packet.

In a possible design, the first entry and the second entry each further include a flow identifier of the service flow.

As an example, the application describes a packet sending method. The method includes: obtaining, by a first network node, a forwarding latency requirement of a service flow and a destination address of the service flow; obtaining, by the first network node based on the forwarding latency requirement and the destination address of the service flow, a forwarding path for forwarding the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow, the first network node is an ingress node on the forwarding path, and a second network node is an intermediate node on the forwarding path; obtaining, by the first network node, a first entry, where the first entry includes a correspondence between a sequence number of a packet and a number of a first cycle time in which the first network node forwards the packet, and the packet is a packet in the service flow; and sending, by the first network node based on the first entry, the packet to the second network node in a time period corresponding to the cycle time number.

According to this technical solution, the first network node obtains, based on the forwarding latency requirement and the destination address of the service flow, the forwarding path for forwarding the service flow, and obtains the entry including the correspondence between the sequence number of the packet and the number of the first cycle time in which the first network node forwards the packet. Then, the first network node sends the packet corresponding to the sequence number to a next hop of the first network node in a time period corresponding to the first cycle time number, so that the first network node sends the packet externally at a determined time point, to implement a deterministic latency guarantee during packet forwarding.

In a possible design, the obtaining, by the first network node based on the forwarding latency requirement and the destination address of the service flow, a forwarding path for forwarding the service flow includes: calculating, by the first network node, the forwarding path based on the forwarding latency requirement and the destination address of the service flow.

In a possible design, the first network node generates a second entry, and the second entry includes a correspondence between the sequence number of the packet and a number of a second cycle time in which the second network node forwards the packet. The first network node sends the second entry to the second network node, and the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.

In a possible design, the obtaining, by the first network node based on the forwarding latency requirement and the destination address of the service flow, a forwarding path for forwarding the service flow includes: sending, by the first network node, the forwarding latency requirement and the destination address to a controller, to trigger the controller to determine the forwarding path based on the forwarding latency requirement and the destination address, and generate the first entry; and receiving, by the first network node, the first entry and information about the forwarding path that are sent by the controller.

In a possible design, the first network node obtains a second entry from the controller, and the second entry includes a correspondence between the sequence number of the packet and a number of a second cycle time in which the second network node forwards the packet. The first network node sends the second entry to the second network node, and the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.

In a possible design, the information about the forwarding path includes address information of a node on the forwarding path. The method further includes: generating through triggering based on the address information of the node on the forwarding path, by the first network node, a label switched path corresponding to the forwarding path, where the label switched path is used to forward the packet.

In a possible design, the information about the forwarding path is a label stack corresponding to the forwarding path, the label stack includes an adjacency segment identifier of the first network node and an adjacency segment identifier of the second network node, and the label stack is used to indicate the first network node to forward the packet through the forwarding path.

In a possible design, the sending, by the first network node based on the first entry, the packet to the second network node in a time period corresponding to the cycle time number includes:
adding, by the first network node after the first network node matches the first entry based on the sequence number of the packet, the packet to a packet queue corresponding to the cycle time number, and sending the packet to the second network node when the packet queue is a sending queue.

In a possible design, the first network node receives a node latency of the second network node, where the node latency includes a packet processing latency and a packet sending latency;.

In a possible design, the first network node determines duration of a cycle time of the first network node, and obtains duration of a cycle time of the second network node;.

According to a third aspect, an embodiment of the present invention provides a packet sending method. The method includes: obtaining, by a second network node, an entry including a correspondence between a sequence number and a cycle time number, where the sequence number is a packet sequence number, and the cycle time number is used to indicate the second network node to send, in a time period corresponding to the cycle time number, a packet corresponding to the sequence number; receiving, by the second network node, a packet sent by a first network node, where the packet includes a flow identifier and the sequence number; and after matching the entry based on a sequence number included in the packet, sending, by the second network node, the packet to a next-hop network node of the second network node in a time period corresponding to the cycle time number.

According to this solution, an intermediate node on a forwarding path matches the entry based on the sequence number of the packet, and then sends the packet to the next-hop network node in the time period corresponding to the cycle time number included in the entry, so that the intermediate node on the forwarding path sends the packet externally at a determined time point, to implement a deterministic latency guarantee during packet forwarding.

In a possible design, the obtaining, by a second network node, an entry including a correspondence between a sequence number and a cycle time number includes: receiving, by the second network node, the entry sent by the first network node; or
receiving, by the second network node, the forwarding entry sent by a controller.

In a possible design, the sending, by the second network node, the packet to a next-hop network node of the second network node in a time period corresponding to the cycle time number includes: adding, by the second network node, the packet to a packet queue corresponding to the cycle time number, and sending the packet to the next-hop network node of the second network node when the packet queue is a sending queue.

According to a fourth aspect, an embodiment of the present invention provides a controller, to perform the method in the first aspect or any one of the possible implementations of the first aspect. Specifically, the controller includes a unit configured to perform the method in the first aspect or any one of the possible implementations of the first aspect.

According to a fifth aspect, an embodiment of the present invention provides a first network node, to perform the method in the second aspect or any one of the possible implementations of the second aspect. Specifically, the first network node includes a unit configured to perform the method in the second aspect or any one of the possible implementations of the second aspect.

According to a sixth aspect, an embodiment of the present invention provides a second network node, to perform the method in the third aspect or any one of the possible implementations of the third aspect. Specifically, the second network node includes a unit configured to perform the method in the third aspect or any one of the possible implementations of the third aspect.

According to a seventh aspect, a controller is provided. The controller includes a processor, a network interface, and a memory. The memory may be configured to store program code. The processor is configured to invoke the program code in the memory to perform the method in the first aspect or any one of the possible implementations of the first aspect. For details, refer to detailed descriptions in the method example.

According to an eighth aspect, a first network node is provided. The first network node includes a processor, a network interface, and a memory. The memory may be configured to store program code. The processor is configured to invoke the program code in the memory to perform the method in the second aspect or any one of the possible implementations of the second aspect. For details, refer to detailed descriptions in the method example.

According to a ninth aspect, a second network node is provided. The second network node includes a processor, a network interface, and a memory. The memory may be configured to store program code. The processor is configured to invoke the program code in the memory to perform the method in the third aspect or any one of the possible implementations of the third aspect. For details, refer to detailed descriptions in the method example.

According to a tenth aspect, a packet sending system is provided. The system includes the controller, the first network node, and the second network node provided in the foregoing aspects.

According to an eleventh aspect, a packet sending system is provided. The system includes the first network node and the second network node provided in the foregoing aspects.

According to a twelfth aspect, a computer storage medium is provided. The computer storage medium is configured to store a computer software instruction used by the foregoing network node or a controller, and the computer software instruction includes a program designed to perform the foregoing aspects.

According to a thirteenth aspect, a computer program product is provided. The computer program product includes an instruction, and when the instruction is run on a computer, the computer is enabled to perform the method in the foregoing aspects.

The following describes the embodiments of the present invention with reference to accompanying drawings.

CQF is a queue management method that uses two queues to alternately send a packet. Each network node has an independent time period for sending the packet. Sufficient bandwidth is ensured for packets in a same time period through resource reservation, and packets in different time periods are isolated. The packet has a deterministic latency when being forwarded by each network node. As shown in <FIG>, each network node has two packet queues: a packet receiving queue and a packet sending queue. The packet receiving queue is used to receive a packet sent by a previous-hop network node to a current network node. The packet sending queue is used to send a buffered packet to a next-hop network node. The packet receiving queue and the packet sending queue may be interchangeable. When the packet receiving queue is changed into the packet sending queue, a packet received by the packet receiving queue is sent to the next-hop network node. Each network node has a clock. After a fixed-duration time period, the packet receiving queue and the packet sending queue are interchanged. In other words, the packet receiving queue is changed into the packet sending queue, and the packet sending queue is changed into the packet receiving queue. The fixed-duration time period is defined as a cycle time, which is referred to as a cycle for short. The network node records a time period in cycles. Cycle duration of each network node is the same, and a start time point and an end time point of cycles of different network nodes need to be the same. The packet receiving queue and the packet sending queue are interchanged at an interval of a cycle.

Referring to <FIG> is a schematic diagram in which a network node uses CQF to forward a packet. In a cycle <NUM>, a packet sending queue of a node <NUM> sends the packet to a packet receiving queue of a node <NUM>. When the cycle <NUM> is changed into a cycle <NUM>, the packet receiving queue of the node <NUM> is changed into a packet sending queue. In the cycle <NUM>, the packet sending queue of the node <NUM> sends the packet to a packet receiving queue of a node <NUM>. In a process in which the packet is forwarded from the node <NUM> to the node <NUM>, a maximum packet forwarding latency is (N + <NUM>) x cycle, where N is a quantity of intermediate nodes on a forwarding path. In a scenario shown in <FIG>, a packet forwarding latency of forwarding the packet from the node <NUM> to the node <NUM> is <NUM> x cycle. Because impact of a link between nodes is not considered in a process of calculating the packet forwarding latency, a maximum packet forwarding latency obtained in this manner is inaccurate. For example, the packet is forwarded by the node <NUM> to the node <NUM> in the cycle <NUM>. However, if a latency of a link between the node <NUM> and the node <NUM> is greater than duration of one cycle, it cannot be ensured that the packet is forwarded to the node <NUM> in the cycle <NUM>. Therefore, by using the CQF, a deterministic latency guarantee cannot be accurately implemented during packet forwarding.

<FIG> is a schematic diagram of a network scenario of a packet sending method according to an embodiment of the present invention. The application scenario includes a controller <NUM>, a transmit end <NUM>, a receive end <NUM>, a network node <NUM>, a network node <NUM>, a network node <NUM>, and a network node <NUM>. The controller <NUM> is a controller in a software-defined networking (software defined network, SDN) architecture, and is configured to implement traffic control and manage a node in a network. In the scenario shown in <FIG>, the controller <NUM> controls and manages the network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM>. In a possible implementation, a network in which the network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM> are located is a segment routing (segment routing, SR) network. The network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM> separately support an SR function. In another possible implementation, a network in which the network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM> are located is a multiprotocol label switching (mutiprotocol label switching, MPLS) network. The network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM> separately support MPLS forwarding. The transmit end <NUM> and the receive end <NUM> may be user devices, for example, a mobile phone or a personal computer. A link from the network node <NUM> to the network node <NUM> is a link <NUM>, a link from the network node <NUM> to the network node <NUM> is a link <NUM>, a link from the network node <NUM> to the network node <NUM> is a link <NUM>, and a link from the network node <NUM> to the network node <NUM> is a link <NUM>. In this embodiment of the present invention, the network node may be a specific network device, for example, a router or a switch.

With reference to the network scenario shown in <FIG>, referring to <FIG>, an embodiment of the present invention provides a packet sending method.

S301: A controller receives a node latency of a network node and a link latency in a network. The node latency includes a packet processing latency and a packet sending latency of the node. The packet sending latency may also be referred to as a packet dequeuing latency. For example, the controller <NUM> separately receives a node latency of the network node <NUM>, the network node <NUM>, the network node <NUM>, and the network node <NUM>. The link latency includes a latency between network nodes in the network, for example, latencies of the link <NUM>, the link <NUM>, the link <NUM>, and the link <NUM> in <FIG>.

In an example, the packet processing latency of the network node is an average processing latency or a maximum processing latency of processed packets. The packet sending latency is an average sending latency or a maximum sending latency of packets sent by the network node. The link latency of the link <NUM> is an average forwarding latency or a maximum forwarding latency for forwarding a packet from the network node <NUM> to the network node <NUM>. The link latency of the link <NUM> is an average forwarding latency or a maximum forwarding latency for forwarding a packet from the network node <NUM> to the network node <NUM>. The link latency of the link <NUM> is an average forwarding latency or a maximum forwarding latency for forwarding a packet from the network node <NUM> to the network node <NUM>. The link latency of the link <NUM> is an average forwarding latency or a maximum forwarding latency for forwarding a packet from the network node <NUM> to the network node <NUM>.

S302: The controller obtains a forwarding latency requirement of a service flow and a destination address of the service flow. The service flow is a service flow that needs to be forwarded through a network managed by the controller. In the scenario shown in <FIG>, a packet in the service flow needs to be forwarded through the network controlled and managed by the controller.

In an example, the forwarding latency requirement and the destination address of the service flow may be sent by an ingress node in the SR network to the controller. As shown in <FIG>, the network node <NUM> sends, to the controller <NUM>, the latency requirement and the destination address, of the service flow, required to be forwarded.

In an example, the forwarding latency requirement and the destination address of the service flow may be sent by the access end <NUM> to the controller. When the access end <NUM> needs to send the service flow through the network managed by the controller, the access end <NUM> sends the forwarding latency requirement and the destination address of the service flow to the controller.

In an example, the forwarding latency requirement of the service flow may be a latency range. For example, the latency requirement is that a packet forwarding latency ranges from <NUM> milliseconds (ms) to <NUM>. Alternatively, the forwarding latency requirement is a specific latency. For example, the forwarding latency is <NUM>.

S303: The controller calculates a forwarding path based on the destination address of the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow. The forwarding path includes an ingress node, an intermediate node, and an egress node. The latency of the forwarding path includes a node latency of the ingress node on the forwarding path, a node latency of the intermediate node on the forwarding path, and a link latency of a link from the ingress node to the egress node.

With reference to <FIG>, for example, the destination address of the service flow is an address of the receive end <NUM>, and the controller <NUM> calculates a forwarding path in the SR network based on the destination address. There are two paths that may reach the receive end <NUM>: a path <NUM> and a path <NUM>. The path <NUM> passes through the network node <NUM>, the network node <NUM>, and the network node <NUM>. The path <NUM> passes through the network node <NUM>, the network node <NUM>, and the network node <NUM>. If a latency of the path <NUM> meets the forwarding latency requirement of the service flow, and a latency of the path <NUM> does not meet the forwarding latency requirement of the service flow, the controller selects the path <NUM> as the forwarding path for forwarding the service flow. An ingress node on the path <NUM> is the network node <NUM>, an intermediate node on the path <NUM> is the network node <NUM>, and an egress node on the path <NUM> is the network node <NUM>.

S304: The controller obtains duration of a cycle time of the ingress node on the forwarding path and a cycle time number of the ingress node at a current time point of the controller. In this embodiment of this application, the duration of the cycle time is a time length occupied by the cycle time. For example, the duration of the cycle time is <NUM> millisecond (ms).

S305: The controller obtains duration of a cycle time of the intermediate node on the forwarding path and a cycle time number of the intermediate node at the current time point of the controller. There may be one or more intermediate nodes. The current time point of the controller is a time point at which the controller obtains the cycle time number of the intermediate node.

In this embodiment of this application, duration of a cycle time of each network node may be different or may be the same. The cycle time is a unit of process scheduling of the network node. A packet in a queue is sent within one cycle time. The cycle time of each network node is numbered from a time point at which the network node is started, and increases in ascending order. It can be seen that, in this embodiment of the present invention, the duration of the cycle time of each network node may be the same or different, and a start time point and an end time point of the cycle time of each network node may also be different. This avoids configuration complexity of the network node, simplifies device management, and improves packet forwarding efficiency.

With reference to <FIG>, for example, the controller separately obtains duration of a cycle time of the network node <NUM> and duration of a cycle time of the network node <NUM>. The duration of the cycle time of the network node <NUM> is first duration, for example, <NUM> milliseconds (ms). The duration of the cycle time of the network node <NUM> is second duration, for example, <NUM>. A current cycle time number of the network node <NUM> is a first number, for example, <NUM>. A current cycle time number of the network node <NUM> is a second number, for example, <NUM>.

S306: The controller determines a number of a cycle time in which the ingress node sends a packet, and determines a number of a cycle time in which the intermediate node sends the packet, where the packet belongs to the service flow. Optionally, the packet may be the first packet in the service flow, or may be any packet in the service flow.

After obtaining the current cycle time number and the duration of the cycle time that are of the ingress node, the controller may select a time point to send the packet by the ingress node, and determine a cycle time number corresponding to the time point. For example, the current cycle time number of the ingress node is k, for example, k= <NUM><NUM>. The duration of the cycle time is m, for example, m=<NUM>. The controller selects to wait for t seconds and then enables the ingress node to start to send the packet, for example, t=<NUM> seconds. In this case, the number L corresponding to the cycle time in which the packet is sent is calculated according to the following formula: <MAT>.

To be specific, L = <NUM> + <NUM> x <NUM>/<NUM> = <NUM>.

The controller may calculate, based on a time point at which the time period t is calculated and a time point of the controller at which the ingress node forwards the packet, to obtain a needed value in the formula.

After determining the cycle time number of the ingress node, the controller determines the cycle time number of the intermediate node. The controller determines a cycle time number of the first intermediate node on the forwarding path. The first intermediate node is a next-hop node of the ingress node. As shown in <FIG>, the node <NUM> is an ingress node, and the node <NUM> is a next-hop node of the node <NUM>. The controller calculates the cycle time number of the first intermediate node in the following manner.

Duration t before the packet enqueues at the intermediate node is calculated according to the following formula: <MAT> where.

A number of a cycle time in which the packet enqueues at the intermediate node at a latest time point is calculated based on the duration t before the packet enqueues at the intermediate node.

The current cycle time number of the intermediate node is a, for example, a=<NUM>. The duration of the cycle time is m, for example, m=<NUM>. The calculated latest enqueuing duration t at the intermediate node is <NUM> seconds. In this case, a number B corresponding to a cycle time in which the intermediate node sends the packet is calculated according to the following formula: <MAT>.

The controller calculates a cycle time number of an intermediate node (non-first intermediate node) other than the first intermediate node in the following manner.

Duration t before the packet enqueues at the non-first intermediate node is calculated according to the following formula: <MAT> where.

S307: The controller generates a first entry and a second entry, where the first entry includes a correspondence between a sequence number of the packet and a first cycle time number, and the second entry includes a correspondence between the sequence number of the packet and a second cycle time number.

In a possible design, the first entry and the second entry each include a flow identifier of the service flow. The flow identifier may be a quintuple or a flow label (flow label, FL) of the packet. The quintuple of the packet includes a source internet protocol (Internet Protocol, IP) address, a source port, a destination IP address, a destination port, and a transport layer protocol number of the packet. Correspondingly, the first entry includes the flow identifier of the service flow, the sequence number of the packet, and the first cycle time number. The second entry includes the flow identifier of the service flow, the sequence number of the packet, and the second cycle time number.

In an example, the first entry and the second entry each may include a plurality of correspondences. As shown in <FIG>, the first entry and the second entry each include three fields: a flow identifier (Flow ID), a sequence number (Sequence Num), and a cycle number (Cycle Num). The first entry includes three correspondences: a correspondence between a flow identifier Flow <NUM>, a packet sequence number <NUM>, and a cycle number Cycle <NUM>; a correspondence between the flow identifier Flow <NUM>, a packet sequence number <NUM>, and a cycle number Cycle <NUM>; and a correspondence between the flow identifier Flow <NUM>, a packet sequence number <NUM>, and a cycle number Cycle <NUM>. The second entry includes three correspondences: a correspondence between the flow identifier Flow <NUM>, the packet sequence number <NUM>, and the cycle number Cycle <NUM>; a correspondence between the flow identifier Flow <NUM>, the packet sequence number <NUM>, and the cycle number Cycle <NUM>; and a correspondence between the flow identifier Flow <NUM>, the packet sequence number <NUM>, and a cycle number Cycle <NUM>.

S308: The controller sends the first entry and information about the forwarding path to a first network node, where the first entry is used to indicate the first network node to send the packet in a time period corresponding to the first cycle time number.

S309: The controller sends the second entry to a second network node, where the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.

In an example, the first network node and the second network node each support an SR function. The information about the forwarding path is a label stack, and the label stack includes a first adjacency segment identifier of the first network node and a second adjacency segment identifier of the second network node. The label stack is used to indicate the first network node to forward the packet through the forwarding path.

In an example, the information about the forwarding path includes an address of a network node on the forwarding path. The path information is used to trigger the first network node to generate, based on the information about the forwarding path, a label switched path (label switching path, LSP) corresponding to the forwarding path. The label switched path is used to forward the packet. For example, the first network node uses, based on the address of the network node on the path, RSVP or MPLS to generate, through triggering, the LSP corresponding to the forwarding path.

S310: The ingress node receives the first entry and the information about the forwarding path that are sent by the controller. The ingress node forwards the packet in the service flow based on the correspondence in the first entry.

For example, the ingress node determines, based on the first entry shown in <FIG>, that a packet whose sequence number is <NUM> in a service flow whose corresponding service flow identifier is Flow <NUM> needs to be forwarded in a cycle time whose number is Cycle <NUM>. After determining the number of the cycle time in which the service packet is sent, the ingress node adds the packet to a packet queue corresponding to the cycle time number. The packet queue is a packet receiving queue. When the packet queue is changed into a packet sending queue, the ingress node forwards the packet to the intermediate node. Based on the first entry shown in <FIG>, the ingress node forwards a packet whose packet sequence number is <NUM> in the service flow in a cycle time whose number is Cycle <NUM>, and forwards a packet whose packet sequence number is <NUM> in the service flow in a cycle time whose number is Cycle <NUM>. Based on the second entry shown in <FIG>, the intermediate node forwards the packet whose packet sequence number is <NUM> in the service flow in the cycle time whose number is Cycle <NUM>, forwards the packet whose packet sequence number is <NUM> in the service flow in the cycle time whose number is Cycle <NUM>, and forwards the packet whose packet sequence number is <NUM> in the service flow in a cycle time whose number is Cycle <NUM>.

In an example, the ingress node may determine, based on the first entry, a number of a cycle time in which a packer that is after the packet whose packet sequence number is <NUM> is forwarded. The cycle time number is an arithmetic progression whose tolerance is <NUM> and whose first item is cycle <NUM>. For example, the ingress node determines that a number of a cycle time in which a to-be-forwarded packet whose packet sequence number is <NUM> is Cycle <NUM> + <NUM>, namely. Cycle <NUM>. The ingress node determines that a number of a cycle time in which a to-be-forwarded packet whose packet sequence number is <NUM> is Cycle <NUM>. Based on a same manner, the intermediate node may determine, based on the second entry, a number of a cycle time in which a packer that is after the packet whose packet sequence number is <NUM> is forwarded. The cycle time number is an arithmetic progression whose tolerance is <NUM> and whose first item is Cycle <NUM>.

In an example, the information about the forwarding path includes the address of the network node on the forwarding path. The first network node generates, based on the information about the forwarding path, the LSP corresponding to the forwarding path, and forwards the packet in the service flow through the label switched path.

In an example, before forwarding a packet based on the first entry shown in <FIG>, the ingress node adds, to the label stack or an inlabel (inlabel) corresponding to the forwarding path, a header of the packet whose sequence number is <NUM> in the service flow whose service flow identifier is Flow <NUM>.

In an example, after the ingress node adds the packet to the packet queue corresponding to the cycle time, when the packet queue is the sending queue, the ingress node forwards the packet to the intermediate node by using the sending queue.

With reference to the network scenario shown in <FIG>, referring to <FIG>, an embodiment of the present invention provides a packet sending method. When the method is applied to the network scenario shown in <FIG>, the network scenario may include a controller <NUM>, or may not include the controller <NUM>.

S501: A first network node obtains a forwarding latency requirement of a service flow and a destination address of the service flow, where the first network node is an ingress node on a forwarding path, for example, the ingress node in the embodiment shown in <FIG>.

S502: The first network node obtains, based on the forwarding latency requirement and the destination address of the service flow, the forwarding path for forwarding the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow, the first network node is the ingress node on the forwarding path, and a second network node is an intermediate node on the forwarding path.

S503: The first network node obtains a first entry, where the first entry includes a correspondence between a sequence number of a packet and a number of a first cycle time in which the first network node forwards the packet, and the packet is a packet in the service flow. For example, the intermediate node in the embodiment shown in <FIG>.

S504: The second network node obtains a second entry including a correspondence between a sequence number and a cycle time number, where the sequence number is a packet sequence number, and the cycle time number is used to indicate the second network node to send, in a time period corresponding to the cycle time number, a packet corresponding to the sequence number.

S505: The first network node sends the packet to the second network node based on the first entry in a time period corresponding to the cycle time number.

S506: The second network node receives the packet sent by the first network node, where the packet includes a flow identifier and the sequence number.

In this embodiment of this application, step S505 may be performed before step S504, or may be performed after step S504. A sequence of the two steps is not limited in this embodiment of this application.

S507: After matching the second entry based on the sequence number included in the packet, the second network node sends the packet to a next-hop network node of the second network node in a time period corresponding to the cycle time number included in the second entry.

In an example, the first network node may perform the steps performed by the ingress node in the embodiment shown in <FIG>. For detailed descriptions of the steps, refer to the embodiment shown in <FIG>. The second network node may perform the steps performed by the intermediate node in the embodiment shown in <FIG>. For detailed descriptions of the steps, refer to <FIG>.

In an example, that the second network node obtains the entry including the correspondence between a sequence number and a cycle time number includes: the second network node receives the entry sent by the first network node; or
the second network node receives the forwarding entry sent by the controller.

In an example, that the second network node sends the packet to the next-hop network node of the second network node in the time period corresponding to the cycle time number includes: the second network node adds the packet to a packet queue corresponding to the cycle time number, and sends the packet to the next-hop network node of the second network node when the packet queue is a sending queue.

In an example, that the first network node obtains, based on the forwarding latency requirement and the destination address of the service flow, the forwarding path for forwarding the packet includes:
the first network node calculates the forwarding path based on the forwarding latency requirement and the destination address of the service flow.

In an example, the first network node generates the second entry, where the second entry includes a correspondence between the sequence number of the packet and a number of a second cycle time in which the second network node forwards the packet; and
the first network node sends the second entry to the second network node, where the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.

In an example, that the first network node obtains, based on the forwarding latency requirement and the destination address of the service flow, the forwarding path for forwarding the service flow includes:.

In an example, the information about the forwarding path includes address information of a node on the forwarding path, and the method further includes:
the first network node generates, through triggering based on the address information of the node on the forwarding path, a label switched path corresponding to the forwarding path, where the label switched path is used to forward the packet.

In an example, the information about the forwarding path is a label stack corresponding to the forwarding path, the label stack includes an adjacency segment identifier of the first network node and an adjacency segment identifier of the second network node, and the label stack is used to indicate the first network node to forward the packet through the forwarding path.

In an example, that the first network node sends, based on the first entry, the packet to the second network node in the time period corresponding to the cycle time number includes:
after the first network node matches the first entry based on the sequence number of the packet, the first network node adds the packet to a packet queue corresponding to the cycle time number, and sends the packet to the second network node when the packet queue is a sending queue.

In an example, the first network node determines duration of a cycle time of the first network node, and obtains duration of a cycle time of the second network node. The first network node determines a third cycle time number of the first network node and a fourth cycle time number of the second network node at a current time point. The first network node determines the first cycle time number based on the duration of the cycle time of the first network node and the third cycle time number. In addition, the first network node determines the second cycle time number based on the duration of the cycle time of the first network node, a latency of a link from the first network node to the second network node, a packet processing latency of the second network node, the fourth cycle time number, and the duration of the cycle time of the second network node. For a specific manner, refer to a manner in which the controller determines the first cycle time number and the second cycle time number in the embodiment shown in <FIG>.

In an example, an egress port of the first network node corresponds to three packet queues. Two packet queues are packet receiving queues, and one packet queue is a packet sending queue. Referring to <FIG>, a packet queue of the first network node at a cycle time <NUM> is in a packet queue state <NUM>, a packet queue at a cycle time <NUM> is in a packet queue state <NUM>, and a packet queue at a cycle time <NUM> is in a packet queue state <NUM>. In the packet queue state <NUM>, a queue <NUM> is a sending queue, and a queue <NUM> and a queue <NUM> are packet receiving queues. In the packet queue state <NUM>, the queue <NUM> is a sending queue, and the queue <NUM> and the queue <NUM> are packet receiving queues. In the packet queue state <NUM>, the queue <NUM> is a sending queue, and the queue <NUM> and the queue <NUM> are packet receiving queues. A packet queue state is switched alternately between three states in <FIG>. For example, the packet queue state <NUM> corresponds to a cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. The packet queue state <NUM> corresponds to a cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. The packet queue state <NUM> corresponds to a cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. Each queue corresponds to a cycle time number. For example, the queue <NUM> corresponds to the cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. The queue <NUM> corresponds to the cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. The queue <NUM> corresponds to the cycle time <NUM>, <NUM>, <NUM>, <NUM>, and the like. In other words, a sequence of the cycle time number corresponding to each queue is an arithmetic progression with a tolerance of <NUM>. Correspondingly, when the first network node determines that a first packet is sent in the cycle time <NUM>, and determines that a current cycle time number of the first network node is <NUM>, the first network node further determines that a current packet queue is in the packet queue state <NUM>. The first network node adds the packet to the packet queue <NUM>. When the cycle time of the first network node is changed into the cycle time <NUM>, the packet queue is in the state <NUM>, and the packet is sent to the second network node by using the packet queue <NUM>.

In an example, an egress port of the second network node also corresponds to the three packet queues shown in <FIG>, and a state change of the packet queue is shown in <FIG>. When the second network node receives a packet in the cycle time <NUM> of the second network node, and determines, based on a sequence number of the packet, that the second network node needs to send the packet externally in the cycle time <NUM>, the second network node adds the packet to the queue <NUM>. In this case, the packet queue is in the state <NUM>. When the cycle time number of the second network node is changed into <NUM> (in other words, the packet queue is in the state <NUM>), a state of the queue <NUM> is a packet sending state. The second network node sends the packet to the next-hop node of the second network node by using the packet queue <NUM>.

A plurality of packet queues are configured on the network node, to improve reliability of packet forwarding. For example, when the packet arrives at the second network node, a packet receiving queue of the second network node is full. In this case, queue overflow occurs, and the packet cannot be normally forwarded. A quantity of queues for receiving the packet is added, so that the packet may be buffered when the packet arrives at the network node in advance. When a sending cycle time of the packet arrives, the packet is sent. This improves reliability of packet sending.

<FIG> is a possible schematic structural diagram of the controller in the foregoing embodiments. The controller <NUM> may implement functions of the controller in the embodiment shown in <FIG> or <FIG>. Referring to <FIG>, the controller <NUM> includes an obtaining unit <NUM>, a determining unit <NUM>, a processing unit <NUM>, and a sending unit <NUM>. These units may perform corresponding functions of the controller in the foregoing method embodiments. The obtaining unit <NUM> is configured to support the controller <NUM> to perform processes in S301, S302, S304, and S305 in <FIG>. The determining unit <NUM> is configured to support the controller <NUM> to perform processes in S303 and S306 in <FIG>. The sending unit <NUM> is configured to support the controller <NUM> to perform processes in S308 and S309 in <FIG>. The processing unit <NUM> is configured to support the controller <NUM> to perform a process in S307 in <FIG> and/or another process performed by the controller in the technology described in this specification. For example, the obtaining unit <NUM> is configured to perform various information obtaining performed by the node in the foregoing method embodiments. The determining unit <NUM> is configured to perform a determining action performed by the controller in the foregoing method embodiments. The sending unit <NUM> is configured to perform various information sending performed by the controller in the foregoing method embodiments. The processing unit <NUM> is configured to perform processing, other than the information receiving and sending and the determining action, performed by the controller in the foregoing method embodiments. For example, the obtaining unit <NUM> is configured to obtain a forwarding latency requirement of a service flow and a destination address of the service flow. The determining unit <NUM> is configured to determine, based on the forwarding latency requirement and the destination address, a forwarding path for forwarding the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow, the forwarding path passes through a first network node and a second network node, the first network node is an ingress node on the forwarding path, and the second network node is an intermediate node on the forwarding path. The determining unit <NUM> is configured to determine a number of a first cycle time in which the first network node forwards a packet and a number of a second cycle time in which the second network node forwards the packet, where the packet is a packet in the service flow. The processing unit <NUM> is configured to generate a first entry and a second entry, where the first entry includes a correspondence between a sequence number of the packet and the first cycle time number, and the second entry includes a correspondence between the sequence number of the packet and the second cycle time number. The sending unit <NUM> is configured to send the first entry to the first network node and send the second entry to the second network node, where the first entry is used to indicate the first network node to send the packet in a time period corresponding to the first cycle time number, and the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

<FIG> is a possible schematic structural diagram of a controller in the foregoing embodiments. The controller <NUM> includes a processor <NUM>, a transceiver <NUM>, a memory <NUM>, and a bus <NUM>. The processor <NUM>, the transceiver <NUM>, and the memory <NUM> are interconnected through the bus <NUM>. The bus <NUM> may be a peripheral component interconnect (peripheral component interconnect, PCI for short) bus, an extended industry standard architecture (extended industry standard architecture, EISA for short) bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of indication, only one thick line is used to indicate the bus in <FIG>. However, it does not indicate that there is only one bus or only one type of bus. The controller <NUM> may implement a function of the controller in the embodiment shown in <FIG> or <FIG>. The processor <NUM> and the transceiver <NUM> may perform corresponding functions of the controller in the foregoing method examples. The transceiver <NUM> is configured to support the controller <NUM> to perform processes in S301, S302, S308, and S309 in <FIG>. The processor <NUM> is configured to support the controller <NUM> to perform a process in S307 in <FIG> and/or another process performed by the controller in the technology described in this specification. The memory <NUM> is configured to store program code and data of the controller <NUM>. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

<FIG> is a possible schematic structural diagram of the first network node in the foregoing embodiments. The first network node may implement a function of the ingress node in the embodiment shown in <FIG> or a function of the first network node in the embodiment shown in <FIG>. Referring to <FIG>, the first network node <NUM> includes an obtaining unit <NUM> and a first sending unit <NUM>. These units may perform corresponding functions of the first network node in the foregoing method examples. The obtaining unit <NUM> is configured to support the first network node <NUM> to perform processes in S501, S502, and S503 in <FIG>. The first sending unit <NUM> is configured to support the first network node <NUM> to perform a process in S505 in <FIG>. For example, the obtaining unit <NUM> is configured to perform various information obtaining performed by the first network node in the foregoing method embodiments. The first sending unit <NUM> is configured to perform various information sending performed by the first network node in the foregoing method embodiments. For example, the obtaining unit <NUM> is configured to: obtain a forwarding latency requirement of a service flow and a destination address of the service flow; obtain, based on the forwarding latency requirement and the destination address of the service flow, a forwarding path for forwarding the service flow, where a latency of the forwarding path meets the forwarding latency requirement of the service flow, the first network node is an ingress node on the forwarding path, and a second network node is an intermediate node on the forwarding path; and obtain a first entry, where the first entry includes a correspondence between a sequence number of a packet and a number of a first cycle time in which the first network node forwards the packet, and the packet is a packet in the service flow. The first sending unit <NUM> is configured to send the packet to the second network node based on the first entry in a time period corresponding to the cycle time number. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

It should be noted that, in the embodiments of the present invention, module division is an example, and is merely logical function division. In actual implementation, there may be another division manner. Functional units in the embodiments of the present invention may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. For example, in the foregoing embodiments, the receiving unit and the sending unit may be a same unit or different units.

Referring to <FIG>, a first network node <NUM> includes a processor <NUM>, a transceiver <NUM>, a memory <NUM>, and a bus <NUM>. The transceiver <NUM>, the processor <NUM>, and the memory <NUM> are interconnected through the bus <NUM>. The bus <NUM> may be a PCI bus, an EISA bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of indication, only one thick line is used to indicate the bus in <FIG>. However, it does not indicate that there is only one bus or only one type of bus. The first network node <NUM> may implement a function of the first network node or the ingress node in the embodiment shown in <FIG> or <FIG>. The processor <NUM> and the transceiver <NUM> may perform corresponding functions of the first network node or the ingress node in the foregoing method examples. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

<FIG> is a possible schematic structural diagram of the second network node in the foregoing embodiments. The second network node may implement a function of the ingress node in the embodiment shown in <FIG> or a function of the second network node in the embodiment shown in <FIG>. Referring to <FIG>, the second network node <NUM> includes an obtaining unit <NUM>, a receiving unit <NUM>, and a sending unit <NUM>. These units may perform corresponding functions of the second network node or the intermediate node in the foregoing method examples. The obtaining unit <NUM> is configured to support the second network node <NUM> to perform a process in S504 in <FIG>. The receiving unit <NUM> is configured to support the second network node <NUM> to perform processes in S505 and S506 in <FIG>. The sending unit <NUM> is configured to support the second network node <NUM> to perform a process in S507 in <FIG>. For example, the obtaining unit <NUM> is configured to perform various information obtaining performed by the second network node in the foregoing method embodiments. The receiving unit <NUM> is configured to perform various information receiving performed by the second network node in the foregoing method embodiments. The sending unit <NUM> is configured to perform various information sending performed by the second network node in the foregoing method embodiments. For example, the obtaining unit <NUM> is configured to obtain an entry including a correspondence between a sequence number and a cyclic period cycle time number, where the sequence number is a packet sequence number, and the cycle time number is used to indicate the second network node to send, in a time period corresponding to the cycle time number, a packet corresponding to the sequence number. The receiving unit <NUM> is configured to receive a packet sent by a first network node, where the packet includes a flow identifier and the sequence number. The sending unit <NUM> is configured to: after matching the entry based on a sequence number included in the packet, send the packet to a next-hop network node of the second network node in the time period corresponding to the cycle time number. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

Referring to <FIG>, a second network node <NUM> includes a processor <NUM>, a transceiver <NUM>, a memory <NUM>, and a bus <NUM>. The transceiver <NUM>, the processor <NUM>, and the memory <NUM> are interconnected through the bus <NUM>. The bus <NUM> may be a PCI bus, an EISA bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of indication, only one thick line is used to indicate the bus in <FIG>. However, it does not indicate that there is only one bus or only one type of bus. The second network node <NUM> may implement a function of the second network node or the intermediate node in the embodiment shown in <FIG> or <FIG>. The processor <NUM> and the transceiver <NUM> may perform corresponding functions of the second network node or the intermediate node in the foregoing method examples. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

Referring to <FIG>, an embodiment of the present invention provides a packet sending system <NUM>. The system <NUM> is configured to implement the packet sending method in the foregoing method embodiments. The system <NUM> includes a controller <NUM>, a first network node <NUM>, and a second network node <NUM>. The controller <NUM>, the first network node <NUM>, and the second network node <NUM> may respectively implement functions of the controller, the first network node, and the second network node in the embodiment shown in <FIG> or <FIG>. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG> or <FIG>.

Referring to <FIG>, an embodiment of the present invention provides a packet sending system <NUM>. The system <NUM> is configured to implement the packet sending method in the foregoing method embodiments. The system <NUM> includes a first network node <NUM> and a second network node <NUM>. The first network node <NUM> and the second network node <NUM> may respectively implement functions of the first network node and the second network node in the embodiment shown in <FIG>. For a specific execution process, refer to detailed descriptions of corresponding steps in the embodiment shown in <FIG>.

An embodiment of the present invention further provides a storage medium, configured to store a software instruction used in the foregoing embodiments. The software instruction includes a program used to perform the method shown in the foregoing embodiments. When the program is executed on a computer or a device, the computer or the device is enabled to perform the method in the foregoing method embodiments.

"First" in the first network node in the embodiments of the present invention is merely used as a name identifier, and does not represent the first in sequence. This rule also applies to "second" and "third".

It should be noted that any apparatus embodiment described above is merely an example. Some or all of the modules may be selected based on an actual requirement to achieve the objectives of the solutions in the embodiments. In addition, in the embodiment accompanying drawings of the first network node or the controller provided in the present invention, a connection relationship between modules indicates that the modules have a communication connection with each other, which may be specifically implemented as one or more communications buses or signal cables. A person of ordinary skill in the art may understand and implement the embodiments without creative efforts.

The methods or algorithm steps described with reference to the content disclosed in the embodiments of the present invention may be implemented by hardware, or may be implemented by a processor by executing a software instruction. The software instruction may include a corresponding software module. The software module may be stored in a random access memory (random access memory, RAM), a flash memory, a read-only memory (read only memory, ROM), an erasable programmable read-only memory (erasable programmable ROM, EPROM), an electrically erasable programmable read-only memory (electrically EPROM, EEPROM), a hard disk, a removable hard disk, a compact disc, or any other form of storage medium well-known in the art. For example, a storage medium is coupled to a processor, so that the processor can read information from the storage medium or write information into the storage medium. Certainly, the storage medium may be a component of the processor. The processor and the storage medium may be located in an ASIC. In addition, the ASIC may be located in a core network interface device. Certainly, the processor and the storage medium may exist in the core network interface device as discrete components.

Claim 1:
A packet sending method, comprising:
obtaining (S301, S302), by a controller, a forwarding latency requirement of a service flow, and determining (S303), based on the forwarding latency requirement, a forwarding path for forwarding the service flow, wherein a latency of the forwarding path meets the forwarding latency requirement of the service flow, the forwarding path passes through a first network node and a second network node;
determining (S306), by the controller, a number of a first cycle time in which the first network node forwards a packet and a number of a second cycle time in which the second network node forwards the packet, wherein the packet is a packet in the service flow;
generating (S307), by the controller, a first entry and a second entry, wherein the first entry comprises a correspondence between a sequence number of the packet and the first cycle time number, and the second entry comprises a correspondence between the sequence number of the packet and the second cycle time number;
sending (S308), by the controller, the first entry to the first network node, wherein the first entry is used to indicate the first network node to send the packet in a time period corresponding to the first cycle time number; and
sending, by the controller (S309), the second entry to the second network node, wherein the second entry is used to indicate the second network node to send the packet in a time period corresponding to the second cycle time number.