Data processing method, device, electronic device and storage medium
By using interrupt trigger virtual network card in electronic devices to divert received data, the problems of large processor resource consumption and high RTT in the prior art are solved, and more efficient data processing is achieved.
Patent Information
- Application Number
- CN202111240330.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-10-25
AI Technical Summary
When receiving data through the Internet Interconnection Protocol Accelerator (IPA), the prior art requires creating additional threads to process the data, resulting in large processor resource consumption and high round trip delay (RTT).
The virtual network card is triggered to divert the received data and multiplex the interrupt process to realize data shunt, avoiding data shunt through independent threads, and reducing processor resource consumption and RTT.
This method reduces the consumption of processor resources, reduces RTT, and uniformly processes all data through virtual network cards, reduces the number of interrupts and improves the efficiency of data processing.
Smart Images

Figure CN113986969B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] With the development of the Internet, there are more and more types of network devices on electronic devices. The same electronic device is often equipped with cellular networks, Universal Serial Bus (USB), Wi-Fi, Ethernet and other network devices at the same time. Therefore, Internet Protocol Accelerator (IPA) has emerged. The data of all network devices on the device are routed and forwarded by this IPA. In the current solution of receiving data through IPA, the processor will create an additional thread to process the received data and trigger the network card to read the data. This solution consumes a lot of processor resources. Summary of the invention
[0003] A data processing method, device, electronic device and storage medium can reduce the resource consumption of a processor.
[0004] In a first aspect, a data processing method is provided for an electronic device, the electronic device comprising an application processor and an Internet Protocol accelerator (IPA), the IPA being used for routing and forwarding data, the data processing method comprising: obtaining received data from the IPA; diverting the received data by triggering a virtual network card through an interrupt to obtain the diverted received data; and obtaining the diverted received data through a network subsystem in the application processor.
[0005] In a possible implementation, the received data is diverted by triggering a virtual network card through an interrupt, and the process of obtaining the diverted received data includes: acquiring the received data and the source identifier and network identifier corresponding to the received data; obtaining the corresponding device identifier based on the source identifier and the network identifier; configuring the received data based on the device identifier to obtain the diverted received data.
[0006] In a possible implementation, the electronic device further includes a plurality of network cards of different types, and the data processing method further includes: acquiring transmission data from any network card; and sending the transmission data to the IPA.
[0007] In a possible implementation, obtaining the received data from the IPA includes: obtaining the received data from the IPA, and forming the received data in a socket buffer skb format based on the received data.
[0008] In a second aspect, an application processor is provided for an electronic device, the electronic device including an Internet Protocol accelerator IPA, the IPA being used to route and forward data, the application processor including: a first acquisition module, used to acquire received data from the IPA; a diversion module, used to divert the received data by triggering a virtual network card through an interrupt to obtain the diverted received data; and a second acquisition module, used to acquire the diverted received data through a network subsystem in the application processor.
[0009] In a possible implementation, the diversion module is specifically used to: obtain received data and a source identifier and a network identifier corresponding to the received data; obtain a corresponding device identifier based on the source identifier and the network identifier; configure the received data based on the device identifier to obtain the diverted received data.
[0010] In a possible implementation, the electronic device further includes a plurality of network cards of different types, and the application processor further includes: a third acquisition module, configured to acquire transmission data from any network card; and a transmission module, configured to send the transmission data to the IPA.
[0011] In a possible implementation, the first acquisition module is specifically used to acquire the received data from the IPA, and form the received data in the socket buffer skb format based on the received data.
[0012] In a third aspect, an application processor is provided, comprising: a main processor and a memory, the memory being used to store at least one instruction, and the instruction is loaded and executed by the main processor to implement the above-mentioned data processing method.
[0013] According to a fourth aspect, an electronic device is provided, comprising the application processor according to the second aspect or the third aspect and an Internet Protocol accelerator IPA.
[0014] In a fifth aspect, a computer-readable storage medium is provided, in which a computer program is stored, and when the computer-readable storage medium is run on a computer, the computer executes the above-mentioned data processing method.
[0015] The data processing method, device, electronic device and storage medium in the embodiments of the present application trigger the virtual network card to divert the received data through interruption. Since the data transmission process itself requires interruption operation, the interruption process can be reused to realize the diversion of received data, thereby eliminating the need to divert data through independent threads. Compared with the method of diverting data through independent threads, the resource consumption of the processor is reduced, and the RTT is reduced. Moreover, since all data are uniformly processed through the interruption of the virtual network card, compared with the need to interrupt the data of different network cards separately, there is no need to interrupt each corresponding network card, thereby reducing the number of interruptions. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a structural block diagram of a partial structure of an electronic device in an embodiment of the present application;
[0017] Figure 2 Another structural block diagram of a partial structure of an electronic device in an embodiment of the present application;
[0018] Figure 3 A flowchart of a data processing method in an embodiment of the present application;
[0019] Figure 4 This is a flow chart of another data processing method in an embodiment of the present application;
[0020] Figure 5 This is a structural block diagram of an application processor in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0022] For the received data from IPA, the received data in the socket buffer (skb) format can be obtained through an interrupt trigger, and the received data can be diverted and cached through an independent receive task (recv task) thread, and then the corresponding network interface card (NIC) driver is triggered to read the cached received data, and then sent to the network subsystem network subsystem in the application processor, that is, data is received from IPA through different network cards. However, since it is necessary to create an independent recv task thread to process the data, the microprocessor without interlocked piped stages (mips) in the central processing unit (CPU) is consumed more, that is, the CPU resources are consumed more, and the round-trip time (RTT) is higher; in addition, since the recv task needs to have a higher priority, this will cause the soft interrupt to be unable to be scheduled in time when the soft interrupt is triggered, which may cause the data from IPA to be unable to be transmitted in time.
[0023] The present application embodiment provides a data processing method for an electronic device, such as Figure 1 and Figure 2As shown, the electronic device includes an application processor (AP), a plurality of different types of network cards and an Internet Protocol Accelerator (IPA), and the IPA is used to route and forward data. The execution subject of the data processing method in the embodiment of the present application is the AP.
[0024] For example, the network card may include a Wi-Fi network card, a USB network card, a modem network card, and an Ethernet network card. The IPA may include a USB endpoint, a Wi-Fi endpoint, a high-speed serial computer expansion bus standard (peripheral component interconnect express, pcie) endpoint, an Ethernet endpoint, and a communication processor (Communication Processor, CP) endpoint. The above endpoints are used to realize the transmission of different network data. For example, the USB endpoint is used to transmit USB data, corresponding to the USB network card, the CP endpoint is used to transmit cellular data, corresponding to the modem network card, the Wi-Fi endpoint is used to transmit Wi-Fi data, corresponding to the Wi-Fi network card, the Ethernet endpoint is used to transmit Ethernet data, corresponding to the Ethernet network card, and in addition, the pcie endpoint can also be used to transmit Ethernet data, that is, corresponding to the Ethernet network card. It should be noted that the above network cards and endpoints are only examples. As needed, the electronic device can include more types of other endpoints and network cards, and some endpoints and network cards can also be reduced. The embodiment of the present application does not limit the specific number and type of network cards and the number and type of endpoints in the IPA.
[0025] It should also be noted that Figure 2 In the figure, the box corresponding to AP is used to represent the content related to AP, such as the physical devices and virtual modules controlled by AP. In other words, Figure 2 The box corresponding to AP does not represent the content contained in AP, but represents the content related to AP. IPA also includes AP output endpoint and AP input endpoint. AP output endpoint is used to output data of IPA to AP, and AP input endpoint is used to input data from AP to IPA. AP output endpoint can transmit data through AP receiving channels 1 to N, and AP input endpoint can transmit data through AP sending channels 1 to N.
[0026] The application processor includes a network subsystem, which specifically belongs to a virtual module corresponding to the TCP / IP protocol layer and is used to execute related processing of the TCP / IP protocol layer in the network.
[0027] IPA also includes a router / bridge module, which can be used to implement data routing forwarding, bridging transmission, etc. between different endpoints. Through configuration, the acceleration function can be achieved.
[0028] For example, when an electronic device receives data through a cellular network, the data is first input through the CP endpoint of the IPA and output to the AP through the IPA, so that the electronic device can obtain the data received through the cellular network. When the electronic device sends data through the cellular network, the AP sends the data to the IPA, and the IPA sends the data through the CP endpoint. In addition, the electronic device can also transmit data through other communication methods, such as transmitting data through the USB endpoint, Wi-Fi endpoint, PCIE endpoint or Ethernet endpoint in the IPA through the corresponding communication method. In addition, other forms of data transmission can also be achieved by configuring the routing / bridging module in the IPA. For example, the IPA sends the cellular network data received through the CP endpoint directly through the Wi-Fi endpoint to achieve the function of the Wi-Fi hotspot.
[0029] like Figure 3 As shown, the data processing method in the embodiment of the present application includes:
[0030] Step 101: Acquire received data from the IPA, that is, acquire received data through the AP output endpoint on the IPA;
[0031] Step 102: Trigger the virtual dummy network card through an interrupt to divert the received data, and obtain the diverted received data;
[0032] In an embodiment of the present application, a virtual network card is specially created. When the IPA receives data, the received data is cached, and the fill task thread created by the IPA driver fills the received data to form received data in skb format, and interrupts the new application programming interface (NAPI) of the virtual network card to read the data, and then the received data is diverted. Diversion refers to distinguishing which specific network card the received data corresponds to, that is, the received data corresponding to all network cards are uniformly received and managed by the virtual network card.
[0033] Step 103: Obtain the diverted received data through the network subsystem in the application processor.
[0034] The data processing method in the embodiment of the present application triggers the virtual network card to divert the received data through an interrupt. Since the interrupt operation is required in the process of data transmission, the interrupt process can be reused to realize the diversion of the received data, thereby eliminating the need to divert the data through an independent thread. Compared with the method of diverting data through an independent thread, the resource consumption of the processor is reduced, and the RTT is reduced. Moreover, since all data are uniformly processed through the interrupt of the virtual network card, compared with the need to interrupt the data of different network cards separately, there is no need to interrupt each corresponding to different network cards, thereby reducing the number of interruptions.
[0035] In addition, since the received data of all network cards are uniformly processed by the virtual network card, the same operations in the received data can be completed centrally, and some special processing required by different network cards can also be executed separately after the virtual network card completes the processing of the received data, and then sent to the network subsystem of the application processor. For example, in a possible implementation, if the received data is data corresponding to a USB network card, data corresponding to a modem network card, or data corresponding to an Ethernet network card, it can be directly sent to the network subsystem of the application processor after being diverted by the virtual network card, and for the received data corresponding to the Wi-Fi network card, after being diverted by the virtual network card, it can also be given to the Wi-Fi network card through a notification chain to perform some special processing on the data, and then sent to the network subsystem of the application processor after processing. That is, the embodiment of the present application does not limit the specific process of the above-mentioned step 103 and obtaining the diverted received data through the network subsystem in the application processor. It can be sent directly to the network subsystem or sent to the network subsystem after other processing.
[0036] In addition, IPA can also have a hardware offload function, which can put the functions originally executed by AP on the hardware IPA.
[0037] In a possible implementation, Figure 4 As shown, the above step 102, triggering the virtual network card to divert the received data by interruption, and the process of obtaining the diverted received data includes:
[0038] Step 1021, obtaining received data and a source identifier (source, src) id and a network identifier net id corresponding to the received data;
[0039] After the interrupt triggers the NAPI of the virtual network card to read data, step 1021 can be entered. src id is used to mark the network type, or the network card type, for example, 0x1 represents a USB network card, 0x2 represents a Wi-Fi network card, net id is used to mark the network card serial number under the same network type or network card type, for example, the above-mentioned modem network card actually includes multiple modem network cards from modem network card 0 to modem network card n, 0 represents network card serial number 0, n represents network card serial number n, net id is used to mark a specific network card, for example, Modem nic0 represents modem network card 0, Modem nicn represents modem network card n, USB nic represents USB network card, Veth nic0 represents Ethernet network card 0, Veth nicen represents Ethernet network card n;
[0040] Step 1022, obtaining a corresponding device identifier (netdevice, netdev) according to the source identifier src id and the network identifier net id;
[0041] Table 1
[0042]
[0043]
[0044] Among them, Table 1 is a mapping table of source identifier src id, network identifier net id and device identifier netdev. Based on this mapping table, the corresponding netdev can be obtained according to the matching of src id and net id, and netdev can determine the specific network card corresponding to the received data. The mapping table can be an array structure, without traversal query or calculation of key value.
[0045] Step 1023: configure the received data according to the device identifier netdev to obtain the received data after diversion.
[0046] The received data is configured, that is, the corresponding netdev is set in the received data, even if the received data carries specific netdev, and then the interface can be called to send the received data to the network subsystem of the application processor, so that the network subsystem can determine which specific network card the received data corresponds to according to netdev.
[0047] In a possible implementation, the data processing method further includes: obtaining the transmission data from any network card; sending the transmission data to IPA. For the data from AP that needs to be sent by IPA, each network card driver calls the transmission interface provided by the IPA driver to send it, and after the sending is completed, the cache release action is uniformly released by the release task free task thread created by the IPA driver. That is to say, in the embodiment of the present application, for the transmission data that needs to be sent using IPA, it is still sent through each network card.
[0048] In a possible implementation, obtaining the received data from the IPA in step 101 includes: obtaining the received data from the IPA, and forming the received data in the socket cache skb format based on the received data, that is, filling the received data through the fill task thread created by the IPA driver to form the received data in the skb format.
[0049] like Figure 5 As shown, an embodiment of the present application also provides an application processor for an electronic device, the electronic device includes an Internet Protocol accelerator IPA, the IPA is used to route and forward data, and the application processor includes: a first acquisition module 10, used to obtain received data from the IPA; a diversion module 20, used to divert the received data by triggering a virtual network card through an interrupt to obtain the diverted received data; a second acquisition module 30, used to obtain the diverted received data through a network subsystem in the application processor.
[0050] Among them, the application processor can specifically apply the data processing method in any of the above embodiments. The specific process and principle are the same as those in the above embodiments and will not be repeated here.
[0051] It should be understood that the above Figure 5The division of the modules of the application processor shown is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, any one of the first acquisition module 10, the shunting module 20 and the second acquisition module 30 can be a separately established processing element, or it can be integrated in the application processor, for example, integrated in a certain chip of the application processor. In addition, it can also be stored in the memory of the application processor in the form of a program, and called and executed by a certain processing element of the application processor. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0052] For example, the first acquisition module 10, the shunting module 20 and the second acquisition module 30 can be one or more integrated circuits configured to implement the above method, such as: one or more application-specific integrated circuits (ASIC), or one or more digital singnalprocessors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a certain module above is implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0053] In a possible implementation, the diversion module 20 is specifically used to: obtain received data and a source identifier and a network identifier corresponding to the received data; obtain a corresponding device identifier based on the source identifier and the network identifier; configure the received data based on the device identifier to obtain the diverted received data.
[0054] In a possible implementation, the electronic device further includes a plurality of network cards of different types, and the application processor further includes: a third acquisition module (not shown in the figure), used to acquire transmission data from any network card; and a transmission module (not shown in the figure), used to send the transmission data to the IPA.
[0055] In a possible implementation, the first acquisition module is specifically used to acquire the received data from the IPA, and form the received data in the socket buffer skb format based on the received data.
[0056] An embodiment of the present application also provides an application processor, including: a main processor and a memory, the memory is used to store at least one instruction, and when the instruction is loaded and executed by the main processor, the data processing method in any of the above embodiments is implemented.
[0057] Among them, the application processor can specifically apply the data processing method in any of the above embodiments. The specific process and principle are the same as those in the above embodiments and will not be repeated here.
[0058] The number of main processors may be one or more, and the main processor and memory may be connected via a bus or other means. The memory, as a non-transitory computer-readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the application processor in the embodiment of the present application. The main processor executes various functional applications and data processing methods by running non-transitory software programs, instructions and modules stored in the memory, that is, implements the method in any of the above method embodiments. The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; and necessary data, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device.
[0059] An embodiment of the present application also provides an electronic device, including the above-mentioned application processor, a plurality of network cards of different types, and an Internet Protocol Accelerator IPA.
[0060] The electronic devices involved in this application may be mobile phones, customer premise equipment (CPE), tablet computers, personal computers (PC), vehicle-mounted equipment or wearable devices, etc.
[0061] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the data processing method in any of the above embodiments.
[0062] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0063] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0064] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: Used in an electronic device, the electronic device includes an application processor and an Internet protocol accelerator IPA, the IPA is used to route and forward data, and the data processing method includes: Obtaining received data from the IPA; Triggering the virtual network card to divert the received data by interruption to obtain the diverted received data; The split received data is obtained through the network subsystem in the application processor.
2. The data processing method according to claim 1, characterized in that: The process of triggering the virtual network card to divert the received data by interruption to obtain the diverted received data includes: Acquire the received data and a source identifier and a network identifier corresponding to the received data; Obtaining a corresponding device identifier according to the source identifier and the network identifier; The received data is configured according to the device identifier to obtain the diverted received data.
3. The data processing method according to claim 1, characterized in that: The electronic device further includes a plurality of network cards of different types, and the method further includes: Obtaining the transmission data from any of the network cards; The transmission data is transmitted to the IPA.
4. The data processing method according to claim 1, characterized in that: The acquiring of received data from the IPA includes: The received data from the IPA is obtained, and the received data in the socket buffer skb format is formed based on the received data.
5. An application processor, characterized in that: Used in an electronic device, the electronic device includes an Internet Protocol Accelerator IPA, the IPA is used to route and forward data, and the application processor includes: A first acquisition module, used to acquire received data from the IPA; A shunting module, used for shunting the received data by triggering the virtual network card through an interrupt, so as to obtain the shunted received data; The second acquisition module is used to acquire the received data after diversion through the network subsystem in the application processor.
6. The application processor according to claim 5, characterized in that: The diversion module is specifically used for: Acquire the received data and a source identifier and a network identifier corresponding to the received data; Obtaining a corresponding device identifier according to the source identifier and the network identifier; The received data is configured according to the device identifier to obtain the diverted received data.
7. The application processor according to claim 5, characterized in that: The electronic device further includes a plurality of network cards of different types, and the application processor further includes: A third acquisition module, used to acquire the transmission data from any of the network cards; A sending module is used to send the sending data to the IPA.
8. The application processor according to claim 5, characterized in that: The first acquisition module is specifically used to acquire the received data from the IPA, and form the received data in the socket buffer skb format based on the received data.
9. An application processor, characterized in that: include: A main processor and a memory, wherein the memory is used to store at least one instruction, and when the instruction is loaded and executed by the main processor, it implements the data processing method according to any one of claims 1 to 4.
10. An electronic device, characterized in that it comprises the application processor according to any one of claims 5 to 9 and an Internet Protocol Accelerator IPA.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the data processing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data transmission method and system between data centers and subsystem of data transmission system
CN103281251A
Apparatus and method for invocation of multi threaded accelerator
CN104937541A