A data packet disorder simulation processing method, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611422142.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]目前传统的数据包乱序方法是基于Linux内核协议栈实现的,传统的基于内核的乱序方法在处理高速网络流量时,本身会成为性能瓶颈,其最大报文处理率(Mpps)相对较低,在进行复杂模拟时极易造成丢包,严重限制了被测设备的真实吞吐量测试,且传统的工具模拟的乱序方法往往具有较大的随机性,难以精确复现
[0017]本发明的数据包乱序模拟处理方法,当接收到客户端发送的同一轮询周期内对应的若干个数据包,将若干数据包的描述符存放在接收队列中,依次遍历接收队列中的每一描述符,将接收队列的读指针在当前时刻指向的描述符确定为目标描述符,若目标描述符对应的数据包对应有乱序规则,则根据该乱序规则中的乱序深度(需要进行乱序处理的描述符向后推移发出位置的个数)和乱序间隔(每两个相邻的需要进行乱序处理的相同乱序规则的描述符之间相隔的符合乱序规则的描述符的个数),确定目标描述符是否需要进行乱序处理,若目标描述符为需要进行乱序处理的描述符,则将目标描述符从接收队列中移动至乱序队列中,且当接收队列的读指针指向的描述符的位置满足目标描述符对应的发出位置时,将目标描述符从乱序队列中移动至发送队列中,根据目标描述符在发送队列中的位置,将目标描述符对应的数据包发送至服务端,通过设置乱序深度和乱序间隔的乱序参数,可以精确控制乱序发生的频率和程度,使得测试人员能够精确复现特定的乱序场景,且通过建立乱序队列,可以实现对进行乱序处理的描述符的监控和批量处理,以实现零丢包的高吞吐量,以在不影响整体流量转发速率的前提下进行乱序处理。
Smart Images

Figure CN122933561A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network fault simulation, and in particular to a method for simulating out-of-order data packets, an electronic device, and a storage medium. Background Technology
[0002] When simulating out-of-order transmission of data packets to detect network faults on the server (sending out-of-order data packets to the server to simulate fault scenarios in order to test the server's anti-interference and logical error prevention capabilities), it is necessary to out-of-order specific data packets, that is, to mess up the sending order of the data packets so that the data packets are not sent in the original order, such as being sent after a delay of several data packets.
[0003] Currently, traditional packet reordering methods are based on the Linux kernel protocol stack. When dealing with high-speed network traffic, traditional kernel-based reordering methods can become a performance bottleneck. Their maximum packet processing rate (Mpps) is relatively low, and they are prone to packet loss during complex simulations, which severely limits the actual throughput testing of the device under test. Furthermore, the reordering methods simulated by traditional tools often have a large degree of randomness, making them difficult to reproduce accurately. Summary of the Invention
[0004] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:
[0005] According to one aspect of this application, a method for simulating out-of-order data packets is provided, applied to a network fault testing device, wherein the data transmission end of the network fault testing device is connected to a client and a server.
[0006] The methods for simulating out-of-order data packets include:
[0007] Step S100: In response to receiving several data packets within the same polling period sent by the client, store the descriptors of the several data packets in the receiving queue;
[0008] Step S200: Determine the descriptor pointed to by the read pointer of the receive queue at the current moment as the target descriptor;
[0009] Step S300: If the data packet corresponding to the target descriptor has a preset out-of-order rule, then determine whether the target descriptor needs to be out-of-ordered based on the preset out-of-order depth and out-of-order interval in the out-of-order rule.
[0010] The out-of-order depth is the number of positions that the descriptor that needs to be out-of-ordered should be shifted backward; the out-of-order interval is the number of descriptors that conform to the out-of-order rule that are between any two adjacent descriptors that need to be out-of-ordered and have the same out-of-order rule.
[0011] Step S400: If the target descriptor is a descriptor that needs to be out of order, move the target descriptor from the receiving queue to the preset out-of-order queue.
[0012] Step S500: When the position of the descriptor pointed to by the read pointer of the receive queue meets the sending position corresponding to the target descriptor, the target descriptor is moved from the out-of-order queue to the send queue.
[0013] Step S600: Based on the position of the target descriptor in the sending queue, send the data packet corresponding to the target descriptor to the server.
[0014] According to another aspect of this application, a non-transitory computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored in the storage medium, the at least one instruction or the at least one program being loaded and executed by a processor to implement the aforementioned data packet out-of-order simulation processing method.
[0015] According to another aspect of this application, an electronic device is provided, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0016] The present invention has at least the following beneficial effects:
[0017] The packet out-of-order simulation processing method of the present invention, when receiving several data packets corresponding to the same polling period sent by the client, stores the descriptors of the several data packets in a receive queue, sequentially traverses each descriptor in the receive queue, and determines the descriptor pointed to by the read pointer of the receive queue at the current moment as the target descriptor. If the data packet corresponding to the target descriptor has an out-of-order rule, then based on the out-of-order depth (the number of positions to which the descriptor that needs out-of-order processing is shifted backward) and out-of-order interval (the number of descriptors that conform to the out-of-order rule between every two adjacent descriptors that need out-of-order processing and have the same out-of-order rule), it determines whether the target descriptor needs to be out-of-order processed. If the target descriptor needs to be out-of-order processed... For descriptors undergoing out-of-order processing, the target descriptor is moved from the receive queue to the out-of-order queue. When the position of the descriptor pointed to by the read pointer of the receive queue matches the sending position corresponding to the target descriptor, the target descriptor is moved from the out-of-order queue to the send queue. Based on the position of the target descriptor in the send queue, the data packet corresponding to the target descriptor is sent to the server. By setting out-of-order parameters such as out-of-order depth and out-of-order interval, the frequency and extent of out-of-order occurrence can be precisely controlled, enabling testers to accurately reproduce specific out-of-order scenarios. Furthermore, by establishing an out-of-order queue, it is possible to monitor and batch process descriptors undergoing out-of-order processing to achieve high throughput with zero packet loss, and to perform out-of-order processing without affecting the overall traffic forwarding rate. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart of a data packet out-of-order simulation processing method provided in an embodiment of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] This application proposes a method for simulating out-of-order data packets, which is applied to the out-of-order module of a network fault testing device.
[0022] The network fault testing equipment is connected to a switch. The data transmission end of the switch is connected to a client and a server. The network fault testing equipment includes several serial processing modules (such as delay module, repetition module, out-of-order module, packet loss module, etc.). Each processing module is hot-swappable with the network fault testing equipment. Any processing module can be connected to the network fault testing equipment to achieve the corresponding processing function.
[0023] The switch sends data packets sent by the client to the network fault testing device. After receiving the data packets, the network fault testing device processes the data through several processing modules and then sends it to the server via the switch.
[0024] like Figure 1 As shown, the data packet out-of-order simulation processing method includes:
[0025] Step S100: In response to receiving several data packets within the same polling period sent by the client, store the descriptors of the several data packets in the receiving queue;
[0026] The receiving queue is a data transmission queue shared by several processing modules of the network fault testing equipment. Through the receiving queue, data packets sent by the client to the network fault testing equipment are processed in several processing modules.
[0027] Step S200: Determine the descriptor pointed to by the read pointer of the receive queue at the current moment as the target descriptor;
[0028] Step S300: If the data packet corresponding to the target descriptor has a preset out-of-order rule, then determine whether the target descriptor needs to be out-of-ordered based on the preset out-of-order depth and out-of-order interval in the out-of-order rule.
[0029] The out-of-order depth is the number of positions that the descriptor that needs to be out-of-ordered should be shifted backward. For example, if the out-of-order depth is 5, it means that the descriptor should be shifted 5 positions backward from its current position.
[0030] The out-of-order interval is the number of descriptors that conform to the out-of-order rule that are between any two adjacent descriptors that need to be out-of-ordered and have the same out-of-order rule. In other words, it is the number of descriptors that conform to the out-of-order rule that are between any two adjacent descriptors that are being out-of-ordered under the same out-of-order rule.
[0031] Furthermore, step S300 includes steps S310-S370:
[0032] Step S310: Based on the data characteristics of the data packets corresponding to the target descriptor, determine whether the data packets corresponding to the target descriptor correspond to any preset out-of-order rule;
[0033] Step S310 includes steps S311-S313:
[0034] Step S311: Obtain the data characteristics of the data packet corresponding to the target descriptor;
[0035] Step S312: Match the data features of the data packet corresponding to the target descriptor with the data features corresponding to each preset out-of-order rule;
[0036] Step S313: If the matching degree between the data characteristics of the data packet corresponding to the target descriptor and the data characteristics corresponding to any preset out-of-order rule is greater than the preset matching degree threshold, then the out-of-order rule is determined as the out-of-order rule of the data packet corresponding to the target descriptor.
[0037] If the matching degree between the data characteristics of the data packet corresponding to the target descriptor and the data characteristics corresponding to each preset out-of-order rule is less than or equal to the preset matching degree threshold, then it is determined that the target descriptor does not need to be out-of-order processed.
[0038] Step S320: If the data packet corresponding to the target descriptor has any preset out-of-order rule, then the out-of-order rule of the data packet corresponding to the target descriptor is determined as the target out-of-order rule.
[0039] Step S330: Obtain the preset disorder interval q in the target disorder rule;
[0040] Step S340: In the receiving queue, the descriptor that is preceding the target descriptor and needs to be out of order, and whose out-of-order rule is the target out-of-order rule, is determined as the preceding out-of-order descriptor.
[0041] Step S350: Obtain the position r of the preorder out-of-order descriptor in the receive queue;
[0042] Step S360: Obtain the position u of the target descriptor in the receiving queue;
[0043] Step S370: If u≥r+q+m+1, then the target descriptor needs to be reordered; otherwise, the target descriptor does not need to be reordered.
[0044] Where m is the number of descriptors in the receiving queue whose out-of-order rule between the preceding out-of-order descriptor and the target descriptor is not the target out-of-order rule.
[0045] Step S301: If the target descriptor does not need to be out of order, move the target descriptor from the receive queue to the send queue and execute step S600.
[0046] Step S400: If the target descriptor is a descriptor that needs to be out of order, move the target descriptor from the receiving queue to the preset out-of-order queue.
[0047] Step S500: When the position of the descriptor pointed to by the read pointer of the receive queue meets the sending position corresponding to the target descriptor, the target descriptor is moved from the out-of-order queue to the send queue.
[0048] The emission position corresponding to the target descriptor is the position where it should be emitted after out-of-order processing.
[0049] Furthermore, step S500 includes steps S510-S550:
[0050] Step S510: Whenever the read pointer of the receive queue moves forward, obtain the position w of the descriptor that the read pointer of the receive queue points to after the move;
[0051] Step S520: Obtain the preset disorder depth p in the target disorder rule;
[0052] Step S530: Determine the emission position v = r + q + m + p + 1 corresponding to the target descriptor;
[0053] Step S540: If w≥v, then the w-th descriptor in the receiving queue is determined as the cutoff descriptor corresponding to the target descriptor;
[0054] Step S550: After the cutoff descriptor corresponding to the target descriptor is moved to the send queue, the target descriptor is moved from the out-of-order queue to the send queue, and the position of the target descriptor in the send queue is after the position of the corresponding cutoff descriptor in the send queue.
[0055] Step S501: After the target descriptor is dequeued from the out-of-order queue, increment the preset iteration number by one to obtain the target iteration number;
[0056] Step S502: If the target number of iterations is greater than the preset iteration number threshold, then disable the out-of-order function of the network fault test device.
[0057] The out-of-order function of the out-of-order module of the network fault testing equipment can be manually disabled by the user or by setting a shutdown condition (i.e., step S502). An iteration number threshold is set. When the number of descriptors that have completed out-of-order processing (i.e., the target iteration number) is greater than the iteration number threshold, it means that the number of data packets that have completed out-of-order processing in this round has reached the preset threshold. Then, the out-of-order function of the out-of-order module is disabled to achieve automatic stopping of the out-of-order module, prevent unlimited out-of-order processing of data packets, and reduce the system overhead of data packets.
[0058] Step S503: After the out-of-order function of the network fault test device is turned off, move the descriptors in the receive queue to the send queue in the order of enqueueing.
[0059] Step S504: After the out-of-order function of the network fault test device is turned off, discard the descriptors in the out-of-order queue.
[0060] After the out-of-order function of the out-of-order module of the network fault testing equipment is turned off, there may still be descriptors waiting to be dequeued in the out-of-order queue. In order to sort the descriptors in the out-of-order queue according to their corresponding processing time and not disrupt the order between the descriptors, the remaining descriptors in the out-of-order queue are discarded.
[0061] Step S600: Based on the position of the target descriptor in the sending queue, send the data packet corresponding to the target descriptor to the server.
[0062] Based on the position of the target descriptor in the sending queue, the data packet corresponding to the target descriptor can be sent to several processing modules of the network fault testing device. The processing flow is located in the processing module after the out-of-order module. If there are no other processing modules after the out-of-order module or the user has set the condition that the subsequent processing modules will not process the data packet, the data packet corresponding to the target descriptor will be sent directly to the server.
[0063] In addition, several processing modules of the network fault testing equipment also include a packet loss module, which is used to handle packet loss. Specifically, after step S200, steps S210-S280 are also included:
[0064] Step S210: Match the data features of the data packet corresponding to the target descriptor with the data features corresponding to each preset packet loss rule;
[0065] Step S220: If the data characteristics of the data packet corresponding to the target descriptor match the data characteristics of any preset packet loss rule more than the preset matching threshold, then the packet loss rule is determined as the target packet loss rule for the data packet corresponding to the target descriptor.
[0066] If the data characteristics of the data packet corresponding to the target descriptor match the data characteristics of each preset packet loss rule less than or equal to the preset matching threshold, then the target descriptor is moved from the receiving queue to the sending queue.
[0067] Step S231: If the target packet loss rule is a random packet loss rule, then generate a random number corresponding to the target descriptor using a preset pseudo-random number generator.
[0068] A pseudo-random number generator is used to generate uniformly distributed random numbers.
[0069] Step S232: If the random number corresponding to the target descriptor is less than the preset random probability value, then move the target descriptor from the receiving queue to the packet loss queue; otherwise, move the target descriptor from the receiving queue to the sending queue and execute step S280.
[0070] Step S230: If the target packet loss rule is a fixed percentage packet loss rule, then obtain the packet loss interval x and the number of consecutive packet losses y corresponding to the fixed percentage packet loss rule;
[0071] The packet loss interval is the number of descriptors that satisfy the fixed-ratio packet loss rule between two packet loss processes.
[0072] The consecutive packet loss count is the number of data packets dropped consecutively during the same packet loss processing.
[0073] Step S240: In the receiving queue, the descriptor that is preceding the target descriptor and needs to be processed for packet loss, and whose packet loss rule is a fixed proportion packet loss rule, is determined as the preceding packet loss descriptor.
[0074] Step S250: Obtain the position z of the preceding packet loss descriptor in the receive queue;
[0075] Step S260: Obtain the position u of the target descriptor in the receiving queue;
[0076] Step S270: If z+x+L+1≤u≤z+x+L+y, then move the target descriptor from the receive queue to the preset packet loss queue; otherwise, move the target descriptor from the receive queue to the send queue.
[0077] Where L is the number of descriptors in the receiving queue whose packet loss rule between the preceding packet loss descriptor and the target descriptor is not a fixed proportion packet loss rule.
[0078] Step S280: After the read pointer of the receive queue has finished reading all the descriptors in the receive queue, discard all the descriptors in the packet loss queue, clear the packet loss queue, and execute step S600.
[0079] After all descriptors in the receive queue have been read, all descriptors in the packet loss queue are discarded in batches to reduce the system overhead of packet loss processing.
[0080] The packet out-of-order simulation processing method of the present invention, when receiving several data packets corresponding to the same polling period sent by the client, stores the descriptors of the several data packets in a receive queue, sequentially traverses each descriptor in the receive queue, and determines the descriptor pointed to by the read pointer of the receive queue at the current moment as the target descriptor. If the data packet corresponding to the target descriptor has an out-of-order rule, then based on the out-of-order depth (the number of positions to which the descriptor that needs out-of-order processing is shifted backward) and out-of-order interval (the number of descriptors that conform to the out-of-order rule between every two adjacent descriptors that need out-of-order processing and have the same out-of-order rule), it determines whether the target descriptor needs to be out-of-order processed. If the target descriptor needs to be out-of-order processed... For descriptors undergoing out-of-order processing, the target descriptor is moved from the receive queue to the out-of-order queue. When the position of the descriptor pointed to by the read pointer of the receive queue matches the sending position corresponding to the target descriptor, the target descriptor is moved from the out-of-order queue to the send queue. Based on the position of the target descriptor in the send queue, the data packet corresponding to the target descriptor is sent to the server. By setting out-of-order parameters such as out-of-order depth and out-of-order interval, the frequency and extent of out-of-order occurrence can be precisely controlled, enabling testers to accurately reproduce specific out-of-order scenarios. Furthermore, by establishing an out-of-order queue, it is possible to monitor and batch process descriptors undergoing out-of-order processing to achieve high throughput with zero packet loss, and to perform out-of-order processing without affecting the overall traffic forwarding rate.
[0081] Furthermore, the delay module of the network fault testing device of this application also implements a data packet delay transmission simulation method, which includes:
[0082] Step S0100: In response to receiving several data packets to be delayed within the same polling period sent by the preceding module, store the descriptors of the several data packets to be delayed in the receiving queue.
[0083] The preceding module is one of the processing modules of the network fault testing equipment, and its processing flow is located before the delay module.
[0084] Step S0200: Determine the target number of cycles for the data packets to be delayed corresponding to each descriptor in the receiving queue based on the system's clock cycle count and the preset delay time interval.
[0085] Furthermore, step S0200 includes steps S0210-S0230:
[0086] Step S0210: Obtain the preset hardware delay quantization step size b1 and the preset delay time interval b2;
[0087] Hardware latency quantization step size is the smallest unit of measurement for latency precision (e.g., 10 microseconds), which is the smallest time granularity that the hardware (or the underlying scheduler) can recognize and process.
[0088] The delay interval is the time interval set by the operations and maintenance personnel for delaying the data packets they want to send (e.g., 25 microseconds, which means that the data packets are set to be sent after waiting for 25 microseconds).
[0089] Step S0220: Obtain the number of system clock cycles corresponding to the time each descriptor in the receive queue enters the receive queue, to obtain a clock cycle list B=(B1,B2,...,B...). s ,...,B t ); where s = 1, 2, ..., t; t is the number of descriptors in the receive queue; B s The number of system clock cycles corresponding to the s-th descriptor in the receive queue at the moment it enters the receive queue;
[0090] The number of clock cycles is the TSC value (Time Stamp Counter), which can be understood as "CPU heartbeat steps".
[0091] Step S0230: Determine the target number of cycles C of the data packet to be delayed corresponding to the s-th descriptor in the receive queue. s =Floor(b2 / b1)×b1+B s ;
[0092] Floor() is the default floor function.
[0093] The preset delay time interval is adjusted by using a rounding function. For example, a delay time interval of 25 microseconds means that the data packet is expected to wait in the receive queue for 25 microseconds before being sent. However, since the hardware timer corresponding to the clock cycle number only triggers the check at specific time nodes (such as 10 microseconds, 20 microseconds, 30 microseconds, etc.), and the set delay time interval of 25 microseconds is between the two time nodes of 20 microseconds and 30 microseconds, it already meets the condition of "waiting time greater than or equal to 20 microseconds" at the 20 microsecond time node. In order to avoid the additional jitter caused by waiting an extra 5 microseconds, the system directly lets it through at the 20 microsecond time node, ensuring that the actual delay is less than or equal to the preset delay time interval. This means that the network fault testing equipment promises "absolutely no additional burden on the network beyond expectations", ensuring the controllability of the test conditions, and exchanging extremely high throughput performance for minimal and controllable precision loss.
[0094] Step S0300: Move each descriptor in the receive queue to the delay queue of the delay module;
[0095] Furthermore, step S0300 includes steps S0310-S0320:
[0096] Step S0310: Obtain the total number of slots d0 in the delay queue and the number of occupied slots d1 in the delay queue at the current time.
[0097] Step S0320: If d0-d1≥t, then each descriptor in the receive queue will be moved to the delay queue in ascending order of the number of clock cycles corresponding to the system at the time it entered the receive queue.
[0098] The delayed queue is a first-in, first-out queue.
[0099] If d0-d1≥t, it means that the number of empty slots in the delay queue is sufficient to cover all descriptors in the receive queue. Then, they are moved to the delay queue in ascending order of the receive time (the time when they enter the receive queue) of each descriptor.
[0100] Step S0321: If d0-d1<t, then determine the data packets to be delayed corresponding to the first t-(d0-d1) descriptors in the delay queue as the target data packets, and move the corresponding descriptors to the sending queue;
[0101] If d0-d1<t, it means that the number of empty slots in the delay queue is insufficient to cover all descriptors in the receive queue. In this case, some descriptors in the delay queue need to be forcibly dequeued. Even if the dequeued descriptors do not meet the delay condition, all descriptors in the receive queue should be prioritized to enter the delay queue. This is to avoid abnormal data packet reception and data packet loss due to blockage in the receive queue. Since the receive queue is a data transmission queue shared by several processing modules of the network fault testing device, descriptors in the send queue need to be moved to the receive queue to allow the descriptors after delay processing to flow to the next processing module. If there are remaining descriptors in the receive queue that have not been moved to the delay queue, it is possible that descriptors in the send queue that have completed delay processing may cover descriptors in the receive queue that have not been moved to the delay queue and have not undergone delay processing, resulting in descriptor loss (i.e., loss of corresponding data packets) and pollution of the receive queue. Therefore, it is necessary to prioritize moving all descriptors in the receive queue to the delay queue in batches.
[0102] Step S0322: Move each descriptor in the receive queue to the delay queue in ascending order of the number of clock cycles corresponding to the system at the time it entered the receive queue.
[0103] Step S0400: At each polling time point of the hardware timer, the data packet to be delayed corresponding to the descriptor in the delay queue whose target cycle number meets the preset delay condition is determined as the target data packet, and the corresponding descriptor is moved to the sending queue of the delay module.
[0104] Furthermore, step S0400 includes steps S0410-S0456:
[0105] Step S0410: At each polling time point of the hardware timer, obtain the target number of cycles of the data packet to be delayed corresponding to the first descriptor in the delay queue;
[0106] Step S0420: If the target number of the data packet to be delayed corresponding to the first descriptor in the delay queue is less than or equal to the number of clock cycles corresponding to the system at the polling time point, then the data packet to be delayed corresponding to the descriptor is determined as the target data packet, and the descriptor is moved to the sending queue.
[0107] Since the system clock cycle count is the processing data of the counter, the clock cycle count increases with the system time. Therefore, if the target cycle count corresponding to the descriptor of the delay queue is less than or equal to the clock cycle count corresponding to the current polling time point (i.e., the check time point corresponding to the hardware timer), it means that the data packet corresponding to the descriptor has reached the preset delay time interval and met the delay completion condition. Then, the descriptor is moved to the sending queue.
[0108] Step S0430: Obtain the number k of data packets to be delayed corresponding to the descriptors that meet the preset delay conditions within the current delay processing time period in the delay queue;
[0109] The delay condition is the condition in step S0420 that "the target number of the data packets to be delayed corresponding to the first descriptor in the delay queue is less than or equal to the number of clock cycles corresponding to the system at the polling time point".
[0110] The start time of this delay processing period is the start time of this delay processing, and the end time of this delay processing period is the current time.
[0111] Step S0440: If k is greater than or equal to the preset data packet delay processing threshold, then disable the delay processing function of the delay module.
[0112] The delay processing function of the delay module can be manually turned off by the user, or it can be turned off by setting a shutdown condition (i.e., steps S0430-S0440). A data packet delay processing threshold is set. When the number of data packets that have completed delay processing in this round is greater than or equal to the data packet delay processing threshold, it means that the number of data packets that have completed delay processing in this round has reached the preset threshold. Then the delay processing function of the delay module is turned off to achieve automatic stopping of the delay module, prevent unlimited delay of data packets, and reduce the system overhead of data packets.
[0113] Step S0450: If the delay processing function of the delay module is turned off, and there is a descriptor in the delay queue, then execute step S0451.
[0114] If there is no descriptor in the delay queue, the delayed data packet will be sent to the subsequent module when the delayed data packet is received from the preceding module.
[0115] The subsequent module is one of the processing modules of the network fault testing equipment, and its processing flow is located after the delay module.
[0116] When a data packet in the delay queue meets the preset delay condition, it is checked whether the number of data packets that have completed delay processing has reached the preset data packet delay processing threshold. When the number of data packets that have completed delay processing reaches the data packet delay processing threshold, the delay processing function of the delay module is turned off. At this time, there may still be descriptors waiting to be dequeued in the delay queue (i.e., descriptors that do not meet the delay condition). Since the delay processing function of the delay module has been turned off, the delay condition judgment program has also been interrupted. It is necessary to process the remaining descriptors in the delay queue. This application proposes two processing strategies for the remaining descriptors in the delay queue. Users can choose one of them as needed. The two processing strategies are as follows:
[0117] Step S0451: If the residual data packet processing strategy set by the delay module is the first strategy, then the descriptor in the delay queue is discarded and the memory space where the corresponding data packet to be delayed is located is released.
[0118] The primary processing strategy for residual descriptors in the delay queue is a discard strategy, which means that the residual descriptors in the delay queue are directly discarded without being transferred to the next processing module.
[0119] If the residual data packet processing strategy set by the delay module is the second strategy, then step S0452 is executed;
[0120] Step S0452: If no delayed data packet is received from the preceding module, move the descriptor in the delay queue to the receive queue.
[0121] The second processing strategy for residual descriptors in the delay queue is a batch movement strategy. If no delayed data packet is received from the preceding module, it means that no new descriptor has entered the receiving queue after the delay module's delay processing function is turned off. In this case, the residual descriptors in the delay queue can be moved directly to the receiving queue in sequence without disrupting the order of descriptors in the receiving queue.
[0122] If a delayed data packet sent by the preceding module is received, then step S0453 is executed;
[0123] Step S0453: Determine the delayed data packet sent by the preceding module as the data packet to be processed;
[0124] Step S0454: Store the descriptor of the data packet to be processed in the delay queue;
[0125] Step S0455: If the number of descriptors in the delay queue is less than or equal to the preset maximum single processing volume, then each descriptor in the delay queue is moved to the receiving queue in sequence according to the increasing order of the number of clock cycles corresponding to the system at the time of entering the delay queue.
[0126] If the number of descriptors in the delay queue is greater than the preset maximum single processing volume, then proceed to step S0456.
[0127] The maximum processing capacity per cycle is the maximum number of movable descriptors per cycle. The maximum processing capacity per cycle is greater than the preset maximum number of data packets received in the polling cycle to ensure that the delay queue can be emptied quickly.
[0128] Step S0456: Move the first maximum number of descriptors in the delay queue to the receive queue, and repeat step S0456 until every descriptor in the delay queue has been moved to the receive queue.
[0129] If, under the second processing strategy for the remaining descriptors in the delay queue, a data packet to be delayed sent by the preceding module is received, it indicates that after the delay processing function of the delay module is turned off, a new descriptor has entered the receiving queue. The new descriptor does not require delay processing, but the receiving time corresponding to these new descriptors is later than the receiving time of the remaining descriptors in the delay queue. Therefore, in order not to disrupt the order of descriptors in the receiving queue, these new descriptors need to be circulated in the delay queue (steps S0453-S0456) to empty the delay queue, so that the position of these new descriptors in the receiving queue is after the position of the remaining descriptors in the delay queue in the receiving queue. This ensures that the order of descriptors in the receiving queue is determined according to the ascending order of receiving time, avoiding out-of-order situations.
[0130] Step S0500: If there is no descriptor for a data packet to be delayed in the receive queue, move the descriptor in the send queue to the receive queue to avoid the descriptor in the send queue that has undergone delay processing overwriting the descriptor in the receive queue that has not undergone delay processing.
[0131] Step S0600: According to the receiving queue, the corresponding target data packets are sent to the subsequent modules in sequence.
[0132] The data packet delay transmission simulation method of the present invention, when receiving several data packets to be delayed within the same polling cycle from a preceding module (a processing module in the network fault testing device whose processing flow precedes the delay module), stores the descriptors of the several data packets to be delayed in a receiving queue shared by the processing modules of the network fault testing device. Then, based on the system clock cycle number and a preset delay time interval, the target cycle number of the data packet to be delayed corresponding to each descriptor in the receiving queue is determined to represent the delay expiration time limit of each data packet to be delayed. Finally, each descriptor in the receiving queue is moved to the delay queue of the delay module, and a hardware timer is used to... At each polling time point, the data packet to be delayed corresponding to the descriptor in the delay queue that meets the preset delay condition for the target number of cycles is determined as the target data packet, and the corresponding descriptor is moved to the sending queue of the delay module. If there is no descriptor for the data packet to be delayed in the receiving queue, the descriptor in the sending queue is moved to the receiving queue. Finally, according to the receiving queue, the corresponding target data packets are sent to the subsequent modules (several processing modules in the network fault testing device, with the processing flow located after the delay module) in sequence. This improves the delay control precision of each data packet to be delayed from the millisecond level to the microsecond level, thus providing a guarantee for accurate delay fault simulation.
[0133] Furthermore, the repeat module of the network fault testing device of this application also implements a data packet repeat transmission simulation method, which includes:
[0134] Step S00100: In response to receiving n initial data packets sent by the client, establish a buffer queue;
[0135] The initial data packet in step S00100 can also be transmitted from the processing module located before the repeating module.
[0136] Where n is the preset threshold for the number of data packets received; the depth of the buffer queue is greater than or equal to 2n; the first n slots of the buffer queue are respectively placed with descriptors corresponding to n initial data packets, and the (n+1)th slot to the last slot of the buffer queue are empty slots.
[0137] Furthermore, step S00100 includes step S00110:
[0138] Step S00110: After receiving n initial data packets sent by the client, establish a buffer queue A=(A1,A2,...,A1) based on the descriptor corresponding to each initial data packet. i ,...,A j ); where i=1,2,...,j; j is the preset depth of buffer queue A; j≥g×n; g is the preset maximum number of data packet copies; A iThis is the identifier corresponding to the i-th slot in buffer queue A;
[0139] The descriptor of the h-th initial data packet is placed in A. h In the corresponding slots; h=1,2,...,n;
[0140] A n+1 To A j The corresponding slot is empty.
[0141] Step S00200: Place the read pointer of the buffer queue in the nth slot of the buffer queue, and place the write pointer of the buffer queue in the last slot of the buffer queue.
[0142] Specifically, the initial position of the read pointer of buffer queue A points to A. n The corresponding slot; the initial position of the write pointer of buffer queue A points to A. j The corresponding slot.
[0143] Step S00300: Determine the initial data packet corresponding to the descriptor in the slot pointed to by the read pointer and the copied data packet as the target data packet;
[0144] Furthermore, step S00300 includes steps S00310-S00330:
[0145] Step S00310: Based on the data characteristics of the initial data packet corresponding to the descriptor in the slot pointed to by the read pointer, determine whether the initial data packet corresponds to any preset replication rule;
[0146] Step S00310 includes steps S00311-S00314:
[0147] Step S00311: Determine the initial data packet corresponding to the descriptor in the slot pointed to by the read pointer as the data packet to be processed;
[0148] Step S00312: Obtain the data characteristics of the data packet to be processed;
[0149] Step S00313: Match the data characteristics of the data packet to be processed with the data characteristics corresponding to each preset replication rule;
[0150] The replication rules include the first replication rule, the second replication rule, and the third replication rule.
[0151] Specifically, the first replication rule is a fixed replication rule (i.e., replication a fixed number of times); the second replication rule is a periodic replication rule (i.e., replication is performed on data packets that meet the required number of periods); and the third replication rule is a random replication rule (i.e., replication is performed on data packets that need to be replicated a random number of times).
[0152] Step S00314: If the matching degree between the data characteristics of the data packet to be processed and the data characteristics corresponding to any preset replication rule is greater than the preset matching degree threshold, then the replication rule is determined as the replication rule corresponding to the initial data packet.
[0153] If the matching degree between the data characteristics of the data packet to be processed and the data characteristics corresponding to each preset replication rule is less than or equal to the preset matching degree threshold, then it is determined that the initial data packet will not be replicated.
[0154] Step S003141: If the initial data packet is not copied, then the initial data packet is determined as the target data packet;
[0155] Step S003142: Write the descriptor of the target data packet into the slot pointed to by the write pointer, and move the write pointer forward by one position. Then execute step S00500.
[0156] It should be noted that the target data packet in the packet retransmission simulation method is only the target data packet determined in the packet retransmission simulation method, and is different from the target data packet in the packet delay transmission simulation method.
[0157] If it is determined that an initial data packet will not be copied, the descriptor of the initial data packet is moved directly to the slot currently pointed to by the write pointer, thus completing the processing of the initial data packet.
[0158] Step S00320: If the initial data packet corresponds to any preset replication rule, then the initial data packet is replicated according to the replication rule of the initial data packet to obtain the replicated data packet corresponding to the initial data packet;
[0159] Specifically, step S00320 includes step S003211 (replication processing method for the first replication rule), steps S003221-S003223 (replication processing method for the second replication rule), and steps S003231-S003234 (replication processing method for the third replication rule).
[0160] Step S003211: If the replication rule corresponding to the initial data packet is the first replication rule, and the number of initial data packets that have undergone replication processing under the first replication rule is less than the preset number of replications corresponding to the first replication rule, then perform f replication processing on the initial data packet to obtain f replicated data packets corresponding to the initial data packet; otherwise, determine that the initial data packet will not be replicated.
[0161] Where f is the preset number of copies corresponding to the first copy rule; f≤g.
[0162] Each replication rule corresponds to a preset replication count (also known as the iteration count), which is the maximum number of data packets that can be replicated using that rule. For example, if the preset replication count for the first replication rule is 10, it means that a maximum of 10 data packets can be replicated using the first replication rule. If a data packet is the 11th data packet to match the first replication rule (i.e., the data characteristics of the data packet match the data characteristics corresponding to the first replication rule with a matching degree greater than the preset matching degree threshold), even though it has matched the replication rule, it cannot be replicated because it exceeds the preset replication count for the first replication rule. The application principle of the preset replication count for the second and third replication rules is the same as that for the first replication rule, and will not be repeated here. By setting the preset replication count for each replication rule, the maximum number of data packets that can be replicated by each replication rule can be ensured, avoiding infinite replication of data packets, reducing the space occupied by the buffer queue, and improving the transmission performance of data packets.
[0163] Step S003221: If the replication rule corresponding to the initial data packet is the second replication rule, and the number of initial data packets that have undergone replication processing under the second replication rule is less than the preset number of replications corresponding to the second replication rule, then obtain the number of initial data packets that have undergone replication processing.
[0164] If the number of initial data packets that have already undergone the replication process of the second replication rule is greater than or equal to the preset number of replications corresponding to the second replication rule, then it is determined that the initial data packet will not undergo replication processing.
[0165] Step S003222: If the number of initial data packets whose matching degree between data features and data features corresponding to any replication rule is greater than the preset matching degree threshold is a multiple of the preset number of cycles, then proceed to step S003223; otherwise, determine that the initial data packet will not be replicated.
[0166] Step S003223: Perform a copying process on the initial data packet a times to obtain a copied data packets corresponding to the initial data packet;
[0167] Where a is the preset number of copies corresponding to the second copy rule; a≤g.
[0168] Step S003231: If the replication rule corresponding to the initial data packet is the third replication rule, and the number of initial data packets that have undergone the replication process of the third replication rule is less than the preset number of replications corresponding to the third replication rule, then a random number corresponding to the initial data packet is generated by a preset pseudo-random number generator.
[0169] If the number of initial data packets that have already undergone the replication process of the third replication rule is greater than or equal to the preset number of replications corresponding to the third replication rule, then it is determined that the initial data packet will not undergo replication processing.
[0170] The pseudo-random number generator is used to generate uniformly distributed random numbers.
[0171] Step S003232: If the random number corresponding to the initial data packet is less than the preset random probability value, then proceed to step S003233; otherwise, determine that the initial data packet will not be copied.
[0172] Step S003233: Select any copy number from the preset copy number range [e1,e2] as the copy number corresponding to the initial data packet;
[0173] Where e1 is the minimum value of the replication interval; e2 is the maximum value of the replication interval; 1≤e1<e2≤g;
[0174] Step S003234: Based on the number of copies corresponding to the initial data packet, perform copy processing on the initial data packet to obtain the copied data packet corresponding to the initial data packet.
[0175] Step S00330: Determine the initial data packet and the copied data packet as the target data packet.
[0176] Step S00400: Write the descriptor of any unwritten target data packet to the slot pointed to by the write pointer, and move the write pointer forward one position. Repeat step S00400 until the descriptors of all target data packets have been written to the slot pointed to by the write pointer.
[0177] Step S00500: Move the read pointer forward by one position and execute step S00300 until the read pointer has read all the descriptors of the initial data packets in the buffer queue.
[0178] Step S00600: Move the first descriptor to the last descriptor in the buffer queue in batches so that the first descriptor is located in the first slot of the buffer queue, and send the corresponding target data packets to the server in sequence according to the buffer queue.
[0179] After all data packets have been processed (whether or not they have been copied), all processed data packets are concentrated at the back of the buffer queue, and the front of the buffer queue has empty slots. Therefore, all descriptors in the buffer queue need to be moved forward in batches. This movement is a whole-packet movement, rather than the method in the prior art where each data packet needs to be moved backward after processing. Compared with the prior art, this whole-packet forward movement method of this application does not require moving descriptors during data packet processing, saving performance overhead, and is particularly significant when the number of data packets is large or the number of copies required is too high.
[0180] The data packet retransmission simulation method of the present invention, after receiving n initial data packets sent by the client, establishes a buffer queue, such that the first n slots of the buffer queue are respectively placed with the descriptors corresponding to the n initial data packets, and the (n+1)th to the last slot of the buffer queue are empty slots. Then, the read pointer of the buffer queue is placed at the nth slot, and the write pointer is placed at the last slot. The initial data packet corresponding to the descriptor in the slot pointed to by the read pointer and the copied data packet are identified as target data packets. The descriptor of any target data packet that has not yet been written is written to the slot pointed to by the write pointer, and the write pointer is moved forward one position. This writing operation is repeated until the descriptors of all target data packets are... All data packets are written to the slot pointed to by the write pointer. The read pointer is then moved forward one position, and the new initial data packets are copied and written again until the read pointer has read all the descriptors of the initial data packets in the buffer queue. Finally, the first to the last descriptors in the buffer queue are moved forward in batches so that the first descriptor is in the first slot of the buffer queue. Based on the final buffer queue, the corresponding target data packets are sent to the server in sequence. This allows several initial data packets to be copied individually when performing duplicate data packet simulation detection on the server, based on the processing order of the read and write pointers from back to front, without having to migrate the data packets that have not yet been copied as a whole, thus reducing the performance overhead of data packet copying.
[0181] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.
[0182] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0183] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0184] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0185] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”
[0186] An electronic device according to this embodiment of the invention. The electronic device is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the invention.
[0187] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and buses connecting different system components (including memory and processor).
[0188] The storage device stores program code that can be executed by the processor to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of the present invention.
[0189] The storage may include readable media in the form of volatile storage, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).
[0190] The storage may also include programs / utilities having a set (at least one) of program modules, including but not limited to: an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0191] A bus can represent one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus that uses any of the various bus architectures.
[0192] Electronic devices can also communicate with one or more external devices (such as keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable users to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (such as routers, modems, etc.). This communication can be performed through input / output (I / O) interfaces. Furthermore, electronic devices can also communicate with one or more networks (such as local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapters.
[0193] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section of this specification.
[0194] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0195] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0196] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0197] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0198] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0199] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0200] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for simulating out-of-order data packets, applied to a network fault testing device, wherein the data transmission end of the network fault testing device is connected to a client and a server, characterized in that... The method includes: Step S100: In response to receiving several data packets corresponding to the same polling period sent by the client, store the descriptors of the several data packets in the receiving queue; Step S200: Determine the descriptor pointed to by the read pointer of the receiving queue at the current moment as the target descriptor; Step S300: If the data packet corresponding to the target descriptor has a preset out-of-order rule, then determine whether the target descriptor needs to be out-of-ordered according to the preset out-of-order depth and out-of-order interval in the out-of-order rule. The out-of-order depth is the number of positions that the descriptor requiring out-of-order processing is shifted backward; the out-of-order interval is the number of descriptors that conform to the out-of-order rule that separate two adjacent descriptors requiring out-of-order processing under the same out-of-order rule. Step S400: If the target descriptor is a descriptor that needs to be out of order, move the target descriptor from the receiving queue to a preset out-of-order queue. Step S500: When the position of the descriptor pointed to by the read pointer of the receiving queue satisfies the sending position corresponding to the target descriptor, the target descriptor is moved from the out-of-order queue to the sending queue. Step S600: Based on the position of the target descriptor in the sending queue, send the data packet corresponding to the target descriptor to the server.
2. The method according to claim 1, characterized in that, Step S300 includes: Step S310: Based on the data characteristics of the data packet corresponding to the target descriptor, determine whether the data packet corresponding to the target descriptor corresponds to any preset out-of-order rule; Step S320: If the data packet corresponding to the target descriptor has any preset out-of-order rule, then the out-of-order rule of the data packet corresponding to the target descriptor is determined as the target out-of-order rule. Step S330: Obtain the preset disorder interval q in the target disorder rule; Step S340: In the receiving queue, the descriptor that is located before the target descriptor and needs to be out of order, and whose out-of-order rule is the target out-of-order rule, is determined as the preceding out-of-order descriptor. Step S350: Obtain the position r of the preorder out-of-order descriptor in the receiving queue; Step S360: Obtain the position u of the target descriptor in the receiving queue; Step S370: If u≥r+q+m+1, then the target descriptor needs to be reordered; otherwise, the target descriptor does not need to be reordered. Where m is the number of descriptors in the receiving queue whose out-of-order rule between the preceding out-of-order descriptor and the target descriptor is not the target out-of-order rule.
3. The method according to claim 2, characterized in that, Step S310 includes: Step S311: Obtain the data characteristics of the data packet corresponding to the target descriptor; Step S312: Match the data features of the data packet corresponding to the target descriptor with the data features corresponding to each preset out-of-order rule; Step S313: If the matching degree between the data features of the data packet corresponding to the target descriptor and the data features corresponding to any preset out-of-order rule is greater than the preset matching degree threshold, then the out-of-order rule is determined as the out-of-order rule of the data packet corresponding to the target descriptor. If the matching degree between the data characteristics of the data packet corresponding to the target descriptor and the data characteristics corresponding to each preset out-of-order rule is less than or equal to the preset matching degree threshold, then it is determined that the target descriptor does not need to be out-of-order processed.
4. The method according to claim 3, characterized in that, Step S300 further includes: Step S301: If the target descriptor does not need to be out of order, then move the target descriptor from the receive queue to the send queue, and execute step S600.
5. The method according to claim 4, characterized in that, Step S500 includes: Step S510: Whenever the read pointer of the receive queue moves backward, obtain the position w of the descriptor that the read pointer of the receive queue points to after the move; Step S520: Obtain the preset disorder depth p in the target disorder rule; Step S530: Determine the emission position v = r + q + m + p + 1 corresponding to the target descriptor; Step S540: If w≥v, then the w-th descriptor in the receiving queue is determined as the cutoff descriptor corresponding to the target descriptor; Step S550: After the cutoff descriptor corresponding to the target descriptor is moved to the sending queue, the target descriptor is moved from the out-of-order queue to the sending queue, and the position of the target descriptor in the sending queue is after the position of the corresponding cutoff descriptor in the sending queue.
6. The method according to claim 5, characterized in that, After step S500, the method further includes: Step S501: After the target descriptor is dequeued from the out-of-order queue, the preset iteration number is incremented by one to obtain the target iteration number; Step S502: If the target number of iterations is greater than the preset iteration number threshold, then disable the out-of-order function of the network fault testing device; Step S503: After the out-of-order function of the network fault test device is turned off, the descriptors in the receiving queue are moved to the sending queue in the order of enqueueing. Step S504: After the out-of-order function of the network fault test device is turned off, the descriptors in the out-of-order queue are discarded.
7. The method according to claim 1, characterized in that, After step S200, the method further includes: Step S210: Match the data features of the data packet corresponding to the target descriptor with the data features corresponding to each preset packet loss rule; Step S220: If the matching degree between the data characteristics of the data packet corresponding to the target descriptor and the data characteristics corresponding to any preset packet loss rule is greater than the preset matching degree threshold, then the packet loss rule is determined as the target packet loss rule for the data packet corresponding to the target descriptor. If the matching degree between the data characteristics of the data packet corresponding to the target descriptor and the data characteristics corresponding to each preset packet loss rule is less than or equal to the preset matching degree threshold, then the target descriptor is moved from the receiving queue to the sending queue. Step S230: If the target packet loss rule is a fixed proportion packet loss rule, then obtain the packet loss interval x and the number of consecutive packet losses y corresponding to the fixed proportion packet loss rule; Step S240: In the receiving queue, the descriptor that is preceding the target descriptor and needs to be processed for packet loss, and whose packet loss rule is the fixed proportion packet loss rule, is determined as the preceding packet loss descriptor. Step S250: Obtain the position z of the preceding packet loss descriptor in the receiving queue; Step S260: Obtain the position u of the target descriptor in the receiving queue; Step S270: If z+x+L+1≤u≤z+x+L+y, then move the target descriptor from the receiving queue to the preset packet loss queue; otherwise, move the target descriptor from the receiving queue to the sending queue. Where L is the number of descriptors in the receiving queue whose packet loss rule between the preceding packet loss descriptor and the target descriptor is not the fixed proportion packet loss rule; Step S280: After the read pointer of the receive queue has finished reading all the descriptors in the receive queue, discard all the descriptors in the packet loss queue, clear the packet loss queue, and execute step S600.
8. The method according to claim 7, characterized in that, Step S230 further includes: Step S231: If the target packet loss rule is a random packet loss rule, then a random number corresponding to the target descriptor is generated by a preset pseudo-random number generator; the pseudo-random number generator is used to generate uniformly distributed random numbers. Step S232: If the random number corresponding to the target descriptor is less than the preset random probability value, then the target descriptor is moved from the receiving queue to the packet loss queue; otherwise, the target descriptor is moved from the receiving queue to the sending queue, and step S280 is executed.
9. A non-transitory computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the method as described in any one of claims 1-8.
10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 9.