A data processing method, apparatus, device and medium
By identifying and processing erroneous data frames in a circular buffer, the problem of data interruption in network communication is solved, thereby improving the reliability and maintainability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2026-04-03
AI Technical Summary
In network communication, if the status flag of a data frame is corrupted due to external factors, network data will be interrupted. Existing technologies cannot effectively process subsequent data, which affects the maintainability and reliability of the system.
By reading the current frame data pointed to by the read pointer from the circular buffer as the data to be processed, and judging from the status flag that the data status is incorrect, the read pointer is configured to point to the next frame data, the erroneous data is deleted, and the buffer status is reset to ensure that subsequent data is processed correctly.
When data errors are caused by external factors, the system can correctly process subsequent data, restore communication, improve system maintainability and reliability, reduce the risk of data loss, and enhance communication reliability and system stability.
Smart Images

Figure CN119254392B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of testing technology, specifically to a data processing method, apparatus, device, and medium. Background Technology
[0002] In network communication, network drivers process received data using buffers. After processing one frame of data, the software interrupt function processes the next, repeating this process in a loop. When processing the buffer, the program reads the status flags of the buffer frame data. However, due to external factors, sometimes an error occurs when processing the flags of a frame, causing the program to freeze and prevent further data processing, resulting in network data interruption. Summary of the Invention
[0003] In view of the shortcomings of the prior art described above, this application provides a data processing method, apparatus, device and medium to solve at least one of the defects in the prior art.
[0004] To achieve the above and other objectives, this application provides a data processing method, the data processing method comprising:
[0005] Read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed;
[0006] Perform a data processing procedure on the data to be processed; the data processing procedure includes: when the status of the data to be processed is determined to be in an error state based on the status flag of the data to be processed, configure the read pointer to point to the next frame of data of the data to be processed in the circular buffer.
[0007] In one embodiment of the present invention, the data processing procedure further includes:
[0008] When the status of the data to be processed is determined to be in the correct state based on the status flag of the data to be processed, the data to be processed is forwarded, and the read pointer is configured to point to the next frame of data of the data to be processed in the circular buffer.
[0009] In one embodiment of the present invention, the step of determining the state of the data to be processed based on the state flag of the data to be processed includes:
[0010] The data to be processed is parsed to obtain the status flag of the data to be processed, and the status flag is identified.
[0011] If the status flag is the first preset flag, then the status of the data to be processed is the correct status;
[0012] If the status flag is the second preset flag, then the status of the data to be processed is an error status.
[0013] In one embodiment of the present invention, when the status flag is a second preset flag, the data processing process further includes:
[0014] The status flag is identified at least twice. If the results of at least two repeated identifications are both the second preset flag, then the status of the data to be processed is determined to be an error status.
[0015] In one embodiment of the present invention, the method further includes:
[0016] When the status of the data to be processed is an error state, the data to be processed is deleted from the circular buffer, and the status of the buffer is reset.
[0017] To achieve the above and other objectives, this application also provides a data processing apparatus, the data processing apparatus comprising:
[0018] The data reading module is used to read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed;
[0019] The data processing module is used to perform a data processing procedure on the data to be processed; the data processing procedure includes: when the status of the data to be processed is determined to be an error state based on the status flag of the data to be processed, configuring the read pointer to point to the next frame of data of the data to be processed in the circular buffer.
[0020] To achieve the above and other objectives, this application provides a data processing method, the data processing method comprising:
[0021] The system receives data to be processed using a network adapter and writes the data to be processed into a circular buffer; after storing the data to be processed in the circular buffer, it initiates a hard interrupt to the central processing unit.
[0022] The CPU disables the hardware interrupt and enables the software interrupt. When the ksoftirqd process in the CPU kernel receives the software interrupt, it calls the software interrupt handling function to process the data to be processed using the data processing method to obtain the target data. The target data is cached on the corresponding socket.
[0023] The application calls the read function to read the target data on the socket and copies the target data from kernel space to user space.
[0024] To achieve the above and other objectives, this application provides a data processing apparatus, the data processing apparatus comprising:
[0025] A network adapter is used to receive data to be processed, write the data to be processed into a circular buffer, and initiate a hard interrupt to the central processing unit after the data to be processed is stored in the circular buffer.
[0026] The central processing unit (CPU) is used to disable the hardware interrupts and enable software interrupts; it receives the software interrupts through the ksoftirqd process in the kernel, and when the software interrupt is received, it calls the software interrupt handling function to process the data to be processed using the data processing method to obtain the target data; wherein, the target data is cached on the corresponding socket.
[0027] The application calls the read function to read target data from the socket and copies the target data from kernel space to user space.
[0028] To achieve the above and other related objectives, this application provides a data processing apparatus, comprising:
[0029] One or more processors; and
[0030] A memory for storing one or more programs, which, when executed by one or more processors, enable the memory to implement the method.
[0031] To achieve the above and other related objectives, this application provides one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method described thereon.
[0032] The beneficial effects of this application are:
[0033] This application discloses a data processing method, comprising: reading the current frame data pointed to by a read pointer from a circular buffer as data to be processed; performing a data processing procedure on the data to be processed; the data processing procedure includes: when the status of the data to be processed is determined to be in an error state according to the status flag of the data to be processed, configuring the read pointer to point to the next frame data of the data to be processed in the circular buffer; in this application, when reading data, if the data of the current frame is identified as erroneous data, the next data pointed to by the read pointer is read from the circular buffer as data to be processed. This allows for the correct processing of subsequent data when data errors are caused by external factors, that is, communication can be restored when erroneous data is encountered, thereby improving the maintainability and reliability of the system.
[0034] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0036] Figure 1 This is a schematic diagram of normal data processing;
[0037] Figure 2 This is a diagram illustrating error data processing.
[0038] Figure 3 This is a schematic diagram of the implementation environment of a data processing method according to an embodiment of this application;
[0039] Figure 4 This is a schematic diagram of a data processing method according to an embodiment of this application;
[0040] Figure 5 This is a flowchart illustrating a data processing method according to an embodiment of this application;
[0041] Figure 6 This is a block diagram illustrating a data processing apparatus according to an embodiment of this application;
[0042] Figure 7 This is a flowchart of a data processing method according to another embodiment of this application;
[0043] Figure 8 This is a flowchart of a data processing method according to another embodiment of this application;
[0044] Figure 9 This is a block diagram of a data processing apparatus according to another embodiment of this application;
[0045] Figure 10 A schematic diagram of a computer system suitable for implementing the memory of the embodiments of this application is shown. Detailed Implementation
[0046] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0047] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0048] Although the terms “first,” “second,” “A,” and “B,” etc., may be used herein to describe various elements, these elements should not be limited by these terms and are used only to distinguish one element from another. For example, without departing from the scope of the art described below, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element. The term “and / or” includes a combination of multiple related items or any one of multiple related items.
[0049] As used herein, unless the context otherwise indicates, the singular form is also intended to include the plural form, and it will be understood that the term “comprising” means the presence of the stated feature, quantity, step, operation, element, or combination thereof, but does not exclude the presence or addition of one or more other features, quantities, steps, operations, elements, components, or combinations thereof.
[0050] Before proceeding with the detailed description, it is intended to clarify that the division of components in this specification is based solely on the primary function of each component. That is, two or more components described below may be combined into one component, or may be divided into two or more components based on more detailed functions. In addition to the primary functions of each component, each component described below may also perform some or all of the functions of other components, and some of the primary functions of each component may be performed specifically by other components.
[0051] When a network driver receives data, it temporarily stores it in a ring buffer. The ring buffer is a commonly used data structure for network data reception, providing an efficient way to temporarily store and process data. It acts as an intermediary between data producers (such as the network receiving thread) and data consumers (such as processing threads), ensuring that data is transmitted efficiently and in an ordered manner. When a data consumer reads data, the software interrupt function first retrieves a frame of data from the ring buffer for processing. After processing one frame, it proceeds to process the next frame, repeating this process in a loop. While processing a frame of data, the program reads the data status flag (TRUE / FALSE). If the flag is TRUE, it indicates that the current frame of data is normal. This interrupt handler will continuously loop through and process the data in the ring buffer. Figure 1As shown. However, due to certain external reasons, the flag bit of the frame data may always be FALSE. When the interrupt handler processes this frame data, it will always exit the processing flow because the flag is FALSE. Subsequent data will not be processed, ultimately leading to network data interruption, such as... Figure 2 As shown. Therefore, in order to solve the above problems, this invention provides a data processing method that can correctly process subsequent data when data errors are caused by external factors, that is, it can restore communication when encountering erroneous data, thereby improving the maintainability and reliability of the system.
[0052] Figure 3 This is a schematic diagram of the implementation environment of a data processing method according to an embodiment of this application. Figure 3 In this system, a data producer 310 generates data and stores it in a circular buffer 320. A data consumer 330 then reads data from the circular buffer 320 as needed. When reading data, the data consumer 330 reads the current frame data pointed to by the read pointer from the circular buffer as the data to be processed; it then performs a data processing procedure on the data to be processed. This data processing procedure includes: if the status flag of the data to be processed indicates an error, configuring the read pointer to point to the next frame data in the circular buffer. In this application, when reading data, if the current frame data is identified as erroneous, the read pointer is pointed to the next frame data and treated as the data to be processed. This ensures that subsequent data can be correctly processed even when data errors are caused by external factors, thus restoring communication when erroneous data is encountered, improving the maintainability and reliability of the system.
[0053] Please see Figure 5 , Figure 5 This is a flowchart illustrating a data processing method according to an embodiment of this application. See details below. Figure 5 As shown, the data processing method includes at least steps S510-S520:
[0054] Step S510: Read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed;
[0055] Data producer 310 generates the corresponding data and then sends it. The network adapter receives the data generated by data producer 310 and stores the received data packets in a circular buffer. Specifically, the network adapter can store the received data packets in the circular buffer via DMA (Data Memory Access), and then notify the central processing unit (CPU) that the data packets have arrived in the circular buffer via an interrupt request. Here, an interrupt request (InterruptReQuest, IRQ) refers to the action of executing a hardware interrupt request in the computer. For example, when it is necessary to read a piece of data from the hard drive, the hard drive notifies the system via IRQ after the data reading is complete, and of course, the corresponding data has been written to the specified memory or cache.
[0056] When a data consumer needs to consume data, it reads the current frame data pointed to by the read pointer from the circular buffer as the data to be processed; the read pointer points to the position of the data to be read.
[0057] Step S520: Perform a data processing procedure on the data to be processed; the data processing procedure includes: when the state of the data to be processed is determined to be an error state according to the state flag of the data to be processed, configure the read pointer to point to the next frame of data of the data to be processed in the circular buffer.
[0058] After reading data from the circular buffer, it is necessary to determine whether the data is correct. Correct data is forwarded to subsequent processing steps, while incorrect data can be deleted.
[0059] The status flags of the data indicate whether the data is correct. Therefore, the status of the data to be processed can be determined based on the status flags, i.e., whether the data to be processed is correct.
[0060] In this embodiment of the application, the step of determining the state of the data to be processed based on the state flag of the data to be processed includes: parsing the data to be processed to obtain the state flag of the data to be processed, and identifying the state flag; if the state flag is a first preset flag, then the state of the data to be processed is a correct state; if the state flag is a second preset flag, then the state of the data to be processed is an incorrect state.
[0061] After acquiring the data to be processed, its content and status flags can be obtained by parsing it. The correctness of the data can be determined by identifying the status flags. It's important to note that before determining data correctness based on status flags, the data's status flags need to be pre-defined. For example, a status flag of TRUE indicates correct data, while a status flag of FALSE indicates incorrect data. Therefore, the first preset flag can be set to TRUE, and the second preset flag can be set to FALSE.
[0062] After acquiring the data to be processed, the data is parsed to obtain its status flag. If the status flag is identified as the first preset flag, i.e., the status flag is TRUE, then the status of the data to be processed is determined to be correct, i.e., the data to be processed is correct. If the status flag is identified as the second preset flag, i.e., the status flag is FALSE, then the status of the data to be processed is determined to be incorrect, i.e., the data to be processed is incorrect.
[0063] When the status flag of the data to be processed is identified as FALSE, that is, when the data to be processed is erroneous, the index of all frame data in the ring buffer can be read. If the subsequent frames of the ring buffer are already filled with data, the next frame data in the ring buffer is read and its status flag is identified, and the corresponding data is processed according to the status flag.
[0064] It should be noted that the next frame of data refers to the data frame following the two data frames adjacent to the current frame of data.
[0065] In this embodiment of the application, the data processing process further includes: when the status of the data to be processed is determined to be in a correct state based on the status flag of the data to be processed, forwarding the data to be processed and configuring the read pointer to point to the next frame of data of the data to be processed in the circular buffer.
[0066] After acquiring the data to be processed, it is parsed to obtain its status flag. If the status flag is identified as TRUE, indicating that the data is correct, it is forwarded as target data for subsequent data processing steps. After forwarding the correct data, a read pointer is configured to point to the next frame of data in the circular buffer to determine the status of the next frame.
[0067] In this embodiment of the application, when the status flag is a second preset flag, the data processing process further includes:
[0068] The status flag is identified at least twice. If the results of at least two repeated identifications are both the second preset flag, then the status of the data to be processed is determined to be an error status.
[0069] When judging the status flag of the data to be processed, if a status flag indicating an error is encountered, the correctness of the data is checked multiple times in a loop. If multiple loop checks all result in an error, the status flag of the data is determined to be FALSE. The number of loop checks can be set according to actual needs, for example, 3 times. This embodiment does not specify a specific number of loop checks.
[0070] By performing multiple checks on erroneous data, the accuracy of data identification was improved.
[0071] In this embodiment of the application, the method further includes: when the state of the data to be processed is an error state, deleting the data to be processed from the circular buffer and resetting the state of the buffer.
[0072] By removing the data to be processed from the circular buffer and resetting the buffer's state, you can ensure that data can be written normally the next time. Resetting refers to restoring the buffer's state to its initial state, in which the buffer does not store any data, using appropriate programming instructions.
[0073] In summary, this application reads the data currently pointed to by the read pointer from the circular buffer as the data to be processed; performs a data processing procedure on the data to be processed, the data processing procedure including: determining the state of the data to be processed based on the state flag of the data to be processed; when the state of the data to be processed is an error state, reading the data pointed to by the next read pointer from the circular buffer as the data to be processed and performing the data processing procedure; in this application, when reading data, if the data of the current frame is identified as erroneous data, the data pointed to by the next read pointer from the circular buffer is read as the data to be processed. In this way, when data errors are caused by external reasons, subsequent data can be processed correctly, that is, communication can be restored when erroneous data is encountered, improving the maintainability and reliability of the system.
[0074] Meanwhile, since error frames typically contain corrupted data due to transmission errors, hardware failures, or software defects, detecting and processing these error frames allows the system to reduce or avoid transmitting data to the upper-layer protocol stack, thereby reducing the risk of data loss and improving communication reliability. Furthermore, unprocessed error frames can lead to system resource exhaustion, buffer overflows, or software anomalies, potentially causing system crashes. Timely processing of these error frames reduces the risk of system crashes, improving system stability and availability. Finally, by promptly processing error frames and releasing related resources (such as buffers and memory), the system can more effectively utilize these resources to handle normal network communication tasks, reducing processing latency caused by error frames, shortening network communication response time, improving resource utilization, and thus enhancing overall performance.
[0075] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0076] Figure 6 This is a block diagram of a data processing apparatus according to an embodiment of this application. This apparatus can be applied to… Figure 1 The implementation environment shown is not limited to this embodiment. This device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.
[0077] like Figure 6 As shown, a data processing apparatus includes:
[0078] The data reading module 610 is used to read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed;
[0079] The data processing module 620 is used to perform a data processing procedure on the data to be processed; the data processing procedure includes: when the state of the data to be processed is determined to be an error state according to the state flag of the data to be processed, configuring the read pointer to point to the next frame of data of the data to be processed in the circular buffer.
[0080] It should be noted that the data processing apparatus and the data processing method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the data processing apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.
[0081] Please see Figure 7 , 8 , Figure 7 This is a flowchart of a data processing method according to an embodiment of this application. Figure 8 This is a flowchart illustrating a data processing method according to an embodiment of this application. Figure 7 As shown, the data processing method includes:
[0082] Step S710: Receive the data to be processed using the network adapter and write the data to be processed into a circular buffer; after storing the data to be processed into the circular buffer, initiate a hard interrupt to the central processing unit.
[0083] Data to be processed enters the network adapter from the network; the network adapter writes the data packet to the specified memory address (allocated and initialized by the network adapter driver) via DMA, that is, puts it into the RingBuffer. After the data is written to the ring buffer, the network adapter notifies the CPU (Central Processing Unit) of the arrival of data via a hardware interrupt (IRQ).
[0084] Step S720: The hard interrupt is disabled by the central processing unit (CPU) and a soft interrupt is started; when the ksoftirqd process in the CPU kernel receives the soft interrupt, the soft interrupt handling function is called to process the data to be processed using the data processing method to obtain the target data; wherein, the target data is cached on the corresponding socket.
[0085] The CPU kernel's interrupt handler first disables the network adapter's interrupts (to avoid frequent interrupts) and then initiates the soft interrupt handling process. The `ksoftirqd` process in the kernel is responsible for handling soft interrupts. When `ksoftirqd` receives a soft interrupt, it calls the corresponding soft interrupt handler (such as `net_rx_action`). The `net_rx_action` function calls the `poll` function in the network adapter driver to process data packets one by one. The `poll` function processes data packets using the data processing method described in the previous embodiment. In the `poll` function, the driver reads the data packets written to memory by the network adapter and converts them into `skb` (socket buffer) format that the kernel network module can recognize. Functions such as `napi_gro_receive` are called for GRO (Generic Receive Offload) processing to merge data packets that can be merged. Functions such as `__netif_receive_skb` are called to hand the data packets over to the protocol stack for processing. After the data packets enter the protocol stack, the corresponding processing function is called according to their protocol type (such as IP, TCP, UDP, etc.). After a series of protocol processing steps (such as routing, fragmentation and reassembly, verification, etc.), the data packet is finally cached on the corresponding socket.
[0086] Step S730: The application calls the read function to read the target data on the socket and copies the target data from kernel space to user space.
[0087] Applications read data from sockets by calling system calls such as the read function. The data is copied from kernel space to user space for application use.
[0088] Please see Figure 9 , Figure 9 This is a schematic diagram of a data processing apparatus according to an embodiment of this application. Figure 9 As shown, the data processing device includes:
[0089] Network adapter 910 is used to receive data to be processed, write the data to be processed into a circular buffer, and initiate a hard interrupt to the central processing unit after the data to be processed is stored in the circular buffer.
[0090] The central processing unit 920 is used to disable the hardware interrupt and enable the software interrupt; and to receive the software interrupt through the ksoftirqd process in the kernel, and to call the software interrupt handling function when the software interrupt is received to process the data to be processed through the data processing method to obtain the target data; wherein, the target data is cached on the corresponding socket;
[0091] Application 930 is used to call the read function to read target data on the socket and copy the target data from kernel space to user space.
[0092] It should be noted that the data processing apparatus and the data processing method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the data processing apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.
[0093] Embodiments of this application also provide an apparatus, including: one or more processors; and a memory for storing one or more programs, which, when executed by one or more processors, cause the memory to implement the data processing method described above.
[0094] Embodiments of this application also provide one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the data processing methods described above.
[0095] Figure 10 A schematic diagram of a computer system suitable for implementing the memory of embodiments of this application is shown. It should be noted that... Figure 10 The computer system with the memory shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0096] like Figure 10 As shown, the computer system includes a Central Processing Unit (CPU), which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) or loaded from storage into Random Access Memory (RAM), such as executing the methods described in the above embodiments. The RAM also stores various programs and data required for system operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0097] The following components are connected to the I / O interface: input sections including keyboards, mice, etc.; output sections including cathode ray tubes (CRTs), liquid crystal displays (LCDs), and speakers; storage sections including hard drives; and communication sections including network interface cards such as LAN (Local Area Network) cards and modems. The communication sections perform communication processing via networks such as the Internet. Drives are also connected to the I / O interface as needed. Removable media, such as disks, optical discs, magneto-optical discs, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage section as required.
[0098] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the data processing methods of the aforementioned embodiments. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs various functions defined in the system of this application.
[0099] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0101] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0102] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the data processing method as described above. This computer-readable storage medium may be included in the memory described in the above embodiments, or it may exist independently and not be assembled into that memory.
[0103] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing methods provided in the various embodiments described above.
[0104] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A data processing method, characterized in that, The data processing method includes: Read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed; Perform a data processing procedure on the data to be processed; the data processing procedure includes: when the state of the data to be processed is determined to be an error state according to the state flag of the data to be processed, configure the read pointer to point to the next frame of data of the data to be processed in the circular buffer; When determining the status of the data to be processed based on the status flag of the data to be processed, the status flag is re-identified at least twice. If the result of the re-identification at least twice is an error status, then the status of the data to be processed is determined to be an error status.
2. The data processing method according to claim 1, characterized in that, The data processing procedure also includes: When the status of the data to be processed is determined to be in the correct state based on the status flag of the data to be processed, the data to be processed is forwarded, and the read pointer is configured to point to the next frame of data of the data to be processed in the circular buffer.
3. The data processing method according to claim 2, characterized in that, The step of determining the status of the data to be processed based on the status flag of the data to be processed includes: The data to be processed is parsed to obtain the status flag of the data to be processed, and the status flag is identified. If the status flag is the first preset flag, then the status of the data to be processed is the correct status; If the status flag is the second preset flag, then the status of the data to be processed is an error status.
4. The data processing method according to claim 1, 2, or 3, characterized in that, The method further includes: When the status of the data to be processed is an error state, the data to be processed is deleted from the circular buffer, and the status of the buffer is reset.
5. A data processing apparatus, characterized in that, The data processing device includes: The data reading module is used to read the current frame data pointed to by the read pointer from the circular buffer as the data to be processed; A data processing module is used to perform a data processing procedure on the data to be processed; the data processing procedure includes: when the state of the data to be processed is determined to be an error state according to the state flag of the data to be processed, configuring a read pointer to point to the next frame of data of the data to be processed in the circular buffer; when the state of the data to be processed is determined according to the state flag of the data to be processed, the state flag is re-identified at least twice, and if the result of at least two re-identifications is an error state, then the state of the data to be processed is determined to be an error state.
6. A data processing method, characterized in that, The data processing method includes: The system receives data to be processed using a network adapter and writes the data to be processed into a circular buffer; after storing the data to be processed in the circular buffer, it initiates a hard interrupt to the central processing unit. The CPU disables the hardware interrupt and enables the software interrupt; when the ksoftirqd process in the CPU kernel receives the software interrupt, it calls the software interrupt handling function to process the data to be processed using the data processing method described in any one of claims 1-4 to obtain the target data; wherein the target data is cached on the corresponding socket. The application calls the read function to read the target data on the socket and copies the target data from kernel space to user space.
7. A data processing apparatus, characterized in that, The data processing device includes: A network adapter is used to receive data to be processed, write the data to be processed into a circular buffer, and initiate a hard interrupt to the central processing unit after the data to be processed is stored in the circular buffer. The central processing unit is used to disable the hard interrupts and enable soft interrupts; and to receive the soft interrupts through the ksoftirqd process in the kernel, and to call the soft interrupt handling function when the soft interrupts are received to process the data to be processed by the data processing method according to any one of claims 1-4 to obtain the target data; wherein the target data is cached on the corresponding socket; The application calls the read function to read target data from the socket and copies the target data from kernel space to user space.
8. A data processing device, characterized in that, include: One or more processors; and A memory for storing one or more programs, which, when executed by one or more processors, cause the memory to perform the method as described in any one of claims 1-4.
9. A machine-readable medium, characterized in that, It stores instructions that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-4.