Message marking method and device based on stream detection

By using the chip self-packaging function to update the register value in network equipment, and calculating the flow-by-stream detection marking cycle, the problem of inaccurate marking cycles in the existing technology is solved, high-precision flow-by-stream detection packet marking is achieved, and the Chip cost.

CN119484350APending Publication Date: 2025-02-18RUIJIE NETWORKS CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202311003882.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-10
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the existing flow-over detection technology, the accuracy of message marking is caused by the chip's lack of timer function and software timer deviation, which leads to inaccurate marking cycles and affects detection accuracy.

Method used

By presetting registers in the network device and updating the values ​​in the registers using the chip's self-packaging function, the data is calculated and the data is detected by the packets are detected by the packets, thereby achieving accurate message marking.

Benefits of technology

This method improves the accuracy of message marking during the flow detection process, reduces the cost of network device chips, and avoids deviations caused by software timers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484350A_ABST
    Figure CN119484350A_ABST
Patent Text Reader

Abstract

The invention discloses a message marking method and device based on stream detection. The method and device are used for improving the precision of message marking in the stream detection process. The method is applied to network equipment, and comprises the following steps: receiving a first message in a data stream for executing a target service; according to the service type to which the target service belongs, determining a marking period specified in a flow following detection rule corresponding to the data flow; determining values of a packet loss field and a time delay field included in a message header of the first message according to the marking period and a preset value in a register; marking the first message according to the determined values of the packet loss field and the time delay field; wherein the value of the register is progressively increased and updated according to the cycle of the self-sending packet of the network equipment chip, and the cycle of the self-sending packet is determined according to the mark cycles corresponding to the messages of the multiple service types respectively.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a message marking method and device based on flow detection. Background Art

[0002] Flow detection refers to adding detection data to the actual service message, thereby triggering the nodes involved in the forwarding process to collect relevant performance and data transmission characteristics according to the detection data, and summarize and analyze the data of each node through a centralized analyzer, so as to obtain the actual packet loss rate, delay and other performance indicators during the message transmission process. Among them, the process of adding detection data to the message can also be called coloring, specifically: adding a tag field to the message header and periodically modifying the value of the tag field. The tag field includes a delay field (D field) and a packet loss field (L field). When delay marking the message, the delay field of the first message in each cycle is usually set to 1, and the others are set to 0. Therefore, the transmission delay of the message marked as 1 is calculated based on the reception time of the message marked as 1 reported by the sender and the sending time of the message marked as 1 reported by the receiver. When marking packets for packet loss, the value of the packet loss field is modified periodically, for example, the packet loss field of the packets transmitted in the first cycle is set to 1, the packet loss field of the packets transmitted in the second cycle is set to 0, the packet loss field of the packets transmitted in the third cycle is set to 1, and so on. In this way, whether packet loss occurs and the amount of packet loss are determined based on the number of data packets reported by the sender and the number of data packets reported by the receiver in the same cycle in a certain cycle.

[0003] Therefore, it can be seen that in order to improve the accuracy of flow detection, it is necessary to accurately mark the message according to the set period. However, since general chips do not have the function of timer, the timer provided by the software will have a certain deviation, and the deviation will gradually increase with the accumulation of time. In order to solve this problem, the relevant technology proposes to use the Precision Time Protocol (PTP) clock chip to provide the timer function. The chip cost of this solution is relatively high. Summary of the invention

[0004] The present application provides a message marking method and device based on flow detection, which are used to improve the accuracy of message marking in the gift detection process while reducing the cost of network equipment chips.

[0005] In a first aspect, the present application proposes a packet marking method based on flow detection, which is applied to a network device, including:

[0006] Receiving a first message in a data stream for executing a target service;

[0007] Determine, according to the service type to which the target service belongs, a marking period specified in a flow detection rule corresponding to the data flow;

[0008] Determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the marking period and the value in the preset register;

[0009] Marking the first message according to the determined values ​​of the packet loss field and the delay field;

[0010] The value of the register is updated incrementally according to the period of the self-sending packet of the network device chip, and the period of the self-sending packet is determined according to the marking periods corresponding to the messages of various service types.

[0011] In some embodiments, the preset register includes a first register and a second register;

[0012] The first register is used to determine the value of the packet loss field, and when the value in the first register is updated to the first threshold, the value of the first register is reset to a preset initial value and a new round of incremental update is performed;

[0013] The second register is used to determine the value of the delay field. When the value in the second register is updated to the second threshold, the value of the second register is reset to the initial value and a new round of incremental update is performed; the first threshold is smaller than the second threshold.

[0014] In some embodiments, determining a value of a packet loss field included in a message header of the first message specifically includes:

[0015] Determine a target period at which the first message transmission moment is located according to the value in the first register and the marking period;

[0016] The value of the packet loss field included in the message header of the first message is determined according to the parity of the target period and the values ​​of the packet loss fields corresponding to the preset odd period and even period respectively.

[0017] In some embodiments, determining a value of a delay field included in a message header of the first message includes:

[0018] When the value of the packet loss field of the second message is different from the value of the packet loss field of the first message, determining that the value of the delay field of the first message is a first value;

[0019] When the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message, the value of the delay field of the first message is determined according to the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message.

[0020] In some embodiments, determining the value of the delay field of the first message according to the value of the second register at the transmission time of the first message and the value of the second register at the transmission time of the second message includes:

[0021] When the sum of the second value and the marking period is not greater than the first value, determining that the value of the delay field of the first message is the first value;

[0022] When the sum of the second value and the marking period is greater than the first value, it is determined that the value of the delay field of the first message is the second value.

[0023] In some embodiments, the period of the self-sent packet is the greatest common divisor of the marking periods corresponding to the messages of the multiple service types.

[0024] In a second aspect, the present application proposes a packet marking device based on flow detection, the device is a network device, or the device is applied to the network side device, and the device includes:

[0025] A communication unit, configured to receive a first message in a data stream for executing a target service;

[0026] A processing unit, configured to determine, according to a service type to which the target service belongs, a marking period specified in a flow detection rule corresponding to the data flow;

[0027] The processing unit is further used to determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the marking period and the value in the preset register;

[0028] The processing unit is further used to mark the first message according to the determined values ​​of the packet loss field and the delay field;

[0029] The value of the register is updated incrementally according to the period of the self-sending packet of the network device chip, and the period of the self-sending packet is determined according to the marking periods corresponding to the messages of various service types.

[0030] In some embodiments, the preset register includes a first register and a second register;

[0031] The first register is used to determine the value of the packet loss field, and when the value in the first register is updated to the first threshold, the value of the first register is reset to a preset initial value and a new round of incremental update is performed;

[0032] The second register is used to determine the value of the delay field. When the value in the second register is updated to the second threshold, the value of the second register is reset to the initial value and a new round of incremental update is performed; the first threshold is smaller than the second threshold.

[0033] In some embodiments, the processing unit, when determining a value of a packet loss field included in a message header of the first message, is specifically configured to:

[0034] Determine a target period at which the first message transmission moment is located according to the value in the first register and the marking period;

[0035] The value of the packet loss field included in the message header of the first message is determined according to the parity of the target period and the values ​​of the packet loss fields corresponding to the preset odd period and even period respectively.

[0036] In some embodiments, the processing unit, when determining the value of the delay field included in the message header of the first message, is specifically configured to:

[0037] When the value of the packet loss field of the second message is different from the value of the packet loss field of the first message, determining that the value of the delay field of the first message is a first value;

[0038] When the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message, the value of the delay field of the first message is determined according to the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message.

[0039] In some embodiments, the processing unit is specifically configured to:

[0040] When the sum of the second value and the marking period is not greater than the first value, determining that the value of the delay field of the first message is the first value;

[0041] When the sum of the second value and the marking period is greater than the first value, it is determined that the value of the delay field of the first message is the second value.

[0042] In some embodiments, the period of the self-sent packet is the greatest common divisor of the marking periods corresponding to the messages of the multiple service types.

[0043] In a third aspect, an electronic device is provided, the electronic device comprising a controller and a memory. The memory is used to store computer-executable instructions, and the controller executes the computer-executable instructions in the memory to use hardware resources in the controller to perform the operation steps of any possible implementation method of the first aspect.

[0044] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on the computer, the computer executes the above-mentioned methods.

[0045] The present application proposes to pre-set a register, use the chip's self-sending function to update the value in the register, and locate the flow detection marking period of the message according to the value in the register, so as to accurately mark the message. Compared with the solution of using PTP clock chip in traditional technology, the solution of the present application does not need to improve the chip of the network device, but is based on the chip's own self-sending function and register to provide accurate time information, saving the cost of the chip. Compared with the solution of providing a timer by software, the solution of the present application is based on hardware implementation, will not have deviations, and improve the accuracy of flow detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0047] Figure 1 A schematic diagram of the architecture of a flow detection scenario provided in an embodiment of the present application;

[0048] Figure 2 A schematic diagram of the principle of packet loss detection provided in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of the principle of delay detection provided in an embodiment of the present application;

[0050] Figure 4 A schematic diagram of a flow chart of a message marking method based on flow detection provided in an embodiment of the present application;

[0051] Figure 5 A schematic diagram of an architecture of an ingress node provided in an embodiment of the present application;

[0052] Figure 6 A schematic flow chart of another method for marking packets based on in-flow detection provided in an embodiment of the present application;

[0053] Figure 7 A schematic diagram of the structure of a message marking device based on flow detection provided in an embodiment of the present application;

[0054] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.

[0056] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented using sequences other than those illustrated or described herein. In addition, the term "and / or" herein is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " herein, unless otherwise specified, generally indicates that the previously associated objects are in an "or" relationship.

[0057] In order to facilitate understanding of the solution of this application, the technical terms involved in this application are first introduced:

[0058] (1) In-situ Flow Information Telemetry (IFIT) uses the Alternate Marking Measurement (AMM) technology to periodically mark the data flow in the network using the IFIT information carried in the message. The feature marking process can also be called coloring. Among them, the IFIT information can be used as a whole to form an IFIT header, for example, it can be used as an extension header of the Multi-Protocol Label Switching (MPLS) protocol. The nodes through which the data flow passes can report the collected timestamps, packet counts and other data to the analysis device, so that the analysis device can determine the network delay and packet loss. The fields used to count delay and packet loss are introduced: the packet loss field (also known as the L field, L flag, etc.), whose value is "1" indicates that the packet loss flag is in the coloring state, and the value is "0" indicates that the packet loss flag is in the non-coloring state. The delay field (also known as the D field, D flag, etc.), whose value is "1" indicates that the timestamp is collected, and the value is "0" indicates that the timestamp is not collected.

[0059] (2) Programming Protocol-Independent Packet Processors (P4) Programmable technology: It is a technology for programming the data forwarding plane, mainly used in data plane devices such as switches, network cards, routers and firewalls. In programmable chips, the general chip resources provided include: table, counter, meter and register.

[0060]

[0061] Table 1

[0062] Table 1 shows the usage of these common resources by the control plane / data plane. As shown in Table 1, Data Plane Can is the data plane, Control Plane Can is the control plane, and Value Set is the value set. The data plane can read and apply the table, select and clear the value set, and the data plane can also use counters to count, execute counters and registers; the control plane can read and write tables, value sets, counters and registers, and read and write the parameters of the meter. In this application, the characteristic fields, marking periods, and values ​​of characteristic fields in the message header are saved in the table for analyzing delay and packet loss, and the marking period is accurately controlled by setting the value of the register.

[0063] (3) pktgen: A high-performance network testing tool located in the Linux kernel layer. It is mainly used to test network drivers and network card devices. It supports multi-threading and can generate data packets with random MAC addresses, IP addresses, and UDP port numbers. It can meet the testing requirements of most network cards.

[0064] (4) Register: It is a very important storage unit in integrated circuits, composed of triggers. In integrated circuits, registers can be divided into two categories: registers used inside the circuit and registers that serve as external interfaces. Among them, internal registers cannot be accessed by external circuits or software, but only realize storage functions for internal circuits or meet the timing requirements of internal circuits.

[0065] (5) SRv6: A routing method for data forwarding based on IPv6, which is implemented by adding an extended header to the service message. SRv6 does not change the encapsulation structure of the original service message, but only encapsulates an IPv6 header in the outer layer of the original service message. The outer header includes multiple SIDs, which are used to indicate that the message is transmitted in the public network. However, when the number of SIDs increases, there are problems such as high overhead and chip requirements. Therefore, G-SRv6 is proposed in the related technology, which optimizes the basic frame format and forwarding mechanism of the SRv6 header to solve the problem of high SRv6 overhead.

[0066] The following is an introduction to the application scenarios to which the solution proposed in the embodiments of the present application is applicable. Figure 1, is a schematic diagram of the architecture of a flow detection scenario provided in an embodiment of the present application, which includes a source device, a destination device, multiple network devices and an analysis device. Exemplarily, the service data flow can be sent to the destination device via multiple network devices starting from the source device. The source device (or destination device) may also be referred to as a terminal device (User Equipment, UE), a mobile station (Mobile Station, MS), a mobile terminal device (Mobile Terminal, MT), etc., which is a device that provides voice and / or data connectivity to users, for example, a handheld device with wireless connection function, a vehicle-mounted device, etc. At present, some examples of terminal devices are: mobile phones, tablet computers, laptops, PDAs, mobile Internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in self driving, wireless terminal devices in remote medical surgery, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, wireless terminal devices in smart homes, etc. Figure 1 The network equipment in the scenario shown can be a base station, an access network device or an access node (English: Access Node, abbreviated as: AN). The base station is a public mobile communication base station, which is an interface device for mobile terminals to access the Internet. Specifically, it can be an evolved base station (English: Evolutional Node B, abbreviated as: eNB or eNodeB) in a long-term evolution (English: Long Term Evolution, abbreviated as: LTE) system, or a next-generation base station (English: Next Generation NodeB, abbreviated as: gNB) in a fifth-generation (English: 5th generation, abbreviated as: 5G) mobile communication system. This application does not limit this.

[0067] exist Figure 1In the flow detection scenario shown, the service data flow is marked and detected by the network device and reported to the analysis device, and the delay and packet loss of the data flow are determined by the analysis device. Specifically, in the marking and detection scenario, multiple network devices include three types of nodes: ingress, intermediate node and egress. Among them, the ingress node is a network device connected to the source device among multiple network devices, which is used to filter the data flow according to the service type executed by the multiple data flows received, determine the data flow that needs to be detected, add corresponding IFIT information to the determined data flow according to the flow detection rules, and collect statistical data such as the timestamp and number of packets of the marked message and report it to the analysis device. The egress node is a network device connected to the destination device among multiple network devices. The egress node is used to determine whether the data flow needs to be detected according to whether the message contains IFIT information. For the data flow that needs to be detected, the statistical data is collected and reported to the analysis device, and the IFIT information included in the message is removed. The intermediate node is a network device other than the ingress node and egress node in the transmission path of the data flow, and is used to determine whether the data flow needs to be detected based on whether the message contains IFIT information, and for the data flow that needs to be detected, further determine whether statistical data needs to be collected and reported to the analysis device based on the monitoring type indicated by the IFIT information. Exemplarily, Figure 1 The analysis device shown is used to determine the delay and packet loss during data flow transmission based on the statistical data reported by the ingress node, intermediate node and egress node. The function of the analysis device can be implemented by a server, a server cluster or a personal computer, and the present application does not limit the specific implementation of the analysis device. It should be noted that the above Figure 1 The following flow detection scenario shown is only an example, and the present application does not limit the number of network devices included in the scenario.

[0068] Next, combine Figure 1 The following scenario describes the specific process of packet loss detection and delay detection:

[0069] (1) Packet loss detection

[0070] For example, the schematic diagram of packet loss detection can be found in Figure 2 .like Figure 2As shown, the ingress node alternately colors the messages included in the detected data flow according to the set period, for example, the packet loss field included in the message header of the message is set to 1 in period i, and the packet loss field included in the message header of the message is set to 0 in period (i+1). The ingress node counts the number of messages transmitted in each period (including the period for packet loss coloring, such as period i, and the period for which packet loss coloring is not performed, such as period i+1), and reports the counted number to the analysis device. After receiving the data flow from the ingress node, the intermediate node first determines the detection type according to the service type to which the data flow belongs. The detection type includes end-to-end detection and hop-by-hop detection. If it is determined that the current data flow is of the type of hop-by-hop detection, the intermediate node counts the number of messages in one period according to the same period as the ingress node coloring, and reports the counted number to the analysis device. If it is determined that the current data flow is of the type of end-to-end detection, the intermediate node can directly forward the message to the next hop without detecting it. When the message is forwarded to the egress node, the egress node counts the number of messages in a cycle according to the same period as the ingress node, and reports the counted number to the analysis device. The analysis device calculates the packet loss of the message in each cycle based on the number of messages reported by each node. For example, in the end-to-end detection type, the number of packet losses in cycle i is: PacketLoss[i] = Tx[i]-Rx[i], where Tx[i] is the number of packets colored in cycle i counted by the ingress node, and Rx[i] is the number of packets colored in cycle i counted by the egress node.

[0071] (2) Delay Detection

[0072] For example, the schematic diagram of the delay detection principle can be found in Figure 3 .like Figure 3As shown, the ingress node performs delay coloring on a message in each detection cycle, for example, the last message in the i-th cycle is colored, and the delay field included in the message header of the last message in cycle i is set to 1, and the delay fields in the message headers of other messages in cycle i are all 0. Further, the ingress node reports the receiving timestamp of the message colored in cycle i to the analysis device, wherein the receiving timestamp is the time when the ingress node receives the delay-colored message from the source device. After receiving the data stream, the intermediate node first determines the detection type of the data stream. If the data stream is hop-by-hop detection, the intermediate node records the receiving timestamp and sending timestamp of the delay-colored message in each cycle, and reports the recorded information to the analysis device. If the data stream is end-to-end detection, the intermediate node forwards the message normally without detection. After receiving the data stream, the egress node also records the sending timestamp of the delay-colored message in each cycle, and reports the sending timestamp to the analysis device. Among them, the sending timestamp counted by the egress node refers to the time when the delay-colored message is sent to the destination device. The analysis device calculates the one-way delay and two-way delay of the data flow based on the timestamp information reported by each node. Among them, the one-way delay refers to the delay from the ingress node to the egress node, which can be determined by the difference between the sending timestamp reported by the egress node and the receiving timestamp reported by the ingress node. The two-way delay refers to the scenario where the data flow is transmitted bidirectionally on the same path, and the analysis device uses the sum of the delay from the ingress node to the egress node and the delay from the egress node to the ingress node in the reverse direction as the two-way delay of the data flow.

[0073] Combined with the above introduction to the traditional flow detection scheme, it can be seen that the accuracy of the cycle is crucial to the accuracy of the flow detection. If the cycle marking is incorrect, the accuracy of the flow detection will be reduced. However, the timer provided by the software in the traditional solution has a large deviation and cannot solve the problem of inaccurate cycle. If the timer function is provided by the PTP clock chip, the cost of the chip will be higher. Based on this, the present application proposes a message marking method for flow detection, which updates the value in the register based on the self-sending function of the traditional switching chip, calculates the marking period of the flow detection based on the value in the register, improves the accuracy of the marking period, and thus improves the accuracy of the flow detection.

[0074] Next, combine Figure 1 The scenario shown is a detailed introduction to the solution of this application. Figure 4 , is a flow chart of a packet marking method based on flow detection provided in an embodiment of the present application. For example, Figure 4 The method flow shown can be Figure 1 The ingress node included in the illustrated scenario may be implemented, or may be implemented by specific components in the ingress node, such as a chip, a processor, or other components in the ingress node. Figure 4The method flow shown specifically includes:

[0075] 401. Receive a first message in a data flow for executing a target service.

[0076] Exemplarily, the ingress node may receive a first message from a source device, where the source address of the first message is the address of the source device, and the destination address is the address of the destination device.

[0077] 402 : Determine, according to the service type to which the target service belongs, a marking period specified in a flow detection rule corresponding to the data flow.

[0078] Optionally, the service types of different services are used to characterize the degree of demand for delay and packet loss during data transmission. For example, for services with high real-time requirements such as augmented reality (AR) services, the demand for delay is high, so the delay marking period can be set shorter, such as 1 second as a delay marking period. For video services, the real-time requirements are not high, but the demand for packet loss rate is high in order to improve user experience, so the packet loss marking period can be set shorter.

[0079] As an optional method, information recording the flow detection rules of various types of services can be stored at the ingress node, for example, in the form of a table, and the information in the table includes the flow detection rules corresponding to different types of messages and the marking period specified in the flow detection rules. Exemplarily, the table storing the flow detection rules can be called a flow matching table (FLOW_MATCH_TABLE), and the marking period recorded in the table can also be called a coloring period, including delay coloring and packet loss coloring.

[0080] 403. Determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the determined marking period and the value of the preset register.

[0081] Among them, the value in the register is incrementally updated according to the self-sending packet period of the chip of the ingress node, and the self-sending packet period is determined according to the flow detection rules of the messages of various service types. Exemplarily, the period of the self-sending packet can be set by the greatest common divisor of the marking periods of various services. For example, the marking periods of five services are defined as: 1 second, 3 seconds, 10 seconds, 30 seconds and 300 seconds, and the greatest common divisor of the five marking periods is 1 second, then the self-sending packet period of the chip can be set to 1 second. Therefore, the value stored in the register can be incrementally updated with a period of 1 second.

[0082] Furthermore, when receiving the first message, the ingress node can read the value in the register, and calculate the period in which the first message is sent based on the read value and the marking period corresponding to the first message. Further, the values ​​of the corresponding packet loss field and delay field can be determined based on the period in which the first message is located.

[0083] 404. Mark the first message according to the determined values ​​of the packet loss field and the delay field.

[0084] When marking the first message, the packet loss field and the delay field included in the message header of the first message may be set to the values ​​determined in the above step 403. Exemplarily, the delay marking may also be referred to as D coloring, and the packet loss marking may also be referred to as L coloring. For ease of description, the delay marking and the packet loss marking are used as examples for further description.

[0085] Based on the above scheme, the present application proposes to pre-set the register, use the chip's self-sending function to update the value in the register, and locate the flow detection marking period of the message according to the value in the register, so as to accurately mark the message. Compared with the solution of using PTP clock chip in traditional technology, the solution of the present application does not need to improve the chip of the network device, but is based on the chip's own self-sending function and register to provide accurate time information, saving the cost of the chip. Compared with the solution of providing a timer by software, the solution of the present application is based on hardware implementation, will not have deviations, and improve the accuracy of flow detection.

[0086] For example, the value in the preset register proposed in the embodiment of the present application can be updated using the self-transmitting packet period of the chip in the ingress node, for example, the value in the register is increased by 1 each time a self-transmitting packet is received. The period of the self-transmitting packet can be set to the greatest common divisor of the marking period of multiple services.

[0087] Optionally, the preset register may include two: a first register and a second register. Among them, the value of the first register is used to determine the packet loss field marking period of the first message. Exemplarily, the first register may also be called a relative time register (Relative Time Register, RT_REG), and the value stored in the first register is the relative time (RT). The embodiment of the present application proposes that a first threshold value can be set for the first register, or the first threshold value can also be called "MAX_RT". If the RT value stored in the first register reaches the first threshold value after the incremental update according to the self-sent packet, the RT value can be reset to the preset initial value and a new round of incremental update can be performed. Optionally, the initial value can be set to 1 or to 0. Exemplarily, when setting the first threshold value, it can be set based on the marking period of multiple services. For example, twice the least common multiple of the marking period of multiple services can be used as the first threshold value, and the marking periods of five services are defined as: 1 second, 3 seconds, 10 seconds, 30 seconds and 300 seconds, respectively, then the first threshold value can be set to 600.

[0088] The value of the second register is used to determine the delay field marking period of the first message. Exemplarily, the second register may also be referred to as an absolute time register (AT_REG), and the value stored in the second register is the absolute time (AT). The embodiment of the present application proposes that a second threshold value may be set for the second register, or the second threshold value may also be referred to as "MAX_AT". If the AT value stored in the second register reaches the second threshold value after being incrementally updated according to the self-sent packet, the AT value may be reset to the initial value and a new round of incremental updates may be performed. Exemplarily, since the second register is used to determine the marking period of the delay field, in order to improve the ability to detect timeouts, the second threshold value may be set to be greater than the first threshold value to avoid the problem of being unable to detect timeouts due to the AT value being set to the initial value. A larger value may be assigned to the second threshold value, such as 2^31 may be used as the second threshold value.

[0089] Further, each time the ingress node receives a service message, it can read the values ​​stored in the first register and the second register, and determine whether the message needs to be marked and the marking method according to the read values. Below, the packet loss marking and delay marking processes proposed in the embodiments of the present application are introduced respectively. For the convenience of description, the marking of the first message is still used as an example for introduction.

[0090] In some scenarios, when a packet loss mark is performed on a first message, after receiving the first message, it can be determined whether packet loss marking is required based on the type of service to which the first message belongs, and the packet loss marking period specified in the flow detection rule can be determined. Optionally, a traffic matching table can be pre-defined, which records whether packets of each type of service need to be marked for packet loss and the packet loss marking period. Further, after determining the packet loss marking period of the first message according to the traffic matching table, the value stored in the first register can be read, and the target period of the first message can be calculated based on the read value and the packet loss marking period of the first message, that is, determine which period the first message belongs to. For example, when the first message is received, the value in the first register is updated to 101, and it is found that the marking period corresponding to the first message is 5 seconds, then it can be determined that the first message is in the 21st period. Furthermore, the value of the packet loss field of the first message in the 21st cycle can be determined according to a predefined packet loss marking rule, that is, it can be determined whether the packet loss field of the first message in the 21st cycle should be marked as "1" or "0". For example, the predefined packet loss marking rule stipulates that the packet loss field of the message in the odd cycle is marked as "1", and the packet loss field of the message in the even cycle is marked as "0", then the ingress node can set the value of the packet loss field included in the message header of the first message in the 21st cycle to 1. On the contrary, if the first message is in the 20th cycle, the ingress node can set the value of the packet loss field in the message header of the first message to "0".

[0091] In other scenarios, when delay marking is performed on the first message, it is known that the delay marking can be performed on a set message within the marking period, for example, the first message or the last message in each marking period is generally used for delay marking. For the convenience of description, the delay marking of the first message in each marking period is introduced as an example in this application. Exemplarily, when judging whether to delay mark the first message, it can be judged whether the first message needs to be delayed marked based on whether the first message and the previous message of the first message are in the same delay marking period. For the convenience of description, the previous message of the first message in the data stream is subsequently defined as the second message. If the first message and the second message belong to the same delay marking period, the first message will not be delayed marked, so that the delay field included in the message header of the first message remains "0"; conversely, if the first message and the second message belong to different delay marking periods, the first message is delayed marked, and the delay field included in the message header of the first message is set to "1".

[0092] In some embodiments, the packet loss marking period can be set to be the same as the delay marking period. When determining whether the first message and the second message belong to the same delay marking period, it can be achieved by determining whether the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message. In one possible case, if the values ​​of the packet loss fields of the first message and the second message are different, it means that the first message and the second message are in different packet loss marking periods and different delay marking periods, and the first message can be delayed marked.

[0093] In another possible case, if the values ​​of the packet loss fields of the first message and the second message are the same, it means that the first message and the second message are in the same packet loss marking period, or it means that the first message and the second message are in a packet loss marking period with the same parity, for example, the second message is a message received in the first packet loss marking period, and no message is transmitted in the second packet loss marking period, and the first message is a message received in the third packet loss marking period, so the values ​​of the packet loss fields of the first message and the second message are the same. In this case, the present application proposes that it is possible to further determine whether to delay mark the first message based on the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message. Exemplarily, the ingress node can calculate the sum of the second value and the delay marking period, and determine whether to delay mark the first message based on the comparison result of the first value and the calculated sum. When the calculated sum is greater than the first value, it means that the first message and the second message belong to the message of the same delay marking period, so the first message can be delayed without marking. When the calculated sum is not greater than the first value, it indicates that the first message and the second message do not belong to the same delay marking period, and therefore the first message can be delay marked.

[0094] As an optional method, when judging whether to delay mark the first message, the judgment can also be made based on the information stored in the pre-set third register, wherein the third register stores the packet loss mark state (LAST_L_STATE) of the previous message, which is used to represent the value of the packet loss field of the previous message (i.e., the second message) of the first message. The third register also stores the delay mark timeout time (LAST_EXP_AT) of the previous message, which is the sum of the second value stored in the second register at the transmission time of the second message and the delay mark period, that is: LAST_EXP_AT = LAST_AT + PERIOD. Among them, LAST_AT is the second value, and PERIOD is the delay mark period. When delay marking the first message, LAST_L_STATE can be read from the third register first. If it is determined that LAST_L_STATE is different from the packet loss mark state of the first message, the first message can be delayed marked. If LAST_L_STATE is the same as the packet loss marking state of the first message, LAST_EXP_AT can be further read from the third register and the first value of the first message transmission time can be read from the second register. When LAST_EXP_AT is greater than the first value, the first message is not delayed; when LAST_EXP_AT is not greater than the first value, the first message is delayed. Optionally, after the first message is delayed and the packet loss is marked, the LAST_EXP_AT and LAST_L_STATE stored in the third register can also be updated.

[0095] Furthermore, after performing delay marking and packet loss marking on the first message, the ingress node may perform encapsulation and other processing on the first message and send the first message to the next hop node.

[0096] In some scenarios, the solutions described in the above embodiments may be implemented by the ingress node, or by various computing modules included in the ingress node. Figure 5 , is a schematic diagram of an ingress node architecture provided in an embodiment of the present application. Figure 5As shown, the ingress node includes a self-sending packet module, a message receiving module, a first register, a second register, a third register, a flow detection and matching module, a delay marking module and a packet loss marking module. Among them, the self-sending packet module is used to send data packets according to the self-sending packet period, and the first register and the second register are used to update the values ​​stored in each according to the data packets sent by the self-sending packet module. The message receiving module is used to receive messages from the source device, and the flow detection and matching module is used to determine the value of the packet loss field of the message received by the message receiving module according to the values ​​stored in the first register and the second register, and instruct the packet loss marking module to mark the message. The third register is used to store the packet loss marking state of the previous message, and to store the sum of the value in the second register corresponding to the previous message and the delay marking period. The flow detection and matching module is used to determine whether it is necessary to mark the message with a delay according to the information stored in the second register and the third register, and instruct the delay marking module to mark the message when it is determined that marking is required.

[0097] Below, based on Figure 5 The schematic diagram of the structure shown in the figure further introduces the solution proposed in this application. Figure 6 , is a flow chart of a message marking method based on flow detection provided in an embodiment of the present application, which specifically includes:

[0098] 601. A message receiving module receives a first message from a source device, and transmits the first message to a flow detection and matching module.

[0099] 602. The flow detection and matching module determines a marking period of the first message according to a service type to which the first message belongs, and reads a first value stored in a first register.

[0100] The value in the first register is updated incrementally according to the data periodically sent by the self-sending packet module. The specific updating process of the value stored in the first register can refer to the relevant introduction in the above embodiment, which will not be repeated here.

[0101] 603 , the flow detection and matching module determines a value of a packet loss field in the first message according to the marking period and the first value.

[0102] Exemplarily, the process of determining the value of the packet loss field according to the first value and the marking period can refer to the relevant introduction in the above embodiment, which will not be repeated here.

[0103] 604 , the flow detection and matching module reads the information stored in the second register and the third register, and determines the value of the delay field of the first message by combining the read information and the value of the packet loss field in the first message.

[0104] In step 604, there are three specific cases:

[0105] Case 1: The value of the packet loss field of the previous message of the first message stored in the third register is different from the value of the packet loss field of the first message. In this case, it means that the previous message of the first message and the first message do not belong to the same marking period. The flow detection matching module can determine that the first message needs to be delayed marked, and then it can be determined that the value of the delay field of the first message is the first value (that is, 1).

[0106] Case 2: the value of the packet loss field of the previous message of the first message stored in the third register is the same as the value of the packet loss field of the first message, and the sum of the value of the second register at the time of transmission of the previous message stored in the third register and the delay marking period is not greater than the first value. In this case, it means that the previous message of the first message and the first message do not belong to the same marking period. The flow detection matching module can determine that the first message needs to be delayed marked, and then it can be determined that the value of the delay field of the first message is the first value (that is, 1).

[0107] Case three: the value of the packet loss field of the previous message of the first message stored in the third register is the same as the value of the packet loss field of the first message, and the sum of the value of the second register at the time of transmission of the previous message stored in the third register and the delay marking period is greater than the first value. In this case, it means that the previous message of the first message and the first message belong to the same marking period, and the flow detection matching module can determine that there is no need to delay mark the first message, and then it can be determined that the value of the delay field of the first message is the second value (that is, 0).

[0108] 605 , the flow detection and matching module sends the determined value of the packet loss field of the first message to the packet loss marking module, and sends the determined value of the delay field of the first message to the delay marking module.

[0109] 606. The packet loss marking module marks the first message as lost according to the received value.

[0110] 607. The delay field module performs a delay mark on the first message according to the received value.

[0111] 608 , the flow detection and matching module updates the information stored in the third register.

[0112] The specific updating process can be found in the introduction of the above embodiment and will not be described in detail here.

[0113] Based on the same concept as the above method, see Figure 7, a packet marking device 700 based on flow detection is provided in an embodiment of the present application, and the device 700 is used to perform the steps in the above-mentioned method embodiments, and in order to avoid repetition, it will not be described again here. The device 700 includes: a communication unit 701 and a processing unit 702.

[0114] The communication unit 701 is used to receive a first message in a data stream for executing a target service;

[0115] A processing unit 702 is configured to determine a marking period specified in a flow detection rule corresponding to the data flow according to a service type to which the target service belongs;

[0116] The processing unit 702 is further configured to determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the marking period and the value in the preset register;

[0117] The processing unit 702 is further configured to mark the first message according to the determined values ​​of the packet loss field and the delay field;

[0118] The value of the register is updated incrementally according to the period of the self-sending packet of the network device chip, and the period of the self-sending packet is determined according to the marking periods corresponding to the messages of various service types.

[0119] In some embodiments, the preset register includes a first register and a second register;

[0120] The first register is used to determine a value of the packet loss field, and when the value in the first register is updated to a first threshold, the value of the first register is reset to an initial value and a new round of incremental update is performed;

[0121] The second register is used to determine the value of the delay field. When the value in the second register is updated to the second threshold, the value of the second register is reset to the initial value and a new round of incremental update is performed; the first threshold is smaller than the second threshold.

[0122] In some embodiments, the processing unit 702, when determining a value of a packet loss field included in a message header of the first message, is specifically configured to:

[0123] Determine a target period at which the first message transmission moment is located according to the value in the first register and the marking period;

[0124] The value of the packet loss field included in the message header of the first message is determined according to the parity of the target period and the values ​​of the packet loss fields corresponding to the preset odd period and even period respectively.

[0125] In some embodiments, the processing unit 702, when determining a value of a delay field included in a message header of the first message, is specifically configured to:

[0126] When the value of the packet loss field of the second message is different from the value of the packet loss field of the first message, determining that the value of the delay field of the first message is a first value;

[0127] When the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message, the value of the delay field of the first message is determined according to the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message.

[0128] In some embodiments, the processing unit 702 is specifically configured to:

[0129] When the sum of the second value and the marking period is not greater than the first value, determining that the value of the delay field of the first message is the first value;

[0130] When the sum of the second value and the marking period is greater than the first value, it is determined that the value of the delay field of the first message is the second value.

[0131] In some embodiments, the period of the self-sent packet is the greatest common divisor of the marking periods corresponding to the messages of the multiple service types.

[0132] Figure 8 The electronic device 800 in the embodiment of the present application may further include a communication interface 803, which is, for example, a network port, through which the electronic device may transmit data, for example, the communication interface 803 may implement the functions of the communication unit 701 described in the above embodiment.

[0133] In the embodiment of the present application, the memory 802 stores instructions that can be executed by at least one controller 801. The at least one controller 801 can be used to execute each step in the above method by executing the instructions stored in the memory 802. For example, the controller 801 can implement the above Figure 7 The function of the processing unit 702 in.

[0134] Among them, the controller 801 is the control center of the electronic device, which can use various interfaces and lines to connect various parts of the entire electronic device, by running or executing instructions stored in the memory 802 and calling data stored in the memory 802. Optionally, the controller 801 may include one or more processing units, and the controller 801 may integrate an application controller and a modem controller, wherein the application controller mainly processes the operating system and application programs, etc., and the modem controller mainly processes wireless communications. It is understandable that the above-mentioned modem controller may not be integrated into the controller 801. In some embodiments, the controller 801 and the memory 802 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0135] The controller 801 may be a general controller, such as a central processing unit (CPU), a digital signal controller, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, which may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general controller may be a microcontroller or any conventional controller, etc. The steps disclosed in the embodiments of the present application may be directly executed by a hardware controller, or may be executed by a combination of hardware and software modules in the controller.

[0136] The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 802 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (English: Random Access Memory, referred to as: RAM), a static random access memory (English: Static Random Access Memory, referred to as: SRAM), a programmable read-only memory (English: Programmable Read Only Memory, referred to as: PROM), a read-only memory (English: Read Only Memory, referred to as: ROM), an electrically erasable programmable read-only memory (English: Electrically Erasable Programmable Read-Only Memory, referred to as: EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 802 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0137] By designing and programming the controller 801, for example, the code corresponding to the method introduced in the aforementioned embodiment can be solidified into the chip, so that the chip can execute the steps of the aforementioned method during operation. How to design and program the controller 801 is a technology well known to those skilled in the art and will not be repeated here.

[0138] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0139] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a controller of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the controller of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0140] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0142] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0143] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A message marking method based on flow detection, characterized in that: The method is applied to a network device, and the method comprises: Receiving a first message in a data stream for executing a target service; Determine, according to the service type to which the target service belongs, a marking period specified in a flow detection rule corresponding to the data flow; Determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the marking period and the value in the preset register; Marking the first message according to the determined values ​​of the packet loss field and the delay field; The value of the register is updated incrementally according to the period of the self-sending packet of the network device chip, and the period of the self-sending packet is determined according to the marking periods corresponding to the messages of various service types.

2. The method according to claim 1, characterized in that The preset register includes a first register and a second register; The first register is used to determine the value of the packet loss field, and when the value in the first register is updated to the first threshold, the value of the first register is reset to a preset initial value and a new round of incremental update is performed; The second register is used to determine the value of the delay field. When the value in the second register is updated to the second threshold, the value of the second register is reset to the initial value and a new round of incremental update is performed; the first threshold is smaller than the second threshold.

3. The method according to claim 2, characterized in that Determining a value of a packet loss field included in a message header of the first message specifically includes: Determine a target period at which the first message transmission moment is located according to the value in the first register and the marking period; The value of the packet loss field included in the message header of the first message is determined according to the parity of the target period and the values ​​of the packet loss fields corresponding to the preset odd period and even period respectively.

4. The method according to claim 2 or 3, characterized in that: Determining a value of a delay field included in a message header of the first message includes: When the value of the packet loss field of the second message is different from the value of the packet loss field of the first message, determining that the value of the delay field of the first message is a first value; When the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message, the value of the delay field of the first message is determined according to the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message.

5. The method according to claim 4, characterized in that The determining, according to a value of the second register at the transmission time of the first message and a value of the second register at the transmission time of the second message, a value of the delay field of the first message includes: When the sum of the second value and the marking period is not greater than the first value, determining that the value of the delay field of the first message is the first value; When the sum of the second value and the marking period is greater than the first value, it is determined that the value of the delay field of the first message is the second value.

6. The method according to any one of claims 1 to 3, characterized in that: The period of the self-sending packet is the greatest common divisor of the marking periods respectively corresponding to the messages of the multiple service types.

7. A message marking device based on flow detection, characterized in that: The device is a network device, or the device is applied to the network side device, and the device includes: A communication unit, configured to receive a first message in a data stream for executing a target service; A processing unit, configured to determine, according to a service type to which the target service belongs, a marking period specified in a flow detection rule corresponding to the data flow; The processing unit is further used to determine the values ​​of the packet loss field and the delay field included in the message header of the first message according to the marking period and the value in the preset register; The processing unit is further used to mark the first message according to the determined values ​​of the packet loss field and the delay field; The value of the register is updated incrementally according to the period of the self-sending packet of the network device chip, and the period of the self-sending packet is determined according to the marking periods corresponding to the messages of various service types.

8. The device according to claim 7, characterized in that The preset register includes a first register and a second register; The first register is used to determine the value of the packet loss field, and when the value in the first register is updated to the first threshold, the value of the first register is reset to a preset initial value and a new round of incremental update is performed; The second register is used to determine the value of the delay field. When the value in the second register is updated to the second threshold, the value of the second register is reset to the initial value and a new round of incremental update is performed; the first threshold is smaller than the second threshold.

9. The device according to claim 8, characterized in that The processing unit, when determining a value of the packet loss field included in the message header of the first message, is specifically configured to: Determine a target period at which the first message transmission moment is located according to the value in the first register and the marking period; The value of the packet loss field included in the message header of the first message is determined according to the parity of the target period and the values ​​of the packet loss fields corresponding to the preset odd period and even period respectively.

10. The device according to claim 8 or 9, characterized in that The processing unit, when determining a value of the delay field included in the message header of the first message, is specifically configured to: When the value of the packet loss field of the second message is different from the value of the packet loss field of the first message, determining that the value of the delay field of the first message is a first value; When the value of the packet loss field of the second message is the same as the value of the packet loss field of the first message, the value of the delay field of the first message is determined according to the first value of the second register at the transmission time of the first message and the second value of the second register at the transmission time of the second message.

11. The device according to claim 10, characterized in that The processing unit is specifically used for: When the sum of the second value and the marking period is not greater than the first value, determining that the value of the delay field of the first message is the first value; When the sum of the second value and the marking period is greater than the first value, it is determined that the value of the delay field of the first message is the second value.

12. The device according to any one of claims 7 to 9, characterized in that: The period of the self-sending packet is the greatest common divisor of the marking periods respectively corresponding to the messages of the multiple service types.

13. An electronic device, characterized in that: The electronic device comprises a controller and a memory, The memory is used to store computer programs or instructions; The controller is used to execute the computer program or instructions in the memory so that the method according to any one of claims 1 to 6 is performed.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called by a computer, the computer executes the method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Method for detecting packet loss along with flow of alternately-dyed mobility network

    CN121604012A

  • An alternate colored mobile network in-stream packet loss detection method

    CN121604012B

  • Network data monitoring method and related apparatus

    WO2026199975A1