Network card interrupt signal sending method and device, electronic equipment and storage medium

By dynamically determining the transmission timing of the network card interrupt signal, combining the interval time and the number of data packets, the problems of processing delay and system performance in the prior art are solved, and efficient and stable network data processing is achieved.

CN119892295APending Publication Date: 2025-04-25JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411933812.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing network card interrupt signal transmission strategy has problems such as processing delay and system performance degradation. Fixed delayed transmission interrupts cause data packets to be unable to be processed in time, while frequent transmission interrupts lead to high central processor occupancy.

Method used

By calculating the interval duration of the interrupt signal and the number of data packets received, the timing of the interrupt signal is dynamically determined to adapt to changes in network traffic. Delay the interrupt merging time in large flow and reduce the interrupt frequency; shorten the interrupt merging time in small flow and increase the interrupt frequency.

Benefits of technology

It effectively balances the timeliness of data packet processing and system performance, makes network data processing more efficient and stable, and avoids the problems of excessive interrupt delay and system performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892295A_ABST
    Figure CN119892295A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a network card interrupt signal sending method and device, electronic equipment and a storage medium. The specific method comprises the following steps: calculating the current interval duration of interrupt signal sending according to the current time and the last sending time of an interrupt signal; obtaining the number of the data packets received in the current interval duration to obtain the packet receiving number; determining the current sending time of the interrupt signal according to the current interval duration and the packet receiving number; and sending an interrupt signal to the processor according to the sending time. The packet receiving quantity reflects the flow condition in the interval duration, and the interrupt signal sending opportunity dynamically determined by referring to the flow condition can adapt to the change of the network flow; the sending opportunity of the interrupt signal is determined by considering the interval duration of this time, so that the interrupt delay can be prevented from being too long, and the stable performance of the system can be ensured under different conditions. And the sending opportunity of the interrupt signal is determined by combining the interval duration and the packet receiving quantity, so that the timeliness of data packet processing and the system performance are balanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a method, device, electronic device and storage medium for sending a network card interrupt signal. Background Art

[0002] In current computer networks, after receiving a data packet, the network card writes the data packet into the host memory and then sends an interrupt signal to the central processing unit (CPU) to notify the CPU that there is a new data packet to be processed. The design of the interrupt signal sending strategy has an important impact on the data packet receiving performance, processing delay, etc. Currently, there are two strategies for network cards to send interrupt signals:

[0003] First, the interrupt is sent with a fixed delay. That is, the network card sends an interrupt signal to the central processor every fixed time, and the data packets received between the two interrupt signals are combined and sent as an interrupt. Second, an interrupt is sent once a data packet is received.

[0004] In the process of implementing the present invention, the inventor found that: in the first method, the data packets cannot be processed by the central processor in time due to the need to merge and send interrupts, resulting in processing delay. In the second method, although the problem of processing delay can be solved, when a large number of data packets are received, the network card will frequently send interrupts, resulting in high CPU occupancy and reduced overall system performance. Summary of the invention

[0005] The embodiments of the present invention provide a method, device, electronic device and storage medium for sending a network card interrupt signal, which can effectively balance the timeliness of data packet processing and system performance, making network data processing more efficient and stable.

[0006] In a first aspect, a method for sending a network card interrupt signal is provided in an embodiment of the present invention, comprising:

[0007] Calculate the current interval duration of the interrupt signal sending according to the current time and the last sending time of the interrupt signal;

[0008] Get the number of data packets received within this interval and get the number of received packets;

[0009] Determine the sending time of the interrupt signal this time according to the current interval length and the number of received packets;

[0010] Send an interrupt signal to the processor according to this sending time.

[0011] In a second aspect, an embodiment of the present invention provides a network card interrupt signal sending device, comprising:

[0012] A calculation module, used to calculate the current interval duration of the interrupt signal transmission according to the current time and the last transmission time of the interrupt signal;

[0013] The acquisition module is used to obtain the number of data packets received within the current interval and obtain the number of received packets;

[0014] A determination module is used to determine the current sending time of the interrupt signal according to the current interval duration and the number of received packets;

[0015] The sending module is used to send an interrupt signal to the processor according to the current sending time.

[0016] In a third aspect, an electronic device provided by an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a method for sending a network card interrupt signal as in any embodiment of the present invention is implemented.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, a method for sending a network card interrupt signal as described in any embodiment of the present invention is implemented.

[0018] In the embodiment of the present invention, the sending time of the interrupt signal can be dynamically determined in combination with the current interval duration and the number of received packets. The number of received packets reflects the traffic situation within the current interval duration. The sending time of the interrupt signal dynamically determined with reference to the traffic situation within the current interval duration can adapt to the change of network traffic. When a large amount of traffic comes, the interrupt merging time can be extended, the interruption frequency can be reduced, and the traffic can be merged and processed to reduce the occupancy of the processor and improve the overall performance; when a small amount of traffic comes, the interruption merging time can be shortened, the interruption frequency can be increased, and the data packet can be processed faster, reducing the processing delay. Considering the current interval duration to determine the sending time of the interrupt signal can avoid the interruption delay being too long, ensuring that the system can maintain stable performance under different circumstances, and will not affect data processing due to the interruption delay being too long. For example, when a large amount of traffic comes, the current interval duration can be referred to, and the large amount of traffic within a certain time interval can be merged to send an interruption to avoid the interruption delay being too long. Combining the current interval duration and the number of received packets to determine the sending time of the interrupt signal, the advantages of fixed periodic interruption and real-time interruption are integrated. Through the adaptive interrupt signal sending mechanism, the timeliness of data packet processing and system performance are effectively balanced, making network data processing more efficient and stable. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 It is a flow chart of a method for sending a network card interrupt signal according to an embodiment of the present invention;

[0021] Figure 2 is another flow chart of the method for sending a network card interrupt signal according to an embodiment of the present invention;

[0022] Figure 3 This is an example diagram of distinguishing traffic types according to an embodiment of the present invention;

[0023] Figure 4 is a flowchart of a method for sending a network card interrupt signal according to an embodiment of the present invention;

[0024] Figure 5 It is a structural schematic diagram of a network card interrupt signal sending device according to an embodiment of the present invention;

[0025] Figure 6 It is a structural schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Figure 1 It is a flow chart of the network card interrupt signal sending method provided in an embodiment of the present invention. The network card interrupt signal sending method provided in an embodiment of the present invention can be applied to the scenario where a network card is used to write network traffic into memory for processor processing. The network card interrupt signal sending method can be executed by the interrupt signal sending device provided in an embodiment of the present invention, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, and the electronic device can be a personal computer, a computer, etc. A network card, a network interface controller, etc. can be installed on the electronic device, and the network card interrupt signal sending method of the embodiment of the present invention can be specifically executed by a network card, a network interface controller, etc. The following embodiment is described by taking the example of integrating the interrupt signal sending device into the network card of the electronic device, refer to Figure 1 The network card interrupt signal sending method of this embodiment may include the following steps:

[0029] Step 110, calculating the current interval duration of the interrupt signal transmission according to the current time and the last transmission time of the interrupt signal.

[0030] The current time may refer to the specific time of the system at the current moment, which may be provided by the system clock or timer. An interrupt signal is a signal sent to the processor to interrupt the current operation of the processor in response to a specific event or data. The interrupt signal can be used to notify the processor of an emergency event or data that needs to be processed. The last sending time may refer to the specific time point when the last interrupt signal was sent. Each time the network card sends an interrupt signal to the processor, the specific sending time can be recorded. The network card can query the recorded interrupt signal sending time to determine the last sending time of the interrupt signal. The duration of this interval refers to the time difference between the current time and the last interrupt signal sending time, which reflects how long has passed since the last interrupt signal was sent. The last sending time can be subtracted from the current time, and the result is the duration of this interval.

[0031] In a specific implementation, a receiving data queue and a sending data queue can be established. The receiving data queue is used to process data packets received from the outside and need to be processed by the processor of the local machine, and the sending queue is used to process data packets that need to be sent from the local machine to the outside. The method of this embodiment is mainly for data packets in the receiving data queue. There can be one or more receiving data queues, which can be set according to actual needs. For ease of description, the following will be explained as an example that there is only one receiving data queue. When processing the received data packets, the receiving data queue can also record the specific receiving time of each data packet to facilitate subsequent analysis of traffic trends.

[0032] When a new data packet enters the receive data queue, or there are data packets in the receive data queue that have not been processed by the local processor, the time difference between the current time and the time when the last interrupt signal was sent can be calculated to obtain a time interval length, that is, the current interval length.

[0033] Step 120, obtaining the number of data packets received within the current interval time, and obtaining the number of received packets.

[0034] Data packets can be transmitted to the local machine through the network by other devices, i.e. network traffic. The number of received packets refers to the total number of data packets received during this interval, reflecting the busyness of the network or the size of data traffic during this time period. In a period of time, the more received packets, the greater the traffic, and the fewer received packets, the smaller the traffic.

[0035] For example, the last time the interrupt signal was sent was 10 microseconds from now. Assuming that 10 data packets were received from the outside within 10 microseconds, the number of received packets is 10.

[0036] Step 130, determining the current sending time of the interrupt signal according to the current interval duration and the number of received packets.

[0037] This sending time is the specific time point when the interrupt signal needs to be sent again.

[0038] Specifically, if the number of received packets within this interval is large, for example, it exceeds a preset value, it means that the current traffic entering the machine is large. If an interrupt is sent for each received data packet, the processor will be heavily occupied. In this case, the traffic can be merged and processed, and an interrupt signal can be sent for multiple data packets. For example, a larger number threshold or duration threshold can be set. When the number of received packets reaches a larger number threshold, an interrupt signal is sent, or when the current interval reaches a longer duration threshold, an interrupt signal is sent. For example, an interrupt signal is sent every 30 microseconds, or an interrupt signal is sent every 50 data packets received.

[0039] If the number of received packets within this interval is small, it means that the current traffic entering the machine is small, and an interrupt signal can be sent for each data packet, or a smaller number threshold or duration threshold can be set. When the number of received packets reaches the smaller number threshold, an interrupt signal is sent, or when the current interval reaches the smaller duration threshold, an interrupt signal is sent, so that the data packets are processed faster and the processing delay is reduced. For example, an interrupt signal can be sent every 10 microseconds, or an interrupt can be sent after accumulating 5 data packets.

[0040] Step 140: Send an interrupt signal to the processor according to the current sending time.

[0041] After receiving an interrupt signal, the processor will suspend the current task and handle the interrupt signal according to the predefined interrupt handler. Specifically, the processor can suspend the currently executed instruction and save the current register status, program counter and other context information to the stack so that the original processing can be restored after the interrupt processing is completed. The processor can look up the interrupt vector table, find the corresponding interrupt vector according to the type of interrupt signal, obtain the starting address of the interrupt handler, jump to the address pointed to by the interrupt vector, and start executing specific code to handle the interrupt event, such as reading input data, processing signals from external devices, etc. After the interrupt handler is executed, the processor will restore the previously saved context from the stack and return to the previously interrupted program to continue execution.

[0042] In this embodiment, the timing of sending the interrupt signal can be dynamically determined in combination with the current interval duration and the number of received packets. The number of received packets reflects the traffic situation within the current interval duration. The timing of sending the interrupt signal dynamically determined with reference to the traffic situation within the current interval duration can adapt to changes in network traffic. When the traffic is large, the interrupt merging time can be extended, the interruption frequency can be reduced, and the traffic can be merged and processed, reducing the occupancy of the processor and improving the overall performance; when the traffic is small, the interruption merging time can be shortened, the interruption frequency can be increased, so that the data packet can be processed faster and the processing delay can be reduced. Considering the current interval duration to determine the timing of sending the interrupt signal can avoid excessive interruption delay, ensure that the system can maintain stable performance under different circumstances, and will not affect data processing due to excessive interruption delay. Combining the current interval duration and the number of received packets to determine the timing of sending the interrupt signal combines the advantages of fixed periodic interruption and real-time interruption. Through the adaptive interrupt signal sending mechanism, the timeliness of data packet processing and system performance are effectively balanced, making network data processing more efficient and stable.

[0043] The following further illustrates the method for sending a network card interrupt signal provided by an embodiment of the present invention. Figure 2 As shown, the method of this embodiment may include:

[0044] Step 210, calculating the current interval duration of the interrupt signal transmission according to the current time and the last transmission time of the interrupt signal.

[0045] Specifically, when a new data packet enters the received data queue, or there are data packets in the received data queue that are not processed by the local processor, the current time is subtracted from the last sending time of the interrupt signal to obtain the current interval duration.

[0046] Step 220, identify the relationship between the current interval duration and the preset interruption timeout duration and the preset packet receiving time interval. If the current interval duration does not exceed the preset packet receiving time interval, execute step 230; if the current interval duration exceeds the preset packet receiving time interval but does not exceed the preset interruption timeout duration, execute step 240; if the current interval duration exceeds the preset interruption timeout duration, execute step 250.

[0047] The preset packet receiving time interval is a pre-set time threshold, which means that a new interrupt signal will be considered when the interval exceeds this time. If the interval does not exceed this time, no new interrupt signal will be sent. It is used to avoid sending interrupt signals too frequently, reduce frequent interrupts of the processor, and ensure that the system has enough time to process the data involved in the last interrupt. The preset packet receiving time interval can be set relatively short, for example, it can be set to 2 microseconds or 3 microseconds.

[0048] The preset interrupt timeout is a preset time threshold, which indicates the maximum time that the system can run normally without interruption. If no interrupt signal is received after this time, it indicates that it is necessary to send an interrupt signal for processing to avoid too long interrupt delay and prevent data from being unprocessed for a long time due to too few interrupts. The preset interrupt timeout is greater than the preset packet receiving time interval. For example, the preset interrupt timeout can be set to 16 microseconds or 20 microseconds.

[0049] Step 230, enable the interruption resend function.

[0050] Interrupt resend is a function or mechanism used to resend an interrupt signal under certain circumstances. For example, a previous interrupt may be delayed or ignored and needs to be processed again. Interrupt resend can ensure that important interrupt signals are not missed or ignored, improving the stability and reliability of the system. Whether the interrupt resend function is enabled can be distinguished by the interrupt resend flag.

[0051] In this embodiment, the interrupt resend flag may include two states: an enabled state and a disabled state. The enabled state may be set to "1" or "true", indicating that the interrupt resend function or feature has been activated or enabled. The disabled state may be set to "0" or "false", indicating that the interrupt resend function or feature has been disabled or deactivated.

[0052] Since there are data packets that have not been processed by the local processor at this time, but because the current interval is still short, the conditions for sending an interrupt signal have not been met. An interrupt signal still needs to be sent later to notify the processor to process these data packets. Therefore, the interrupt resending flag can be set to the enabled state first to enable the interrupt resending function to avoid missing data packets.

[0053] Step 231, determine whether a data packet is received after the current time, if received, execute step 232, if not received, execute step 246.

[0054] Step 232: Update the current interval duration every time a data packet is received.

[0055] That is, if a data packet is received after the current time, the current interval duration is updated to assist in further determining the time to send the interrupt signal next time.

[0056] Step 240, obtaining the number of data packets received within this interval time, and obtaining the number of received packets.

[0057] If the current interval duration exceeds the preset packet receiving time interval but does not exceed the preset interrupt timeout duration, it can be further determined when the interrupt signal can be sent based on the data packet reception status after the current time.

[0058] Step 241, determine whether the number of received packets exceeds a preset number, if so, execute step 243, if not, execute step 242.

[0059] Step 242, determine the current time as the time of this transmission.

[0060] If the number of received packets does not exceed the preset number, it means that the traffic received at this time is small and these data packets can be processed in time, then the current time is determined as the sending time, and an interrupt signal is immediately sent to the processor.

[0061] Step 243, enable the interruption resend function.

[0062] Since there are data packets that have not been processed by the local processor at this time, but the conditions for sending the interrupt signal have not been met yet, in order to avoid missing data packets, the interrupt resend flag can be set to the enabled state to enable the interrupt resend function.

[0063] Step 244, determine whether a data packet is received after the current time, if received, execute step 245, if not received, execute step 246.

[0064] That is, the number of received packets exceeds the preset number, which means that the received traffic is large at this time. The interrupt signal can be temporarily not sent to allow more traffic to be merged and reduce interruptions to the processor.

[0065] In this embodiment, the difference between large flow and small flow can be as follows Figure 3As shown, within the same time period, if more data packets are received (exceeding the set number) and the time interval between packets is very short (e.g., 1 microsecond, 0.5 microsecond), it means that the current flow is large. Within the same time period, if fewer data packets are received (less than the set number) and the time interval between packets is relatively long (e.g., 3 microseconds, 5 microseconds), it means that the current flow is small. In the design strategy of interrupt signal sending, large and small flows can be identified by setting judgment conditions.

[0066] Step 245, the current interval duration is updated every time a data packet is received, until the updated current interval duration exceeds the preset interruption timeout duration, and the time exceeding the preset interruption timeout duration is determined as the current sending time.

[0067] Since the number of packets received within this interval exceeds the preset number, it means that the received traffic is large, so more data packets can be merged to send interrupts. You can continue to wait until the updated interval exceeds the preset interrupt timeout period, and then immediately send an interrupt signal to the processor.

[0068] Step 246, determining the time of receiving the interrupt retransmission signal sent by the interrupt poller as the current transmission time.

[0069] An interrupt poller can be a hardware component or a logic module, which is responsible for monitoring the system according to the polling mechanism to determine whether there is an interrupt signal that needs to be reissued. Specifically, the interrupt poller can send an interrupt reissue signal when it polls that the interrupt reissue function is enabled (that is, the interrupt reissue flag is enabled) and the current interval duration of the interrupt signal sending exceeds the preset polling timeout duration. The preset polling timeout duration is a pre-set time threshold, which indicates the maximum waiting time of the interrupt poller after checking that the interrupt reissue flag is enabled. If this time is exceeded, the interrupt poller will send an interrupt reissue signal. For example, the preset polling timeout duration can be set to 16 microseconds or 20 microseconds.

[0070] That is, the interrupt poller will also calculate the current interval length of the interrupt signal according to the current time and the last time the interrupt signal was sent, and poll the status of the interrupt resend flag. If the interrupt resend flag is found to be enabled and the current interval length exceeds the preset polling timeout, an interrupt resend signal will be sent to the network card to prompt the network card to resend the interrupt signal. When the network card receives the interrupt resend signal sent by the interrupt poller, it immediately sends an interrupt signal to the processor.

[0071] Step 247, turn off the interrupt resend function.

[0072] After sending the interrupt signal, the interrupt resend flag can be set to the off state.

[0073] Step 250, determining the current time as the time of this transmission.

[0074] That is, if the duration of this interval exceeds the preset interrupt timeout duration, it means that the interrupt signal has not been sent for a long time, then the interrupt signal can be sent immediately.

[0075] In this embodiment, the timing of sending the interrupt signal can be dynamically determined in combination with the current interval duration and the number of received packets. The number of received packets reflects the traffic situation within the current interval duration. The timing of sending the interrupt signal dynamically determined with reference to the traffic situation within the current interval duration can adapt to changes in network traffic. When the traffic is large, the interrupt merging time can be extended, the interruption frequency can be reduced, and the traffic can be merged and processed, reducing the occupancy of the processor and improving the overall performance; when the traffic is small, the interruption merging time can be shortened, the interruption frequency can be increased, so that the data packet can be processed faster and the processing delay can be reduced. Considering the current interval duration to determine the timing of sending the interrupt signal can avoid excessive interruption delay, ensure that the system can maintain stable performance under different circumstances, and will not affect data processing due to excessive interruption delay. Combining the current interval duration and the number of received packets to determine the timing of sending the interrupt signal combines the advantages of fixed periodic interruption and real-time interruption. Through the adaptive interrupt signal sending mechanism, the timeliness of data packet processing and system performance are effectively balanced, making network data processing more efficient and stable.

[0076] The following is a specific example to further illustrate the method for sending a network card interrupt signal provided by an embodiment of the present invention. Figure 4 As shown, the interrupt status information of the receiving data queue can be maintained in the interrupt status information table, and the maintained information can be shown in the following Table 1:

[0077]

[0078]

[0079] Table 1

[0080] The last sending time is read by the interrupt poller and the receiving processing module and compared with the current time to determine whether the interrupt delay has been exceeded, thereby determining whether an interrupt needs to be issued. The interrupt resend flag can be 0 or 1. The interrupt resend flag is 0, indicating that interrupt resend is not enabled, there is no interrupt merge, and no interrupt resend is required. The interrupt resend flag is 1, indicating that interrupt resend is enabled, there is interrupt merge, and interrupt resend is required.

[0081] The interrupt poller is used to determine whether it is necessary to send an interrupt resend signal to the receiving processing module through a polling mechanism. The interrupt poller includes a polling reading module and a polling processing module. The polling reading module reads data from the interrupt status information table in each clock cycle. The polling processing module receives the table reading result of the polling reading module and determines whether it is necessary to send an interrupt resend signal to the receiving processing module according to the table reading result.

[0082] The receiving processing module includes an acquisition module and an interrupt processing module. The acquisition module can acquire network traffic (i.e., data packets), interrupt retransmission signals sent by the interrupt poller, read relevant data in the interrupt status information table, and pass the acquired data to the interrupt processing module for processing. The interrupt processing module decides whether to send an interrupt signal to the processor based on the various data acquired by the acquisition module, and passes the received network traffic to the memory access processing module so that the memory access processing module writes the network traffic into the host memory. The interrupt processing module can also update the relevant data in the interrupt status information table according to actual conditions.

[0083] In addition, the embodiment of the present invention also sets several key registers to support interrupt decision making. The specific register settings can be shown in Table 2 below:

[0084]

[0085] Table 2

[0086] It can be seen that in this embodiment, the preset polling timeout duration is used by the interrupt poller, and the preset interrupt timeout duration is used by the interrupt processing module. The preset polling timeout duration and the preset interrupt timeout duration can be the same or different, and both can be set according to actual needs.

[0087] For the interrupt processing module, the specific interrupt decision process can be as follows:

[0088] 1. If a resend interrupt signal is received from the interrupt poller, an interrupt is sent, and need_intr_flag is set to 0. The interrupt poller will send a resend interrupt signal when need_intr_flag is set to 1 and the current interval duration is greater than REG_POLL_TIME.

[0089] 2. If the current interval is judged to be longer than REG_MERGE_TIME, it means that the interrupt has not been sent for a long time, and then an interrupt will be sent after receiving the data packet. After sending the interrupt, last_intr_time will be updated, and the subsequent received data packets will calculate the current interval length based on the updated last_intr_time.

[0090] 3. If it is determined that the current interval duration is less than REG_MERGE_TIME but greater than REG_INTER_PKT_GAP_TIME, and the number of received packets < REG_MERGE_PKT_LIMT, it indicates small traffic, then send an interrupt to prompt the processor to handle it in a timely manner.

[0091] 4. If it is determined that the current interval duration is less than REG_MERGE_TIME but greater than REG_INTER_PKT_GAP_TIME, yet the number of received packets > REG_MERGE_PKT_LIMT, it indicates large traffic. Temporarily do not send an interrupt, and set need_intr_flag to 1. Continue to wait. When receiving another data packet, the current interval duration will be updated. If the updated current interval duration exceeds REG_MERGE_TIME, then send an interrupt. If no data packets are received thereafter, no interrupt will be sent temporarily. When no data packets are received but need_intr_flag is set to 1, the interrupt polling module will poll this data reception queue, find that need_intr_flag is set to 1, and the current interval duration exceeds REG_POLL_TIME. At this time, an interrupt reissue signal will be sent to the reception processing module. After receiving the interrupt reissue signal, the interrupt processing module sends an interrupt and sets need_intr_flag to 0 after sending.

[0092] 5. If it is determined that the current interval duration is less than REG_INTER_PKT_GAP_TIME, then do not send an interrupt, set need_intr_flag to 1, continue to wait, and loop back to step 3 or step 4 as time goes by.

[0093] In this embodiment, whether it is large traffic or small traffic, as long as an interrupt signal is not immediately sent after receiving a data packet, the interrupt reissue flag can be set to 1 to enable the interrupt reissue function and avoid missed processing of data packets. In addition, through the respective registers set in the interrupt poller and the interrupt processing module, the identification of traffic types can be realized, and interrupt decisions can be made according to the identified traffic types, which can not only improve the reception performance during large traffic but also reduce the processing delay during small traffic.

[0094] Figure 5 It is a schematic structural diagram of a network card interrupt signal sending device provided by an embodiment of the present invention. This device is applicable to execute the network card interrupt signal sending method provided by the embodiment of the present invention, as Figure 5 shown. Specifically, this device may include:

[0095] A calculation module 501, configured to calculate the current interval duration for sending the interrupt signal according to the current time and the last sending time of the interrupt signal;

[0096] The acquisition module 502 is used to acquire the number of data packets received within the current interval time to obtain the number of received packets;

[0097] The determination module 503 is used to determine the current sending time of the interrupt signal according to the current interval duration and the number of received packets;

[0098] The sending module 504 is used to send an interrupt signal to the processor according to the current sending time.

[0099] In one embodiment, the determination module 503 determines the current sending time of the interrupt signal according to the current interval duration and the number of received packets, including:

[0100] Determine whether the current interval duration exceeds the preset interruption timeout duration;

[0101] If the interval time exceeds the preset interruption timeout time, the current time is determined as the sending time;

[0102] If the interval duration does not exceed the preset interruption timeout duration, the sending time is determined according to the number of received packets.

[0103] In one embodiment, before determining the current sending time according to the number of received packets, the determining module 503 is further configured to:

[0104] Determine whether the current interval duration exceeds the preset packet receiving time interval, wherein the preset packet receiving time interval is less than the preset interruption timeout duration;

[0105] If the current interval duration exceeds the preset packet receiving time interval, the current sending time is determined according to the number of received packets.

[0106] In one embodiment, the determining module 503 determines the current sending time according to the number of received packets, including:

[0107] Determine whether the number of received packets exceeds the preset number;

[0108] If the number of received packets does not exceed the preset number, the current time is determined as the sending time;

[0109] If the number of received packets exceeds the preset number, the time of this transmission is determined based on the data packet reception after the current time.

[0110] In one embodiment, before the determination module 503 determines the current sending time according to the data packet reception situation after the current time, it also includes:

[0111] Enable the interrupt resend function;

[0112] The determination module 503 determines the current sending time according to the data packet reception situation after the current time, including:

[0113] Determine whether a data packet is received after the current time;

[0114] If a data packet is received after the current time, the current interval duration is updated each time a data packet is received until the updated current interval duration exceeds the preset interruption timeout duration, and the time exceeding the preset interruption timeout duration is determined as the current sending time;

[0115] If no data packet is received after the current time, the time when the interrupt retransmission signal sent by the interrupt poller is received is determined as the current transmission time. The interrupt retransmission signal is sent by the interrupt poller when the interrupt retransmission function is enabled and the current interval duration exceeds the preset polling timeout duration.

[0116] In one embodiment, the determination module 503 is further configured to disable the interrupt resending function after the sending module 504 sends the interrupt signal to the processor according to the current sending time.

[0117] In one embodiment, after determining whether the current interval duration exceeds the preset packet receiving time interval, the determination module 503 is further configured to:

[0118] If the current interval does not exceed the preset packet receiving time interval, the interruption retransmission function is enabled;

[0119] Determine whether a data packet is received after the current time;

[0120] If a data packet is received after the current time, the current interval duration is updated each time a data packet is received, and the acquisition module 502 is returned to execute acquisition of the number of data packets received within the current interval duration;

[0121] If no data packet is received after the current time, the time when the interrupt retransmission signal sent by the interrupt poller is received is determined as the current transmission time. The interrupt retransmission signal is sent by the interrupt poller when the interrupt retransmission function is enabled and the current interval duration exceeds the preset polling timeout duration.

[0122] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0123] The device of this embodiment can dynamically determine the sending time of the interrupt signal in combination with the current interval duration and the number of received packets. The number of received packets reflects the traffic situation within the current interval duration. The interrupt signal sending time dynamically determined with reference to the traffic situation within the current interval duration can adapt to changes in network traffic. When the traffic is large, the interrupt merging time can be extended, the interruption frequency can be reduced, and the traffic can be merged and processed to reduce the occupancy of the processor and improve the overall performance; when the traffic is small, the interruption merging time can be shortened, the interruption frequency can be increased, and the data packet can be processed faster, reducing the processing delay. Considering the current interval duration to determine the sending time of the interrupt signal can avoid excessive interruption delay, ensure that the system can maintain stable performance under different circumstances, and will not affect data processing due to excessive interruption delay. Combining the current interval duration and the number of received packets to determine the sending time of the interrupt signal combines the advantages of fixed periodic interruption and real-time interruption. Through the adaptive interrupt signal sending mechanism, it effectively balances the timeliness of data packet processing and system performance, making network data processing more efficient and stable.

[0124] An embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the network card interrupt signal sending method provided in any of the above embodiments is implemented.

[0125] An embodiment of the present invention further provides a computer-readable medium having a computer program stored thereon. When the program is executed by a processor, the method for constructing a label system provided in any of the above embodiments is implemented, or the method for sending a network card interrupt signal provided in any of the above embodiments is implemented.

[0126] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of an electronic device suitable for implementing an embodiment of the present invention. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0127] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0128] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0129] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0130] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0132] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be arranged in a processor, for example, it may be described as follows: a processor includes a calculation module, an acquisition module, a determination module, and a sending module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.

[0133] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0134] Calculate the current interval duration of the interrupt signal according to the current time and the last time the interrupt signal was sent; obtain the number of data packets received within the current interval duration to obtain the number of received packets; determine the current sending time of the interrupt signal according to the current interval duration and the number of received packets; and send the interrupt signal to the processor according to the current sending time.

[0135] The technical solution of the embodiment of the present invention can dynamically determine the sending time of the interrupt signal in combination with the current interval duration and the number of received packets. The number of received packets reflects the traffic situation within the current interval duration. The interrupt signal sending time dynamically determined with reference to the traffic situation within the current interval duration can adapt to changes in network traffic. When the traffic is large, the interrupt merging time can be extended, the interruption frequency can be reduced, and the traffic can be merged and processed to reduce the occupancy of the processor and improve the overall performance; when the traffic is small, the interruption merging time can be shortened, the interruption frequency can be increased, and the data packet can be processed faster, reducing the processing delay. Considering the current interval duration to determine the sending time of the interrupt signal can avoid excessive interruption delay, ensure that the system can maintain stable performance under different circumstances, and will not affect data processing due to excessive interruption delay. Combining the current interval duration and the number of received packets to determine the sending time of the interrupt signal, the advantages of fixed periodic interruption and real-time interruption are integrated. Through the adaptive interrupt signal sending mechanism, the timeliness of data packet processing and system performance are effectively balanced, making network data processing more efficient and stable.

[0136] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0137] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0138] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for sending a network card interrupt signal, characterized in that: include: Calculate the current interval duration of the interrupt signal sending according to the current time and the last sending time of the interrupt signal; Get the number of data packets received within this interval and get the number of received packets; Determine the sending time of the interrupt signal this time according to the current interval length and the number of received packets; Send an interrupt signal to the processor according to this sending time.

2. The method according to claim 1, characterized in that The sending time of the interrupt signal is determined according to the current interval length and the number of received packets, including: Determine whether the current interval duration exceeds the preset interruption timeout duration; If the interval time exceeds the preset interruption timeout time, the current time is determined as the sending time; If the interval duration does not exceed the preset interruption timeout duration, the sending time is determined according to the number of received packets.

3. The method according to claim 2, characterized in that Before determining the sending time based on the number of received packets, it also includes: Determine whether the current interval duration exceeds the preset packet receiving time interval, wherein the preset packet receiving time interval is less than the preset interruption timeout duration; If the interval time exceeds the preset packet receiving time interval, the trigger will determine the sending time according to the number of received packets.

4. The method according to claim 2 or 3, characterized in that: The sending time is determined based on the number of received packets, including: Determine whether the number of received packets exceeds the preset number; If the number of received packets does not exceed the preset number, the current time is determined as the sending time; If the number of received packets exceeds the preset number, the time of this transmission is determined based on the reception of data packets after the current time.

5. The method according to claim 4, characterized in that Before determining the sending time according to the data packet reception status after the current time, it also includes: Enable the interrupt resend function; The sending time is determined based on the data packet reception after the current time, including: Determine whether a data packet is received after the current time; If a data packet is received after the current time, the current interval duration is updated each time a data packet is received until the updated current interval duration exceeds the preset interruption timeout duration, and the time exceeding the preset interruption timeout duration is determined as the current sending time; If no data packet is received after the current time, the time when the interrupt retransmission signal sent by the interrupt poller is received is determined as the current transmission time. The interrupt retransmission signal is sent by the interrupt poller when the interrupt retransmission function is enabled and the current interval duration exceeds the preset polling timeout duration.

6. The method according to claim 5, characterized in that After sending an interrupt signal to the processor according to the current sending time, it also includes: Disable the interrupt resend function.

7. The method according to claim 3, characterized in that After determining whether the current interval time exceeds the preset packet receiving time interval, the method further includes: If the current interval does not exceed the preset packet receiving time interval, the interruption retransmission function is enabled; Determine whether a data packet is received after the current time; If a data packet is received after the current time, the interval duration is updated every time a data packet is received, and the number of data packets received within the interval duration is obtained by returning. If no data packet is received after the current time, the time when the interrupt retransmission signal sent by the interrupt poller is received is determined as the current transmission time. The interrupt retransmission signal is sent by the interrupt poller when the interrupt retransmission function is enabled and the current interval duration exceeds the preset polling timeout duration.

8. A network card interrupt signal sending device, characterized in that: include: A calculation module, used to calculate the current interval duration of the interrupt signal transmission according to the current time and the last transmission time of the interrupt signal; The acquisition module is used to obtain the number of data packets received within the current interval and obtain the number of received packets; A determination module is used to determine the current sending time of the interrupt signal according to the current interval duration and the number of received packets; The sending module is used to send an interrupt signal to the processor according to the current sending time.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the network card interrupt signal sending method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the network card interrupt signal sending method according to any one of claims 1 to 7 is implemented.