An interrupt delay control method, electronic equipment and storage medium

By adjusting the interrupt interval using the Net DIM algorithm and a nanosecond-level timer while the network card hardware interrupt is disabled, the CPU load and network latency issues caused by the network card interrupt frequency are resolved, thus optimizing network performance.

CN122309410APending Publication Date: 2026-06-30BEIJING YUNMAI XINLIAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING YUNMAI XINLIAN TECH CO LTD
Filing Date
2026-05-11
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, excessively high or low network card interrupt frequencies can lead to excessive CPU load and increased network latency, especially noticeable in network cards with multiple TCP streams. How to adaptively adjust the interrupt frequency to reduce latency is an urgent problem to be solved.

Method used

The Network Dynamic Interrupt Adjustment Algorithm (Net DIM) is adopted to dynamically adjust the interrupt interval between the network card's data receiving and transmitting ends by setting nanosecond-level timers and register status flags when the network card's hardware interrupts are disabled, thereby reducing the interrupt frequency.

Benefits of technology

By dynamically adjusting the interrupt interval, the network card data processing flow is optimized, the interrupt frequency is reduced, network performance is improved, and CPU load and latency are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309410A_ABST
    Figure CN122309410A_ABST
Patent Text Reader

Abstract

This invention provides an interrupt delay control method, an electronic device, and a storage medium. The method includes: when the network card hardware interrupt is disabled and there are no pending data packets in the data receive queue and the data send queue, determining the target send interrupt interval and the target receive interrupt interval according to a network dynamic interrupt adjustment algorithm; comparing the target send interrupt interval and the target receive interrupt interval with zero and a first time interval, respectively, to determine whether to start a nanosecond-level timer; adjusting the status flags of the send completion queue and the receive completion queue; and when the status flags of the send completion queue and the receive completion queue are both 1, adjusting the network card hardware interrupt to the enabled state and setting the status flags of the send completion queue and the receive completion queue to 0, so as to control the interrupt delay of the network card's data receive end and data send end through the network card driver software, thereby reducing the interrupt frequency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network interface card (NIC) data transmission, and in particular to an interrupt delay control method, electronic device, and storage medium. Background Technology

[0002] A network card interrupt is a signal sent by the network card hardware to the CPU (Central Processing Unit) to notify the CPU that "there is data to process" or "transmission is complete". It is the starting point of the entire network packet sending and receiving process. When the network card completes an operation (such as receiving a data packet or completing the transmission), it sends an interrupt request to the CPU through the interrupt controller. After receiving the interrupt, the CPU saves the current context (registers, program counter, etc.) and jumps to the interrupt handler (i.e., the interrupt service routine registered by the network card driver), executes the interrupt handling (usually scheduling NAPI and waking up waiting processes), restores the context after processing, and continues to execute the interrupted task.

[0003] Therefore, interrupt frequency (i.e., the number of hardware interrupts responded to and processed per second) affects CPU load, response latency, and overall performance. If the interrupt frequency is too high (e.g., tens of thousands to hundreds of thousands of interrupts per second), the CPU will spend a lot of time saving / restoring context and processing interrupts instead of running applications. This will lead to high CPU utilization, decreased throughput, and increased latency (although the interrupt frequency is high, the CPU is busy processing interrupts, and actual application processing may be delayed). Conversely, if the interrupt frequency is too low (e.g., tens to hundreds of interrupts per second), network cards will have to wait a long time after arrival before being processed by the CPU. This will also lead to a significant increase in network latency, and this phenomenon is more pronounced in network cards with multiple TCP streams (e.g., dual-port unidirectional 64 streams). Therefore, how to adaptively adjust the interrupt frequency of the network card to reduce the latency caused by interrupts is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows: According to one aspect of this application, an interruption delay control method is provided, comprising: Step S100: In response to the network card hardware interrupt being in the off state, and in the case that there are no pending data packets in the network card's data receiving queue and data sending queue, the time interval between the network card's data receiving end and the time interval between the network card's data sending end and the next interrupt is determined according to the preset network dynamic interrupt adjustment algorithm. Step S200: Compare the time interval of the next interruption at the data sending end with the preset transmission interruption time interval, and determine the smaller value of the two as the target transmission interruption interval; Step S300: Compare the time interval of the next interruption at the data receiving end with the preset receiving interruption time interval, and determine the smaller value of the two as the target receiving interruption interval; The transmit interrupt time interval and receive interrupt time interval are set using a preset standard command-line tool; the standard command-line tool is used to query and configure the Ethernet card's driver parameters and hardware settings. Step S400: If the target transmission interrupt interval is greater than zero, start the preset nanosecond-level timer corresponding to the data transmission end; otherwise, set the status flag of the transmission completion queue register of the network card driver to 1. Step S500: If the target reception interrupt interval is greater than the preset first time interval, start the preset nanosecond-level timer corresponding to the data receiving end; otherwise, set the status flag of the network card driver's reception completion queue register to 1. Step S600: When the nanosecond-level timer corresponding to the data sending end reaches the target transmission interrupt interval, set the status flag of the transmission completion queue register to 1; Step S700: When the nanosecond-level timer corresponding to the data receiving end reaches the target receiving interrupt interval, set the status flag of the receiving completion queue register to 1. Step S800: When the status flags of the transmit completion queue register and the receive completion queue register are both 1, adjust the network card hardware interrupt to the enabled state, and set the status flags of the transmit completion queue register and the receive completion queue register to 0.

[0005] 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 interrupt delay control method.

[0006] According to another aspect of this application, an electronic device is provided, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0007] The present invention has at least the following beneficial effects: The interrupt delay control method of this invention, when the network card hardware interrupt is disabled and there are no pending data packets in the network card's data receive queue and data send queue, determines the time interval between the network card's data receiver and data sender in the next interruption according to the network dynamic interrupt adjustment algorithm. Then, it compares the time interval between the data sender and data sender in the next interruption with a preset transmission interruption time interval, and determines the smaller value as the target transmission interruption interval. Similarly, it compares the time interval between the data receiver and data sender in the next interruption with a preset reception interruption time interval, and determines the smaller value as the target reception interruption interval. The target transmission interruption interval and the target reception interruption interval are compared with zero and a first time interval, respectively. If the target transmission interruption interval is greater than zero, a nanosecond-level timer corresponding to the data sender is started; otherwise, the status flag of the network card driver's transmission completion queue register is set to 1. If the target reception interruption interval is greater than the first time interval, a preset nanosecond-level timer corresponding to the data receiver is started; otherwise, the network card driver's reception completion queue is set to 1. The status flag of the queue register is set to 1; when the nanosecond-level timer corresponding to the data sending end reaches the target transmission interrupt interval, the status flag of the transmission completion queue register is set to 1; when the nanosecond-level timer corresponding to the data receiving end reaches the target reception interrupt interval, the status flag of the reception completion queue register is set to 1; when both the status flags of the transmission completion queue register and the reception completion queue register are 1, the network card hardware interrupt is enabled, and the status flags of the transmission completion queue register and the reception completion queue register are set to 0. This is achieved by setting high-precision nanosecond-level timers at the data sending and receiving ends of the network card, comparing the interrupt time interval determined by the network dynamic interrupt adjustment algorithm with the preset interrupt interval, and determining the shorter interval as the corresponding nanosecond-level timer time threshold. This allows the network card driver software to control the interrupt delay at the data receiving and sending ends of the network card during the transmission of multiple TCP streams, thereby reducing the interrupt frequency. Attached Figure Description

[0008] 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.

[0009] Figure 1 A flowchart of an interrupt delay control method provided in an embodiment of the present invention. Detailed Implementation

[0010] 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.

[0011] This application proposes an interrupt delay control method, such as... Figure 1 As shown, it includes: Step S100: In response to the network card hardware interrupt being in the off state, and in the case that there are no pending data packets in the network card's data receiving queue and data sending queue, the time interval between the network card's data receiving end and the time interval between the network card's data sending end and the next interrupt is determined according to the preset network dynamic interrupt adjustment algorithm. When the network card hardware interrupt is disabled, it means that the network card cannot perform interrupts at this time, and the CPU enters the interrupt context.

[0012] The data receive queue is the queue where data packets received by the network card are stored, and the data send queue is the queue where data packets to be sent by the network card are stored. Data packets to be processed are the data packets in the data receive queue and the data send queue.

[0013] The network dynamic interrupt moderation algorithm in this application is the Net DIM algorithm (Network Dynamic Interrupt Moderation, a general network dynamic interrupt moderation algorithm in the Linux kernel). The Net DIM algorithm uses dynamic adjustment of interrupt frequency to reduce interrupt frequency, optimize packet processing, and improve network performance. However, most current methods for adjusting interrupt frequency using the Net DIM algorithm are implemented in hardware. Therefore, when a network card without Net DIM algorithm is required to achieve dynamic interrupt frequency moderation, the hardware structure of the network card needs to be modified, which undoubtedly increases costs and affects the original hardware structure of the network card. Therefore, the method in this application adopts the Net DIM algorithm from a software perspective, which can achieve dynamic interrupt frequency moderation without changing the hardware structure of the network card.

[0014] Furthermore, step S100 includes steps S110-S190: Step S110: When the network card hardware interrupt is in the disabled state, poll the data packets to be processed in the data receive queue and data send queue of the network card and process them. Step S120: If there are no data packets to be processed in either the data receiving queue or the data sending queue of the network card, determine the data receiving end or the data sending end of the network card as the data transmission end; When the network card hardware interrupt is disabled, i.e., when the network card is not interrupted, it continuously polls the data receive queue and the data send queue for pending data packets (i.e., the network card is in NAPI Poll mode). Poll mode is a working mode in computer systems that actively checks the device status or whether the data is ready. In Poll mode, the CPU no longer passively waits for network card hardware notifications, but actively and repeatedly checks whether the network card hardware has data to process. NAPI Poll mode, short for NewAPI Poll, is a hybrid interrupt and polling network data packet receiving mechanism in the Linux kernel. It solves the performance problem of traditional interrupt mode in high-traffic scenarios (i.e., each data packet triggering an interrupt will cause the CPU to be overwhelmed by interrupts (i.e., "interrupt storm")). The core idea of ​​Poll is to notify the first data packet with an interrupt, and then process subsequent data packets in batches using polling. As long as there is a data packet in the data receive queue or the data send queue, the data packet must be processed. When there is no data packet to be processed in either the data receive queue or the data send queue of the network card, it means that there is no data packet to be processed in the network card hardware. At this time, an interrupt can be enabled, that is, the network card interrupt is enabled, to notify the CPU: at this time the interrupt line is in an idle state, and the time interval between the next interrupt of the data receiver and the data sender is determined.

[0015] Step S121: Obtain several preset interrupt adjustment arrays corresponding to the data transmission end at the current time; The interrupt adjustment array is a pre-set array that includes two values ​​(an interrupt time interval and a maximum number of data packets). These two values ​​are the trigger conditions for the next interrupt. When the number of data packets corresponding to the data transmission end reaches the maximum number of data packets in the set interrupt adjustment array, or when the time period after the end of the last interrupt reaches the interrupt time interval in the set interrupt adjustment array, a new round of network card interrupts is started (that is, the network card hardware interrupt is adjusted to the off state).

[0016] Step S122: If the time interval and maximum number of data packets in each interrupt adjustment array corresponding to the data transmission end at the current time are the same, then the time interval of the data transmission end in this interrupt is determined as the time interval of the data transmission end in the next interrupt; otherwise, proceed to step S130. If the time interval and maximum number of data packets are the same in each interrupt adjustment array corresponding to the data transmission end at the current moment, it means that the interrupt adjustment arrays corresponding to the data transmission end are the same at this time. This indicates that the Net DIM mechanism is not started at this time, and there is no dynamic adjustment of the network card's interrupt frequency. In this case, the interrupt time interval for the next interrupt will always be the interrupt time interval set in the interrupt adjustment array.

[0017] If the time interval and maximum number of data packets in each interrupt adjustment array at the current moment are different at the data transmission end, it means that the Net DIM mechanism has been started to dynamically adjust the interrupt frequency of the network card. The interrupt time interval for the next interrupt will be determined by the interrupt time interval in the interrupt adjustment array determined in subsequent steps.

[0018] Step S130: Obtain some data processed by the data transmission end during the current interruption time period and some data processed by the data transmission end during the previous interruption time period. The data processed during the interruption period includes the number of data packets, the number of bytes, the number of interruptions, and the number of completions.

[0019] Step S140: According to the rate index conversion function in the preset network dynamic interruption adjustment algorithm, perform rate conversion calculations on several data processed by the data transmission end during the current interruption time period and several data processed by the data transmission end during the previous interruption time period, so as to obtain the number of bytes processed per millisecond, the number of data packets processed per millisecond, and the number of events processed per millisecond corresponding to the data transmission end during the current interruption time period, as well as the number of bytes processed per millisecond, the number of data packets processed per millisecond, and the number of events processed per millisecond corresponding to the data transmission end during the previous interruption time period. The rate index conversion function uses the existing conversion function in the Net DIM algorithm, which will not be described in detail here.

[0020] Step S150: If the number of bytes processed per millisecond in the current interruption period is at least a preset percentage higher than the number of bytes processed per millisecond in the previous interruption period, then proceed to step S180. If the number of bytes processed per millisecond during the current interruption period is reduced by at least a preset percentage compared to the number of bytes processed per millisecond during the previous interruption period, then step S190 is executed. Otherwise, proceed to step S160; Step S160: If the number of data packets processed per millisecond in the current interruption period is at least a preset percentage higher than the number of data packets processed per millisecond in the previous interruption period, then proceed to step S180. If the number of data packets processed per millisecond during the current interruption period is reduced by at least a preset percentage compared to the number of data packets processed per millisecond during the previous interruption period, then step S190 is executed. Otherwise, proceed to step S170; Step S170: If the number of events processed per millisecond in the current interruption period is at least a preset percentage higher than the number of events processed per millisecond in the previous interruption period, then proceed to step S180. If the number of events processed per millisecond by the data transmission end during the current interruption period is reduced by at least a preset percentage compared to the number of events processed per millisecond by the data transmission end during the previous interruption period, then step S190 is executed. Otherwise, the time interval of the current interruption at the data transmission end will be determined as the time interval of the next interruption at the data transmission end; Step S180: Determine the time interval of the data transmission end in the next interruption from the interrupt adjustment array that is one level higher than the interrupt adjustment array corresponding to the current interruption in the several preset interrupt adjustment arrays corresponding to the data transmission end. Step S190: Determine the time interval of the data transmission end in the next interruption from the interrupt adjustment array that is one level lower than the interrupt adjustment array corresponding to the current interruption in the preset interrupt adjustment array corresponding to the data transmission end.

[0021] When determining the interrupt adjustment array corresponding to the next interrupt, the number of bytes processed per millisecond in the current interrupt time period is compared with the number of data packets processed per millisecond in the previous interrupt time period. Then, the number of events processed per millisecond is compared, and so on. When a value judgment condition (increase or decrease of a preset percentage) is met, the corresponding interrupt adjustment array can be determined. By comparing the rate of change of the number of bytes, data packets, and processed events in two interrupt time periods, the time interval of the next interrupt can be determined, thus realizing the dynamic adjustment of the interrupt time interval.

[0022] After determining the time interval for the next interrupt, existing interrupt adjustment methods simply initiate the interrupt after waiting for the determined time interval. For example, if the determined time interval for the next interrupt is 64 microseconds, the next interrupt is initiated after waiting 64 microseconds after the previous interrupt ends. However, this method has been found to have a relatively high interrupt frequency in practical applications. Therefore, this application sets a corresponding nanosecond-level timer, hrtimer (high resolution timer, a high-precision timer mechanism in the Linux kernel that can provide timing accuracy at the microsecond or even nanosecond level), at both the data transmitting and receiving ends of the network card to extend the interrupt enable time. The specific implementation steps are as follows: Step S200: Compare the time interval of the next interruption at the data sending end with the preset transmission interruption time interval, and determine the smaller value of the two as the target transmission interruption interval; Step S300: Compare the time interval of the next interruption at the data receiving end with the preset receiving interruption time interval, and determine the smaller value of the two as the target receiving interruption interval; By setting the transmit interrupt time interval and receive interrupt time interval, and comparing them with the corresponding next interrupt time interval, the smaller value is determined as the target transmit interrupt time interval and target receive interrupt time interval. This achieves maximum control over the next interrupt time interval. If the time interval in the determined interrupt adjustment array is large (this interrupt adjustment array is already the lowest level interrupt adjustment array), but the user still wants to reduce the next interrupt time interval, the user only needs to adjust the transmit interrupt time interval or receive interrupt time interval to achieve this purpose, without having to set the value in the interrupt adjustment array. This reduces the complexity of operation, improves the accuracy of interrupt time interval determination, and ensures that the next interrupt time interval will not exceed the set transmit interrupt time interval and receive interrupt time interval, guaranteeing the upper limit of the next interrupt time interval.

[0023] The transmit interrupt time interval and receive interrupt time interval are set using a preset standard command-line tool; the standard command-line tool is used to query and configure the Ethernet card's driver parameters and hardware settings; several preset interrupt adjustment arrays corresponding to the data transmission end are also set using the standard command-line tool.

[0024] Specifically, as a feasible preferred embodiment, the standard command-line tool in this application is ethtool (which is the standard command-line tool in the Linux system used to query and control the hardware and driver settings of network interface cards). The standard command-line tool configures the interrupt adjustment array corresponding to the data receiving end through the command ethtool -C eth0 rx-adaptive; the standard command-line tool configures the interrupt adjustment array corresponding to the data sending end through the command ethtool -C eth0 tx-adaptive (that is, it configures several interrupt adjustment arrays in step S121, which can be set to the same value or different values).

[0025] The standard command-line tool adjusts the receive interrupt time interval using the command `ethtool -C eth0 rx-usecs`; the standard command-line tool adjusts the transmit interrupt time interval using the command `ethtool -C eth0 tx-usecs`, for example, by setting both the receive and transmit interrupt time intervals to zero.

[0026] Step S400: If the target transmission interrupt interval is greater than zero, start the preset nanosecond-level timer corresponding to the data transmission end; otherwise, set the status flag of the transmission completion queue register of the network card driver to 1. By extending the interrupt enable time using nanosecond-level timers, more data packets can be accumulated in the data receive queue and data send queue, allowing the next interrupt to poll for more data packets. This also allows multiple small data packets belonging to the same network stream to be merged into a larger data packet before entering the kernel protocol stack, thereby reducing the number of data packets that the CPU needs to process and improving the network card's receiving performance.

[0027] Step S500: If the target reception interrupt interval is greater than the preset first time interval, start the preset nanosecond-level timer corresponding to the data receiving end; otherwise, set the status flag of the network card driver's reception completion queue register to 1. Furthermore, step S500 includes steps S510-S520: Step S510: If the number of data packets processed by the network card's data receiving end within the time period of this interruption is less than or equal to the preset data packet processing threshold, then set the status flag of the network card driver's receive completion queue register to 1; otherwise, proceed to step S520. If the number of data packets processed by the data receiver within the time period of this interrupt is less than or equal to the preset data packet processing threshold (e.g., 4), it indicates that the number of data packets processed in this interrupt is small. In order to improve the interrupt efficiency, there is no need to wait for the time interval, and the status flag of the receive completion queue register is set to 1 directly.

[0028] Step S520: If the target reception interrupt interval is greater than the preset first time interval, start the preset nanosecond-level timer corresponding to the data receiving end; otherwise, set the status flag of the network card driver's reception completion queue register to 1.

[0029] In addition, step S520 also includes steps S521-S522: Step S521: If the target reception interrupt interval is less than or equal to the preset first time interval and greater than zero, then call the preset microsecond-level delay function; The microsecond-level delay function uses the udelay function, which is a function in the Linux kernel used to implement microsecond-level delays. It is a busy-wait function in low-level computer programming (especially driver development and embedded systems).

[0030] Because the delay accuracy of the hrtimer nanosecond-level timer is slightly poor, a higher delay of the nanosecond-level timer is still acceptable when the determined target receive interrupt interval is large. However, when the determined target receive interrupt interval is small, such as 8 microseconds, but the hrtimer may delay to tens of microseconds in actual applications, this is not allowed. Therefore, the data receiving end of this application compensates for the poor delay accuracy of the nanosecond-level timer by calling a microsecond-level delay function.

[0031] Therefore, when the determined target receive interrupt interval is large (e.g., more than 8 microseconds), a nanosecond-level timer is started; when the determined target receive interrupt interval is small (e.g., less than 8 microseconds), a microsecond-level delay function is called to achieve dynamic control of the interrupt time interval and improve the delay accuracy of the interrupt time interval.

[0032] Step S522: If the target receive interrupt interval is zero, set the status flag of the receive completion queue register of the network card driver to 1; The first time interval is a time threshold set by a microsecond-level delay function (e.g., 8 microseconds).

[0033] Step S600: When the nanosecond-level timer corresponding to the data sending end reaches the target transmission interrupt interval, set the status flag of the transmission completion queue register to 1; Step S700: When the nanosecond-level timer corresponding to the data receiving end reaches the target receiving interrupt interval, set the status flag of the receiving completion queue register to 1. Step S800: When the status flags of the transmit completion queue register and the receive completion queue register are both 1, adjust the network card hardware interrupt to the enabled state, and set the status flags of the transmit completion queue register and the receive completion queue register to 0.

[0034] When the status flags of the transmit completion queue register and the receive completion queue register are both 1, it means that the doorbell (a mechanism by which software (driver) notifies hardware (device) that there is a new task to be processed, which can be understood as the "doorbell" in the network card) and the doorbell of the receive completion queue have been "ringed" to notify the network card driver that it can receive data packets and start the next interrupt.

[0035] The interrupt delay control method of this invention, when the network card hardware interrupt is disabled and there are no pending data packets in the network card's data receive queue and data send queue, determines the time interval between the network card's data receiver and data sender in the next interruption according to the network dynamic interrupt adjustment algorithm. Then, it compares the time interval between the data sender and data sender in the next interruption with a preset transmission interruption time interval, and determines the smaller value as the target transmission interruption interval. Similarly, it compares the time interval between the data receiver and data sender in the next interruption with a preset reception interruption time interval, and determines the smaller value as the target reception interruption interval. The target transmission interruption interval and the target reception interruption interval are compared with zero and a first time interval, respectively. If the target transmission interruption interval is greater than zero, a nanosecond-level timer corresponding to the data sender is started; otherwise, the status flag of the network card driver's transmission completion queue register is set to 1. If the target reception interruption interval is greater than the first time interval, a preset nanosecond-level timer corresponding to the data receiver is started; otherwise, the network card driver's reception completion queue is set to 1. The status flag of the queue register is set to 1; when the nanosecond-level timer corresponding to the data sending end reaches the target transmission interrupt interval, the status flag of the transmission completion queue register is set to 1; when the nanosecond-level timer corresponding to the data receiving end reaches the target reception interrupt interval, the status flag of the reception completion queue register is set to 1; when both the status flags of the transmission completion queue register and the reception completion queue register are 1, the network card hardware interrupt is enabled, and the status flags of the transmission completion queue register and the reception completion queue register are set to 0. This is achieved by setting high-precision nanosecond-level timers at the data sending and receiving ends of the network card, comparing the interrupt time interval determined by the network dynamic interrupt adjustment algorithm with the preset interrupt interval, and determining the shorter interval as the corresponding nanosecond-level timer time threshold. This allows the network card driver software to control the interrupt delay at the data receiving and sending ends of the network card during the transmission of multiple TCP streams, thereby reducing the interrupt frequency.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0040] 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.”

[0041] 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.

[0042] 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).

[0043] 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.

[0044] 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).

[0045] 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.

[0046] 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.

[0047] 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.

[0048] 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.

[0049] 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.

[0050] 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.

[0051] 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.

[0052] 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).

[0053] 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.

[0054] 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.

[0055] 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. An interrupt delay control method, characterized in that, include: Step S100: In response to the network card hardware interrupt being in the off state, and in the case that there are no pending data packets in the network card's data receiving queue and data sending queue, the time interval between the network card's data receiving end and the time interval between the network card's data sending end and the next interrupt is determined according to the preset network dynamic interrupt adjustment algorithm. Step S200: Compare the time interval of the next interruption of the data transmission end with the preset transmission interruption time interval, and determine the smaller value of the two as the target transmission interruption interval; Step S300: Compare the time interval of the next interruption of the data receiving end with the preset receiving interruption time interval, and determine the smaller value of the two as the target receiving interruption interval; The transmit interrupt time interval and the receive interrupt time interval are set using a preset standard command-line tool; the standard command-line tool is used to query and configure the Ethernet card's driver parameters and hardware settings. Step S400: If the target transmission interruption interval is greater than zero, start the preset nanosecond-level timer corresponding to the data transmission end; otherwise, set the status flag of the transmission completion queue register of the network card driver to 1. Step S500: If the target reception interruption interval is greater than the preset first time interval, then start the preset nanosecond-level timer corresponding to the data receiving end; otherwise, set the status flag of the reception completion queue register of the network card driver to 1. Step S600: When the nanosecond-level timer corresponding to the data sending end reaches the target transmission interrupt interval, set the status flag of the transmission completion queue register to 1; Step S700: When the nanosecond-level timer corresponding to the data receiving end reaches the target receiving interrupt interval, set the status flag of the receiving completion queue register to 1; Step S800: When both the status flag bit of the register of the transmit completion queue and the status flag bit of the register of the receive completion queue are 1, adjust the network card hardware interrupt to the enabled state, and set the status flag bits of the register of the transmit completion queue and the status flag bits of the register of the receive completion queue to 0.

2. The method according to claim 1, characterized in that, Step S100 includes: Step S110: When the network card hardware interrupt is in the disabled state, poll the data packets to be processed in the data receive queue and data send queue of the network card and process them. Step S120: If there are no data packets to be processed in either the data receiving queue or the data sending queue of the network card, determine the data receiving end or the data sending end of the network card as the data transmission end; Step S130: Obtain several data processed by the data transmission end during the current interruption time period and several data processed by the data transmission end during the previous interruption time period; wherein, the several data processed during the interruption time period includes the number of data packets, the number of bytes, the number of interruptions, and the number of completions; Step S140: According to the rate index conversion function in the preset network dynamic interruption adjustment algorithm, perform rate conversion calculations on several data processed by the data transmission end in the current interruption time period and several data processed by the data transmission end in the previous interruption time period, so as to obtain the number of bytes processed per millisecond, the number of data packets processed per millisecond, and the number of events processed per millisecond corresponding to the data transmission end in the current interruption time period, and the number of bytes processed per millisecond, the number of data packets processed per millisecond, and the number of events processed per millisecond corresponding to the data transmission end in the previous interruption time period. Step S150: If the number of bytes processed per millisecond in the current interruption period is at least a preset percentage higher than the number of bytes processed per millisecond in the previous interruption period, then proceed to step S180. If the number of bytes processed per millisecond during the current interruption period is at least a preset percentage less than the number of bytes processed per millisecond during the previous interruption period, then step S190 is executed. Otherwise, proceed to step S160; Step S160: If the number of data packets processed per millisecond during the current interruption period is at least a preset percentage higher than the number of data packets processed per millisecond during the previous interruption period, then proceed to step S180. If the number of data packets processed per millisecond during the current interruption period is reduced by at least a preset percentage compared to the number of data packets processed per millisecond during the previous interruption period, then step S190 is executed. Otherwise, proceed to step S170; Step S170: If the number of events processed per millisecond by the data transmission terminal during the current interruption period is at least a preset percentage higher than the number of events processed per millisecond by the data transmission terminal during the previous interruption period, then proceed to step S180. If the number of events processed per millisecond by the data transmission terminal during the current interruption period is reduced by at least a preset percentage compared to the number of events processed per millisecond by the data transmission terminal during the previous interruption period, then step S190 is executed. Otherwise, the time interval of the current interruption at the data transmission end shall be determined as the time interval of the next interruption at the data transmission end; Step S180: Determine the time interval of the data transmission terminal in the next interruption from the several preset interrupt adjustment arrays corresponding to the data transmission terminal that is one level higher than the interrupt adjustment array corresponding to the current interruption in the interruption array. Step S190: Determine the time interval of the data transmission terminal in the next interruption from the interrupt adjustment array that is one level lower than the interrupt adjustment array corresponding to the current interruption in the preset interrupt adjustment array corresponding to the data transmission terminal.

3. The method according to claim 2, characterized in that, Following step S120, the method further includes: Step S121: Obtain several preset interrupt adjustment arrays corresponding to the data transmission terminal at the current time; Step S122: If the time interval and maximum number of data packets in each interrupt adjustment array corresponding to the data transmission end at the current time are the same, then the time interval of the data transmission end in this interruption is determined as the time interval of the data transmission end in the next interruption; otherwise, proceed to step S130.

4. The method according to claim 3, characterized in that, The preset interrupt adjustment arrays corresponding to the data transmission terminal are set through the standard command-line tool.

5. The method according to claim 4, characterized in that, The standard command-line tool is ethtool.

6. The method according to claim 5, characterized in that, The standard command-line tool configures the interrupt adjustment array corresponding to the data receiving end using the ethtool-C eth0 rx-adaptive command; the standard command-line tool configures the interrupt adjustment array corresponding to the data sending end using the ethtool-C eth0 tx-adaptive command.

7. The method according to claim 5, characterized in that, The standard command-line tool adjusts the receive interruption time interval using the ethtool-C eth0 rx-usecs command; the standard command-line tool adjusts the transmit interruption time interval using the ethtool-C eth0 tx-usecs command.

8. The method according to claim 1, characterized in that, Step S500 includes: Step S510: If the number of data packets processed by the network card's data receiving end within the time period of this interruption is less than or equal to the preset data packet processing threshold, then set the status flag of the network card driver's receive completion queue register to 1; otherwise, proceed to step S520. Step S520: If the target reception interruption interval is greater than the preset first time interval, then start the preset nanosecond-level timer corresponding to the data receiving end; otherwise, set the status flag of the reception completion queue register of the network card driver to 1.

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.