Patent Description:
Segment routing (segment routing, SR) is a source routing mechanism that can enable a network to achieve better scalability and provide functions such as traffic engineering (traffic engineering, TE) and a multiprotocol label switching (multiprotocol label switching, MPLS) virtual private network (virtual private network, VPN) in a simpler and more flexible manner. In a software-defined networking (software-defined networking, SDN) network architecture, the SR provides a capability of quick interaction with an upper-layer application for the network. When being deployed on an internet protocol version <NUM> (Internet Protocol version <NUM>, IPv6) data plane, the SR is referred to as SRv6. In the prior art, performance measurement for an SRv6 network is mainly as follows: A network performance parameter such as a time stamp or a data packet quantity is recorded by coloring a packet based on a flow label (flow label, FL), and then network performance parameters of different nodes are obtained by using a centralized controller, so as to implement the performance measurement for the SRv6 network on the controller. However, in all current methods, the network performance parameter needs to be obtained by using a specific protocol, resulting in high implementation complexity and inflexibility.

<CIT> relates to segment routing extension headers. <CIT> relates to service chain overlay network operations visibility via data packets. <CIT> relates to a method for measuring the performance parameters of the multiprotocol label switching network.

Further embodiments are set forth in the dependent claims.

To make the objectives, technical solutions, and advantages of this disclosure clearer, the following further describes the implementations of this disclosure in detail with reference to the accompanying drawings.

In a process of forwarding a packet in a SRv6 network, an ingress device for forwarding the packet in the SRv6 network adds a segment routing header (segment routing header, SRH) to the packet. The SRH includes a segment list (segment list) used to identify a forwarding path. The segment list includes an IPv6 address of a network node on the path used to forward the packet. The ingress device for forwarding the packet in the SRv6 network may also be referred to as an ingress node (ingress node) or an ingress provider edge (provider edge, PE) device. In a SRv6 technology, the IPv6 address of the network node in the segment list may also be referred to as a segment identifier (segment identifier, SID) of the network node. The segment list may also be referred to as a path SID list. The SID occupies <NUM> bits (bit). The SID includes two parts: a locator (locator) and a function (function). The locator is used to route the packet to the network node corresponding to the SID. For example, the locator includes first <NUM> bits of the IPv6 address of the network node. A forwarding node may forward, based on the locator, the packet to the network node corresponding to the locator. The function is used to instruct the network node corresponding to the SID to perform a corresponding function. For example, when the network node receives the packet, if the network node determines that a destination address of the packet is an address of the network node, namely, the segment identifier of the network node, the network node performs the corresponding function based on the function in the segment identifier. For definitions of the segment list and the SID, refer to a SRv6-related draft disclosed by the internet engineering task force (internet engineering task force, IETF), for example, draft-filsfils-spring-srv6-network-programming-<NUM>.

A controller mentioned in the embodiments of the present invention may be a network management device or a controller in a software-defined networking (Software-defined networking, SDN) architecture. The network node in the embodiments of the present invention may be a network device, for example, a router, a switch, or a forwarder in an SDN network.

<FIG> is a schematic diagram of a possible application scenario according to an embodiment of the present invention. The application scenario includes a network node supporting an SRv6 function, for example, a network node <NUM>, a network node <NUM>, a network node <NUM>, a network node <NUM>, a network node <NUM>, and a network node <NUM>. In an SRv6 network, that a network node supports the SRv6 function means that the network node supports a segment routing function. A segment identifier of the network node <NUM> is an SID <NUM>. The SID <NUM> is an IPv6 address of the network node <NUM>, for example, A::. A segment identifier of the network node <NUM> is an SID <NUM>. The SID <NUM> is an IPv6 address of the network node <NUM>, for example, B::. A segment identifier of the network node <NUM> is an SID <NUM>. The SID <NUM> is an IPv6 address of the network node <NUM>, for example, C::. A segment identifier of the network node <NUM> is an SID <NUM>. The SID <NUM> is an IPv6 address of the network node <NUM>, for example, D::. When a packet is forwarded from the network node <NUM> to the network node <NUM>, the network node <NUM> may be referred to as an ingress node of the SRv6 network and the network node <NUM> may be referred to as an egress node (egress node) of the SRv6 network.

In the SRv6 network, network performance of the SRv6 network is usually measured based on a cross coloring solution for a flow label. In this solution, <NUM> bits of a flow label in a packet header of an IPv6 packet is used to color consecutive data packets. Different data packets are distinguished by using different values of <NUM> bits of flow labels. This is vividly referred to as coloring. With reference to <FIG>, the network node <NUM> assigns <NUM> to first bits of flow labels of <NUM> consecutive data packets, and colors of the <NUM> data packets are the same. Then, the network node <NUM> assigns <NUM> to first bits of flow labels of <NUM> subsequent data packets, and colors of the <NUM> data packets are a second color. When a color of a data packet received by the network node <NUM> changes, that is, when values of first bits of flow labels of two adjacent data packets are different, the network node <NUM> may record a network performance parameter. For example, a time at which a data packet is received is recorded or a quantity of received data packets that belong to a same color is recorded. To measure performance, network performance parameters of network nodes further need to be synchronized. For example, a controller collects the network performance parameters of the nodes, and then measures network performance. For example, the network node <NUM> records a quantity of packets that are sent by the network node <NUM> and whose flow labels have first bits with a value <NUM>, and sends the quantity of packets to the controller. The network node <NUM> records a quantity of packets that are received by the network node <NUM> and whose flow labels have first bits with a value <NUM>, and also sends the quantity of packets to the controller. The controller performs packet loss detection based on the quantity of packets that is sent by the network node <NUM> and the quantity of packets that is received by the network node <NUM>. In the foregoing method for measuring the network performance, the network nodes need to separately send the network performance parameters to the controller. Therefore, a forwarding channel needs to be established between each network node and the controller in advance by using a specific protocol. The solution is complex to be implemented, and is not conducive to solution extension.

The embodiments of the present invention provide a packet processing method, and a network node and a system that are based on the method. The method, the network node, and the system are based on a same inventive concept. Problem-resolving principles of the method, the network node, and the system are similar. Therefore, for embodiments of the network node, the method, and the system, reference may be made to each other. Same content is not described again.

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

A first network node obtains a first packet including a segment list. The segment list includes a segment identifier of a network node on a path used to forward the first packet.

An example in which the first network node is the network node <NUM> in <FIG> is used for description. In the application scenario shown in <FIG>, there are two paths from the network node <NUM> to the network node <NUM>. Network nodes through which a first path passes include the network node <NUM>, the network node <NUM>, and the network node <NUM>. Network nodes through which a second path passes include the network node <NUM>, the network node <NUM>, and the network node <NUM>. The network node <NUM> obtains a segment list for the first path. SIDs in the segment list may be arranged in a reversed order of the network nodes through which the packet passes on the first path. For example, the segment list is <SID <NUM>, SID <NUM>, and SID <NUM>>. Alternatively, SIDs in the segment list may be arranged in a positive order of the network nodes through which the packet passes on the first path. For example, the segment list is <SID <NUM>, SID <NUM>, and SID <NUM>>. The segment list may be generated by the network node <NUM> in advance, or may be obtained from a controller. The network node <NUM> obtains a correspondence between a destination address of the first packet and the segment list. For example, if the destination address of the first packet is D::, the first network node obtains a correspondence between the address D:: and the segment list <SID <NUM>, SID <NUM>, and SID <NUM>>. The correspondence may be pre-stored in the network node <NUM>, or may be stored in another network node. For example, the correspondence may be pre-stored in the controller. When the network node <NUM> receives the first packet, the network node <NUM> obtains the correspondence from the controller. In this example, the network node <NUM> obtains a next-hop segment node of the network node <NUM> by using the segment list, so that the network node <NUM> may forward the packet to the network node <NUM> along the first path. Therefore, the segment list may include no segment identifier of the network node <NUM>. Optionally, the segment list may alternatively include a segment identifier of the network node <NUM>. For example, the segment list may be <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>, or <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>.

The first network node obtains a segment identifier of a second network node from the segment list. The second network node is a next-hop segment node of the first network node on the path. The next-hop segment node of the first network node is a network node that supports a segment routing function and that is closest to the first network node in a packet forwarding direction on the path.

For example, the segment list may be stored in a memory of the first network node in a form of a data structure. The data structure may be an array, a linked list, or a structure. For example, when the data structure is the array, the SID <NUM> may be a first member in the array, and the SID <NUM> may be a second member in the array. A processor of the first network node may perform a read operation on the second member in the array stored in the memory, to obtain the SID <NUM> from the memory.

The first network node replaces the destination address of the first packet with the segment identifier of the second network node, and adds a network performance parameter of the first network node to the segment list, to generate a second packet. That the first network node replaces the destination address of the first packet with the segment identifier of the second network node means updating a value of a destination address field of the first packet to the segment identifier of the second network node. Because the segment identifier of the second network node is an IPv6 address of the second network node, that the first network node replaces the destination address of the first packet with the segment identifier of the second network node means replacing the destination address of the first packet with the IPv6 address of the second network node.

In an example, that the first network node obtains the first packet means that the first network node generates the first packet. For example, the first network node is the network node <NUM> in the scenario shown in <FIG>, the second network node is the network node <NUM>, and the first network node is an ingress node on the path for forwarding the first packet. When the network node <NUM> needs to send an IPv6 packet to the network node <NUM>, the network node <NUM> searches the segment list based on an IPv6 address D:: of the network node <NUM>, and then inserts an SRH between an IPv6 packet header of the IPv6 packet and a packet payload. The SRH includes the segment list <SID <NUM>, SID <NUM>, and SID <NUM>>. The network node <NUM> obtains a segment identifier of a next-hop segment node of the network node <NUM> from the segment list, namely, the segment node identifier SID <NUM> of the network node <NUM>, and then replaces the destination address (destination address, DA) of the first packet with the SID <NUM>, in other words, replaces the value of the destination address field of the first packet with the SID <NUM>.

In an example, the first packet is a packet received by the first network node from user equipment. For example, the first network node is the network node <NUM> in the scenario shown in <FIG>, the second network node is the network node <NUM>. The network node <NUM> is further connected to source user equipment, the network node <NUM> is connected to target user equipment, and the source user equipment and the target user equipment may not support a segment routing function. When the source user equipment needs to send a packet to the target user equipment, the source user equipment generates a user packet whose destination address is an address of the target user equipment, and then sends the user packet to the network node <NUM>. The network node <NUM> serves as an ingress node for forwarding the user packet in the SRv6 network, and inserts an SRH into the user packet, to generate the first packet. The SRH includes a segment list <IPv6 address, SID <NUM>, SID <NUM>, and SID <NUM>>. The IPv6 address (address) is an IPv6 address of the target user equipment. In another case of this example, if the source user equipment needs to send the packet to only the network node <NUM>, for example, the network node <NUM> is a server device, the segment list is <SID <NUM>, SID <NUM>, and SID <NUM>>.

In an example, the first packet is a packet received by the first network node from another network node that supports a segment routing function. For example, the first network node is the network node <NUM> in the scenario shown in <FIG>, and the second network node is the network node <NUM>, and the first network node is an intermediate node in a process of forwarding the first packet. The first network node receives the first packet from the network node <NUM> in <FIG>. As an ingress node for forwarding the first packet, the network node <NUM> has added an SRH to the first packet. The SRH includes a segment list <SID <NUM>, SID <NUM>, and SID <NUM>>.

According to the claimed invention, the first network node adds the network performance parameter to the segment identifier of the second network node in the segment list or it adds the network performance parameter of the first network node to the segment identifier of the first network node. For example, when the first network node is the network node <NUM> in the scenario shown in <FIG>, and the second network node is the network node <NUM>, the network performance parameter of the first network node is stored in the SID <NUM> in the segment list <SID <NUM>, SID <NUM>, and SID <NUM>>. Because each SID includes two parts: a locator and a function, after the value of the destination address field of the first packet is replaced with the SID <NUM>, the SID <NUM> in the segment list can be repeatedly used. For example, the network performance parameter of the first network node is stored in the function part of the SID <NUM>, and when the function part occupies the 65th bit to the 128th bit of the SID <NUM>, the network performance parameter of the first network node is stored between the 65th bit and the 128th bit of the SID <NUM>. In this example, the locator may occupy any quantity of bits in only the 1st bit to the 64th bit of the SID, and correspondingly, the function occupies bits other than the bits occupied by the locator in the SID. For example, the locator occupies the 1st bit to the 50th bit of the SID, and the function may occupy the 51st bit to the 128th bit of the SID. Optionally, the function may alternatively occupy only the 90th bit to the 128th bit of the SID.

In an example, when the first network node is the network node <NUM> in the scenario shown in <FIG>, the second network node is the network node <NUM>, and the segment list further includes a segment identifier of the first network node, for example, the segment list is <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>, the first network node may add the network performance parameter of the first network node to the segment identifier of the first network node in the segment list, for example, store the network performance parameter of the first network node in the SID <NUM> in the segment list <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>.

In an example, when the first network node is the network node <NUM> in the scenario shown in <FIG>, the second network node is the network node <NUM>, and the segment list includes no segment identifier of the first network node, for example, the segment list is <SID <NUM>, SID <NUM>, and SID <NUM>>, the first network node may add the network performance parameter of the first network node to another field of the first packet, for example, an ingress node type-length-value (type length value, TLV) field. Another network node may store a corresponding network performance parameter in a corresponding SID. For example, a network performance parameter of the second network node is stored in the SID <NUM> in the segment list <SID <NUM>, SID <NUM>, and SID <NUM>>.

The first network node sends the second packet to the second network node.

The second network node receives the second packet, and when determining that a value of a destination address field of the second packet is the segment identifier of the second network node, obtains the network performance parameter of the first network node in the segment list, and calculates network performance based on the network performance parameter of the first network node.

In an example, the network performance parameter of the first network node includes a first time at which the first network node sends the second packet. Alternatively, the network performance parameter of the first network node includes a first quantity of service packets that correspond to a service identifier and that are received by the first network node before the first network node sends the second packet, and the service packets that correspond to the service identifier are forwarded along the path.

The second network node may calculate the network performance based on the network performance parameter of the first network node in one or more of the following manners.

In a first manner, a forwarding delay is calculated.

The second network node determines a second time at which the second network node receives the first packet, and then determines that a forwarding delay of sending the packet from the first network node to the second network node is a difference between the second time and the first time.

In a second manner, a quantity of lost packets is calculated.

The second network node determines a second quantity of service packets that correspond to the service identifier and that are received by the second network node before the second network node receives the packet. The second network node determines a quantity of lost packets during forwarding of the service packets corresponding to the service identifier from the first network node to the second network node. The quantity of lost packets is equal to a difference between the second quantity and the first quantity.

According to the method, in a process in which the first network node forwards the packet by using the segment list in the packet, the segment list is used to carry the network performance parameter of the first network node, so that transmission of the network performance parameter is more convenient, and the network performance parameter of the first network node can be sent to the second network node when the first network node forwards the packet. The second network node may directly use the network performance parameter of the first network node to calculate the network performance, so that calculation of the network performance is more flexible.

A first network node obtains a first packet including a segment list. The segment list includes a segment identifier of a network node on a path used to forward the first packet.

The first network node obtains a segment identifier of a second network node from the segment list. The second network node is a next-hop segment node of the first network node on the path.

The first network node replaces a destination address of the first packet with the segment identifier of the second network node, and adds a network performance parameter of the first network node to the segment list, to generate a second packet.

The first network node sends the second packet to the second network node.

In this embodiment of the present invention, steps S301, S302, S303, and S304 are the same as steps S201, S202, S203, and S204 in <FIG>. For detailed content, refer to the embodiment shown in <FIG>.

When determining that a value of a destination address field of the second packet is the segment identifier of the second network node, the second network node obtains a segment identifier of a third network node from the second packet. The third network node is a next-hop segment node of the second network node on the path.

The second network node replaces a destination address of the second packet with the segment identifier of the third network node, and adds a network performance parameter of the second network node to the segment list, to generate a third packet.

In an example, the network performance parameter of the second network node includes a second time at which the second network node sends the packet to the third network node. Alternatively, the network performance parameter of the second network node includes a second quantity of service packets that correspond to a service identifier and that are received by the second network node when the second network node forwards the third packet.

The second network node sends the third packet to the third network node.

The third network node receives the third packet, and when determining that a value of a destination address field of the third packet is the segment identifier of the third network node, the third network node calculates network performance.

The third network node may measure the network performance in one or more of the following manners.

A first manner of calculating a forwarding delay is as follows:
The third network node determines that a forwarding delay of forwarding the third packet from the first network node to the second network node is equal to a difference between the second time and a first time.

A second manner of calculating a forwarding delay is as follows:
The third network node determines a third time at which the third network node receives the third packet, and then determines that a forwarding delay of sending the third packet from the second network node to the third network node is equal to a difference between the third time and the second time.

A third manner of calculating a forwarding delay is as follows:
The third network node determines a third time at which the third network node receives the third packet, and then determines that a forwarding delay of sending the third packet from the first network node to the third network node is equal to a difference between the third time and the first time.

A first manner of calculating a quantity of lost packets is as follows:
The third network node determines that a quantity of lost packets during forwarding of the service packets corresponding to the service identifier from the first network node to the second network node is equal to a difference between the second quantity and a first quantity.

A second manner of calculating a quantity of lost packets is as follows:
The third network node determines a third quantity of service packets that correspond to the service identifier and that are received by the third network node before the third network node receives the third packet, and then determines that a quantity of lost packets during forwarding of the service packets corresponding to the service identifier from the second network node to the third network node is equal to a difference between the third quantity and the second quantity.

A third manner of calculating a quantity of lost packets is as follows:
The third network node determines a third quantity of service packets that correspond to the service identifier and that are received by the third network node before the third network node receives the third packet, and then determines a quantity of lost packets during forwarding of the service packets corresponding to the service identifier from the first network node to the third network node. The quantity of lost packets is equal to a difference between the third quantity and the first quantity.

Referring to <FIG>, <FIG>, and <FIG>, an embodiment of the present invention provides a packet processing method. <FIG> and <FIG> are schematic diagrams of forwarding a packet in the application scenario shown in <FIG>. <FIG> is a schematic flowchart of a packet processing method according to an embodiment of the present invention. Referring to <FIG>, the method includes the following steps.

A network node <NUM> obtains a first packet to be sent to a network node <NUM>. The first packet includes an IPv6 packet header, an SRH, and a payload, as shown in a schematic table of a packet format in <FIG>. The network node <NUM> replaces a destination address of the first packet with an SID <NUM>, adds a network performance parameter of the network node <NUM> to a segment list to generate a second packet, and sends the second packet to a network node <NUM>.

In an example, the SRH includes a segment list <SID <NUM>, SID <NUM>, and SID <NUM>>, and the network performance parameter (network performance parameters, NPP) of the network node <NUM> is included in the SID <NUM> in the segment list of the first packet. As shown in <FIG>, a network performance parameter NPP <NUM> value of the network node <NUM> is stored in a function field of the SID <NUM>. In other words, the value of an NPP <NUM> is stored in the function field of the SID <NUM>.

In an example, the SRH includes a segment list <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>. A network performance parameter NPP <NUM> of the network node <NUM> is included in an SID <NUM> in the segment list of the first packet. As shown in <FIG>, the NPP <NUM> is included in a function field of the SID <NUM>.

The network node <NUM> receives the second packet, and when determining that a value of a destination address field of the second packet is the SID <NUM>, the network node <NUM> obtains the SID <NUM> from a segment list of the second packet, and replaces a destination address of the second packet with the SID <NUM>. When determining that a function corresponding to the function field in the SID <NUM> is to insert a network performance parameter, the network node <NUM> adds a network performance parameter of the network node <NUM> to the segment list to generate a third packet, and sends the third packet to a network node <NUM>.

In an example, the SRH includes the segment list <SID <NUM>, SID <NUM>, and SID <NUM>>. A network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> in the segment list. As shown in <FIG>, the NPP <NUM> is stored in a function field of the SID <NUM>.

In an example, the SRH includes the segment list <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>. A network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> in the segment list. As shown in <FIG>, the NPP <NUM> is stored in the function field of the SID <NUM>.

In an example, the network node <NUM> is the first network node in the embodiment shown in <FIG>. The network node <NUM> may be the second network node in the embodiment shown in <FIG>. The network node <NUM> may measure network performance based on the network performance parameter in the segment list. For a specific manner of calculating the network performance, refer to the embodiment shown in <FIG>.

The network node <NUM> receives the third packet, and when determining that a value of a destination address field of the third packet is the SID <NUM>, the network node <NUM> obtains the SID <NUM> from a segment list in the third packet, and replaces a destination address of the third packet with the SID <NUM>. When determining that a function corresponding to the function field in the SID <NUM> is to insert a network performance parameter, the network node <NUM> stores a network performance parameter of the network node <NUM> in the segment list to generate a fourth packet, and sends the fourth packet to the network node <NUM>.

A meaning of a network performance parameter of a network node in this embodiment of the present invention is similar to that of the network performance parameter in the embodiment shown in <FIG> or <FIG>.

In an example, the SRH includes the segment list <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>. A network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> in the segment list. As shown in <FIG>, the NPP <NUM> is stored in a function field of the SID <NUM>.

In an example, the network node <NUM> is the first network node in the embodiment shown in <FIG>, the network node <NUM> is the second network node in the embodiment shown in <FIG>, and the network node <NUM> is the third network node in the embodiment shown in <FIG>. The network node <NUM> may measure network performance based on the network performance parameter in the segment list. For a specific manner of calculating the network performance, refer to the embodiment shown in <FIG>.

The network node <NUM> receives the fourth packet, and when determining that a value of a destination address field of the fourth packet is the SID <NUM>, measures network performance based on the network performance parameter in the segment list.

In an example, when the segment list is <SID <NUM>, SID <NUM>, and SID <NUM>>, referring to <FIG>, a network performance parameter of each network node is stored in a segment identifier of a next-hop segment node corresponding to the network node. For example, the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>, the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>, and the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>. When the segment list is <SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>, referring to <FIG>, a network performance parameter of each network node is stored in a segment identifier of the network node. For example, the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>, the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>, and the network performance parameter NPP <NUM> of the network node <NUM> is stored in the SID <NUM> of the network node <NUM>. After the network node <NUM> receives the fourth packet, because the network node <NUM> is the last segment node indicated by the segment list, a network performance parameter of the network node <NUM> does not need to be added to the segment list, and network performance needs to be calculated based on only the network performance parameter of each network node in the segment list.

In an example, the network node <NUM> is further connected to user equipment, a destination of the fourth packet is the user equipment, a segment list included in the SRH is <IPv6 address, SID <NUM>, SID <NUM>, and SID <NUM>> or <IPv6 address, SID <NUM>, SID <NUM>, SID <NUM>, and SID <NUM>>. The IPv6 address is an IPv6 address (address) of the user equipment. The network node <NUM> stores a correspondence between the IPv6 address of the user equipment and the segment list. The network node <NUM> deletes the SRH from the fourth packet, and modifies a destination address of the fourth packet to the IPv6 address of the user equipment to generate a fifth packet. Then, the network node <NUM> sends the fifth packet to the user equipment.

In an example, the network node <NUM> is the first network node in the embodiment shown in <FIG>, the network node <NUM> or the network node <NUM> is the second network node in the embodiment shown in <FIG>, and the network node <NUM> may be the third network node in the embodiment shown in <FIG>. For a specific network performance measurement manner, refer to the embodiment shown in <FIG>.

<FIG> is a possible schematic structural diagram of a first network node <NUM> in the foregoing embodiments. The first network node may implement a function of the first network node in the embodiment shown in <FIG>, <FIG>, or <FIG>. Referring to <FIG>, the first network node <NUM> includes an obtaining unit <NUM>, a generation unit <NUM>, and a sending unit <NUM>. These units may perform corresponding functions in the foregoing method example. For example, the obtaining unit <NUM> is configured to obtain various information obtained by the first network node in the foregoing method embodiments. The generation unit <NUM> generates various information generated by the first network node in the foregoing method embodiments. The sending unit <NUM> is configured to send various information sent by the first network node in the foregoing method embodiments. For example, the obtaining unit <NUM> is configured to: obtain a first packet including a segment list, where the segment list includes a segment identifier of a network node on a path used to forward the first packet; and obtain a segment identifier of a second network node from the segment list, where the second network node is a next-hop segment node of the first network node on the path. The generation unit <NUM> is configured to: replace a destination address of the first packet with the segment identifier of the second network node, and add a network performance parameter of the first network node to the segment list, to generate a second packet. The sending unit <NUM> is configured to send the second packet to the second network node.

When an integrated unit is used, <FIG> is another possible schematic structural diagram of the first network node in the foregoing embodiments. The first network node <NUM> may also implement a function of the first network node in the embodiment shown in <FIG>, <FIG>, or <FIG>.

The first network node <NUM> includes a storage unit <NUM>, a processing unit <NUM>, and a communications unit <NUM>. The processing unit <NUM> is configured to control and manage an action of the first network node <NUM>. For example, the processing unit <NUM> is configured to support the first network node <NUM> in performing the processes S201, S202, and S203 in <FIG>, the processes S301, S302, and S303 in <FIG>, the process S601 in <FIG>, and/or another process in the technology described in this specification. The communications unit <NUM> is configured to support communication between the first network node <NUM> and another network entity, for example, communication with the second network node or the network node <NUM> shown in <FIG>, <FIG>, or <FIG>. The storage unit <NUM> is configured to store program code and data of the first network node <NUM>.

The processing unit <NUM> may be a processor, such as a central processing unit (central processing unit, CPU), a general-purpose processor, a digital signal processor (digital signal processor, DSP), an application-specific integrated circuit (application-specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA) or another programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The processor may implement or execute various example logical blocks, modules, and circuits described with reference to content disclosed in the embodiments of the present invention. Alternatively, the processor may be a combination for implementing a computing function, for example, a combination of one or more microprocessors, or a combination of a DSP and a microprocessor. The communications unit <NUM> may be a transceiver, and the storage unit <NUM> may be a memory.

When the processing unit <NUM> is the processor, the communications unit <NUM> is the transceiver, and the storage unit <NUM> is the memory, the first network node in this embodiment of the present invention may be a first network node <NUM> shown in <FIG>.

Referring to <FIG>, the 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 connected to each other by using 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 representation, only one thick line is used to represent the bus in <FIG>, but this does not mean that there is only one bus or only one type of bus.

Referring to <FIG>, an embodiment of the present invention provides another first network node <NUM>. The first network node <NUM> includes a main control board <NUM> and an interface board <NUM>. The main control board <NUM> includes a processor <NUM> and a memory <NUM>. The interface board <NUM> includes a processor <NUM>, a memory <NUM>, and an interface card <NUM>. The main control board <NUM> is coupled to the interface board <NUM>.

The hardware may implement a corresponding function of the first network node in the method example in <FIG>, <FIG>, or <FIG>. For example, the memory <NUM> may be configured to store program code of the interface board <NUM>. The processor <NUM> is configured to invoke the program code in the memory <NUM> to trigger the interface card <NUM> to perform receiving and sending of various information that are performed by the first network node in the foregoing method embodiments. The memory <NUM> may be configured to store program code of the main control board <NUM>. The processor <NUM> is configured to invoke the program code in the memory <NUM> to perform processing other than information receiving and sending of the first network node in the foregoing method embodiments. For example, the processor <NUM> is configured to: obtain a first packet including a segment list, where the segment list includes a segment identifier of a network node on a path used to forward the first packet; obtain a segment identifier of a second network node from the segment list, where the second network node is a next-hop segment node of the first network node on the path; and replace a destination address of the first packet with the segment identifier of the second network node, and add a network performance parameter of the first network node to the segment list, to generate a second packet. The processor <NUM> is configured to receive the second packet sent by the main control board <NUM>. The interface card <NUM> is configured to send the second packet to the second network node. The memory <NUM> is configured to store program code and data of the main control board <NUM>. The memory <NUM> is configured to store program code and data of the interface board <NUM>.

In a possible implementation, an IPC control channel is established between the main control board <NUM> and the interface board <NUM>. The main control board <NUM> communicates with the interface board <NUM> by using the IPC control channel.

The first network node <NUM> may be a router, a switch, or a network node having a forwarding function. The first network node <NUM> can implement a function of the first network node in the foregoing method embodiments. For specific execution steps, refer to the foregoing method embodiments.

<FIG> is a possible schematic structural diagram of the second network node in the foregoing embodiments. The second network node <NUM> may implement a function of the second network node in the embodiment shown in <FIG>, <FIG>, or <FIG>. Referring to <FIG>, the second network node <NUM> includes a receiving unit <NUM>, a determining unit <NUM>, and a processing unit <NUM>. These units may perform corresponding functions in the foregoing method example. For example, the receiving unit <NUM> is configured to receive various information received by the second network node in the foregoing method embodiments. The determining unit <NUM> is configured to determine various information determined by the second network node in the foregoing method embodiments. The processing unit <NUM> is configured to perform processing other than information receiving and sending and information determining that are performed by the second network node in the foregoing method embodiments. For example, the receiving unit <NUM> is configured to receive a packet that includes a segment list and that is sent by a first network node. The segment list includes a segment identifier of a network node on a path used to forward the packet. A first segment identifier in the segment list includes a first network performance parameter of the first network node. The determining unit <NUM> is configured to determine that a destination address of the packet is a segment identifier of the second network node <NUM>. The processing unit <NUM> is configured to calculate network performance based on the first network performance parameter in response to that the determining unit <NUM> determines that the destination address of the packet is the segment identifier of the second network node <NUM>.

It should be noted that, in this embodiment of the present invention, division into units is an example, and is merely logical function division. In actual implementation, there may be another division manner. Function units in this embodiment 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 may be integrated into one unit. For example, in the foregoing embodiment, the receiving unit and the sending unit may be a same unit or different units.

When an integrated unit is used, <FIG> is another possible schematic structural diagram of the second network node in the foregoing embodiments. The second network node <NUM> may also implement a function of the second network node in the embodiment in <FIG>, or implement a function of the third network node in the embodiment shown in <FIG>, or implement a function of the network node <NUM> in the embodiment shown in <FIG>.

The second network node <NUM> includes a storage unit <NUM>, a processing unit <NUM>, and a communications unit <NUM>. The processing unit <NUM> is configured to control and manage an action of the second network node <NUM>. For example, the processing unit <NUM> is configured to support the second network node <NUM> in performing the process S205 in <FIG>, the process S309 in <FIG>, the process S604 in <FIG>, and/or another process in the technology described in this specification. The communications unit <NUM> is configured to support communication between the second network node <NUM> and another network entity, for example, communication with the first network node in <FIG>, or communication with the second network node or the network node <NUM> shown in <FIG> or <FIG>. The storage unit <NUM> is configured to store program code and data of the second network node <NUM>.

The processing unit <NUM> may be a processor, for example, may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or another programming logic device, a transistor logic device, a hardware component, or any combination thereof. The processor may implement or execute various example logical blocks, modules, and circuits described with reference to content disclosed in the embodiments of the present invention. Alternatively, the processor may be a combination for implementing a computing function, for example, a combination of one or more microprocessors, or a combination of a DSP and a microprocessor. The communications unit <NUM> may be a transceiver. The storage unit <NUM> may be a memory.

When the processing unit <NUM> is the processor, the communications unit <NUM> is the transceiver, and the storage unit <NUM> is the memory, the second network node in this embodiment of the present invention may be a second network node <NUM> shown in <FIG>.

Referring to <FIG>, the 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 connected to each other by using 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 representation, only one thick line is used to represent the bus in <FIG>, but this does not mean that there is only one bus or only one type of bus.

Referring to <FIG>, an embodiment of the present invention provides another second network node <NUM>. The second network node <NUM> includes a main control board <NUM> and an interface board <NUM>. The main control board <NUM> includes a processor <NUM> and a memory <NUM>. The interface board <NUM> includes a processor <NUM>, a memory <NUM>, and an interface card <NUM>. The main control board <NUM> is coupled to the interface board <NUM>.

The hardware may implement functions of the second network node in the embodiment shown in <FIG>, or implement functions of the third network node in the embodiment shown in <FIG>, or implement corresponding functions of the network node <NUM> in the embodiment shown in <FIG>. For example, the memory <NUM> may be configured to store program code of the interface board <NUM>. The processor <NUM> is configured to invoke the program code in the memory <NUM> to trigger the interface card <NUM> to perform receiving and sending of various information that are performed by a corresponding network node in the foregoing method embodiments. The memory <NUM> may be configured to store program code of the main control board <NUM>. The processor <NUM> is configured to invoke the program code in the memory <NUM> to perform processing other than information receiving and sending of the corresponding network node in the foregoing method embodiments. For example, the interface card <NUM> is configured to receive a packet that includes a segment list and that is sent by a first network node. The segment list includes a segment identifier of a network node on a path used to forward the packet, and a first segment identifier in the segment list includes a first network performance parameter of the first network node. The processor <NUM> is configured to send the packet to the main control board <NUM>. The processor <NUM> is configured to: determine that a destination address of the packet is a segment identifier of the second network node, and calculate network performance based on the first network performance parameter. The memory <NUM> is configured to store program code and data of the main control board <NUM>. The memory <NUM> is configured to store program code and data of the interface board <NUM>.

The second network node <NUM> may be a router, a switch, or a network node having a forwarding function. The second network node <NUM> can implement a function of the corresponding network node in the foregoing method embodiments. For specific execution steps, refer to the foregoing method embodiments.

Referring to <FIG>, an embodiment of the present invention provides another service packet processing system <NUM>. The system <NUM> is configured to implement the packet processing method in the foregoing method embodiment. 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>, or implement functions of the first network node and the third network node in the embodiment shown in <FIG>, or implement functions of the network node <NUM> and the network node <NUM> in the embodiment shown in <FIG>. For example, the first network node <NUM> performs the processes S201, S202, S203, and S204 in <FIG>, the processes S301, S302, S303, and S304 in <FIG>, the process S601 in <FIG>, and/or another process performed by the first network node in the technology described in this specification. The second network node <NUM> is configured to implement the process S205 in <FIG>, the process S309 in <FIG>, and/or another process performed by the second network node in the technology described in this specification.

In an example, the system <NUM> further includes a third network node. The third network node is configured to implement functions of the second network node in the embodiment shown in <FIG> or <FIG>, for example, perform the processes S306, S307, and S308 in <FIG>.

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

"First" in the first network node in the embodiments of the present invention is merely used as a name identifier, and does not mean being the first in a sequence. For the words "second" and "third", this rule is also applicable.

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 of the embodiments. In addition, in the accompanying drawings of the embodiments of the first network node or the controller provided in the present invention, connection relationships between modules indicate that the modules have communication connections 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.

Methods or algorithm steps described in combination with 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 the processor, so that the processor can read information from the storage medium, and write information into the storage medium. Certainly, the storage medium may alternatively 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.

A person skilled in the art should be aware that in the foregoing one or more examples, functions described in the present invention may be implemented by hardware, software, firmware, or any combination thereof. When the functions are implemented by software, the functions may be stored in a computer-readable medium or transmitted as one or more instructions or code in a computer-readable medium. The computer-readable medium includes a computer storage medium and a communications medium, where the communications medium includes any medium that facilitates transmission of a computer program from one place to another. The storage medium may be any available medium accessible to a general-purpose or dedicated computer.

Claim 1:
A packet processing method for use in a segment routing network, the segment routing network comprising at least a first network node and a second network node, comprising:
obtaining (S201), by the first network node, a first packet that comprises a segment list, wherein the segment list comprises a segment identifier of one or more network nodes on a path used to forward the first packet;
obtaining (S202), by the first network node, a segment identifier of the second network node from the segment list, wherein the second network node is a next-hop segment node of the first network node on the path;
replacing (S203), by the first network node, a destination address of the first packet with the segment identifier of the second network node, and adding a network performance parameter of the first network node to the segment list, to generate a second packet; and
sending (S204), by the first network node, the second packet to the second network node;
wherein the adding a network performance parameter of the first network node to the segment list comprises:
adding the network performance parameter of the first network node to the segment identifier of the second network node; or
wherein the segment list comprises a segment identifier of the first network node, and the adding a network performance parameter of the first network node to the segment list comprises:
adding the network performance parameter of the first network node to the segment identifier of the first network node.