Data processing method and device for WiFi chip

By using interrupt triggering in the WiFi chip to cut off the data processing process and allocate data processing to multiple processing cores, the problem of CPU resource waste caused by multi-core resource allocation in the WiFi chip is solved, achieving more efficient resource utilization and performance improvement. .

CN118550683APending Publication Date: 2024-08-27SANECHIPS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310215912.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The multi-core resource allocation method of existing WiFi chips leads to a waste of CPU resources and fails to fully utilize WiFi performance.

Method used

By performing first-stage processing on the data to be processed in the first central processor and caching the data into the data forwarding queue when an interrupt is triggered, the second central processor takes out the data from the queue for second-stage processing when an interrupt is triggered. Truncation and segmentation of data processing flow.

Benefits of technology

It realizes multiple processing cores to execute data processing processes separately, balances CPU resources, simplifies the difficulty for users to achieve multi-core optimization, and solves the problem of CPU resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550683A
    Figure CN118550683A
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and device for a WiFi chip, and the method comprises the steps: obtaining first to-be-processed data in a sending direction from a wired side interface, carrying out the first-stage data processing of the first to-be-processed data through a first central processing unit, obtaining first data, and carrying out the first-stage data processing of the first to-be-processed data under the condition that the first central processing unit triggers a first interruption, and caching the first data to a data forwarding queue in the sending direction, taking out second data from the data forwarding queue under the condition that data forwarding interruption in the sending direction is triggered by the second central processing unit, and performing second-stage data processing on the second data by the second central processing unit. According to the embodiment of the invention, the problem of CPU resource waste caused by a WiFi chip multi-core resource allocation mode in related technologies can be solved, the data processing flow of the WiFi chip is cut off by triggering interruption, and a plurality of processing cores respectively execute a section of data processing flow, so that the CPU resources are balanced, and the difficulty of realizing multi-core optimization by a user is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a data processing method and device for a WiFi chip. Background Art

[0002] With the accelerated development of consumer electronics and smart products, WiFi, as the current mainstream wireless transmission technology, has continuously increased its performance requirements. However, the performance bottleneck of WiFi not only depends on the throughput of the WiFi chip itself, but also requires a sufficiently powerful CPU to fully exert its performance. Currently, multi-processor cores are the mainstream way to improve CPU performance, and making good use of the multi-core characteristics of the CPU is the key to fully exerting the performance of WiFi chips.

[0003] There are currently two main technologies for balancing CPU multi-core resources. The first is the core binding method, that is, the interrupts of the WiFi driver and the internal direct memory access (IDM) driver are bound to different cores, so that the data processing flows of the two drivers can be triggered by their respective interrupts and run on the two cores respectively. Experimental verification shows that when processing the same amount of data, the WiFi driver needs to occupy more CPU resources than the IDM driver. When the amount of data is large, the core where the WiFi driver is located is often fully loaded, while the core where the IDM driver is located is still idle, resulting in reduced WiFi performance and CPU resource waste. The second is the tasklet method, which is a core splitting method provided by the Linux kernel. Although it can split a single driver process, users need to write different tasklet initialization functions and processing functions for different WiFi chips, so the implementation cost is high. More importantly, directly using the tasklet method to split the core will result in loss of inter-core communication. Excessive scheduling will increase the CPU burden and affect performance.

[0004] In summary, there is no good solution to the problem of CPU resource waste caused by the multi-core resource allocation method of WiFi chips in related technologies. Summary of the invention

[0005] The embodiments of the present application provide a data processing method and device for a WiFi chip, so as to at least solve the problem of CPU resource waste caused by the multi-core resource allocation method of the WiFi chip in the related art.

[0006] According to one embodiment of the present application, a data processing method for a WiFi chip is provided, the method comprising: performing a first stage of data processing on data to be processed by a first central processor to obtain first data; when the first central processor triggers a first interrupt, caching the first data in a data forwarding queue; when a second central processor triggers a data forwarding interrupt, taking out second data from the data forwarding queue, and performing a second stage of data processing on the second data by the second central processor, wherein the second data is part or all of the first data.

[0007] According to another embodiment of the present application, a data processing device of a WiFi chip is provided, the device comprising: a first processing module, used to perform a first stage of data processing on data to be processed by a first central processing unit to obtain first data; a cache module, used to cache the first data to a data forwarding queue when the first central processing unit triggers a first interrupt; a second processing module, used to take out second data from the data forwarding queue when the second central processing unit triggers a data forwarding interrupt, and perform a second stage of data processing on the second data by the second central processing unit, wherein the second data is part or all of the first data.

[0008] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.

[0009] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0010] Through the embodiments of the present application, the data processing flow of the WiFi chip is interrupted by triggering an interrupt, so that multiple processing cores can execute a section of the data processing flow respectively, thereby balancing CPU resources, simplifying the difficulty of users to achieve multi-core optimization, and further solving the problem of CPU resource waste caused by the multi-core resource allocation method of the WiFi chip in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a hardware structure block diagram of the data processing method of the WiFi chip of the embodiment of the present application;

[0012] Figure 2 is a flow chart of a data processing method of a WiFi chip according to an embodiment of the present application;

[0013] Figure 3 This is a schematic diagram of the original data flow of the WiFi chip;

[0014] Figure 4 It is a schematic diagram of the data flow of a WiFi chip having a WFWD module according to an embodiment of the present application;

[0015] Figure 5 is a schematic diagram of a WiFi chip data flow according to an embodiment of the present application;

[0016] Figure 6 It is a schematic diagram of the data flow of the WiFi chip receiving direction according to the embodiment of the present application;

[0017] Figure 7 is a flowchart of initializing the WFWD module according to an embodiment of the present application;

[0018] Figure 8 is a data processing flow chart inside the WFWD module in the sending direction according to an embodiment of the present application;

[0019] Fig. 9 is a data processing flow chart inside the WFWD module in the receiving direction according to an embodiment of the present application;

[0020] Fig.10 It is a block diagram of a data processing device of a WiFi chip according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0023] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 is a hardware structure block diagram of the data processing method of the WiFi chip of the embodiment of the present application, such as Figure 1 As shown, the hardware board may include one or more ( Figure 1 Only one is shown in the figure) a processor 12 (the processor 12 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device) and a memory 14 for storing data, wherein the mobile terminal may also include a transmission device 16 for communication functions and an input and output device 18. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0024] The memory 14 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data processing method of the WiFi chip in the embodiment of the present application. The processor 12 executes various functional applications and the data processing method of the WiFi chip by running the computer program stored in the memory 14, that is, to implement the above method. The memory 14 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 14 may further include a memory remotely arranged relative to the processor 12, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0025] The transmission device 16 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider. In one example, the transmission device 16 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 16 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0026] In one embodiment of the present application, a data processing method for a WiFi chip is provided. Figure 2 is a flow chart of a data processing method of a WiFi chip according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0027] Step S202, performing a first stage of data processing on the data to be processed by a first central processing unit to obtain first data;

[0028] Step S204, when the first central processor triggers the first interrupt, cache the first data into the data forwarding queue;

[0029] Step S206, when the second central processor triggers a data forwarding interrupt, the second data is taken out from the data forwarding queue, and the second central processor performs a second stage of data processing on the second data.

[0030] In this embodiment, the second data in step S206 is part or all of the first data.

[0031] In an optional embodiment, after step S202, the method further includes: triggering the first interrupt by the first central processor when the number of data packets of the first data is equal to a first preset threshold; or triggering the first interrupt by the first central processor when the cumulative time for acquiring the first data is equal to a second preset threshold.

[0032] Furthermore, by setting the first preset threshold and the second preset threshold, it is possible to prevent the amount of data processed at a time from being too large during peak periods, and to prevent the waiting time for data processing from being too long during off-peak periods.

[0033] In one embodiment, caching the first data in the data forwarding queue in step S204 may specifically include the following steps:

[0034] Step S2042, calling the queue entry interface of the data forwarding queue;

[0035] Step S2044: Cache multiple data packets in the first data into a data forwarding queue in sequence through an in-queue interface.

[0036] In this embodiment, step S2044 may specifically include performing the following operations in sequence for each data packet in the first data: receiving a data packet through an in-queue interface; determining whether the total amount of data in the data forwarding queue is greater than or equal to a third preset threshold; if the judgment result is yes, discarding the data packet; if the judgment result is no, inserting the data packet at the tail of the data forwarding queue.

[0037] Specifically, in a single buffering process, if the data forwarding queue is full, the remaining unbuffered data packets are discarded. The number of data packets that the data forwarding queue can accommodate (ie, the third preset threshold) can be adjusted according to the size of the pre-applied memory space.

[0038] In an optional embodiment, after step S2044, the method further includes: calling a dequeue interface of the data forwarding queue through the second central processor; and triggering a data forwarding interrupt through the second central processor when there is a data packet in the data forwarding queue.

[0039] In this embodiment, after the data forwarding interrupt is triggered by the second central processor, the method further includes: calling an interrupt service function bound to the data forwarding interrupt by the second central processor; and calling a tasklet function by the interrupt service function.

[0040] Specifically, the tasklet function is put into the tasklet task queue and is scheduled and executed in sequence by the second central processing unit.

[0041] In one embodiment, the second data is taken out from the data forwarding queue in step S206, and the second stage data processing is performed on the second data in the second central processor, which may specifically include:

[0042] Step S2062, taking out all the data packets in the data forwarding queue from the head of the data forwarding queue in sequence to obtain second data;

[0043] Step S2064, calling the pre-packaged callback function through the second central processing unit;

[0044] Step S2066: Perform second-stage data processing on the second data through the callback function.

[0045] In an optional embodiment, the data to be processed in step S202 may specifically include sending direction data obtained from the wired side interface and receiving direction data obtained from the wireless side interface.

[0046] Furthermore, the data forwarding queue includes a sending direction queue and a receiving direction queue; each data forwarding queue corresponds to an in-queue interface and an out-queue interface; the data forwarding queue is a locked queue, and each data forwarding queue can only call the in-queue interface or the out-queue interface at the same time.

[0047] Specifically, a locked queue can prevent two processes from entering or exiting the queue at the same time, causing data corruption.

[0048] In one embodiment, step S202 may specifically include: when the data to be processed is transmission direction data, transferring the transmission direction data from the wired side interface to the WiFi driver through the internal direct storage access IDM driver.

[0049] Specifically, the wired side interface includes a passive optical network (Passive Optical Network, referred to as PON) interface, a wide area network (Wide Area Network, referred to as WAN) interface or a local area network (Local Area Network, referred to as LAN) interface.

[0050] In another embodiment, step S202 may specifically include: when the data to be processed is receiving direction data, performing data processing on the receiving direction data by using closed source software in the WiFi driver.

[0051] In one embodiment, the second stage data processing of the second data by the second central processor in step S206 may specifically include: when the data to be processed is sending direction data, data processing of the second data in the sending direction is performed by the open source software in the WiFi driver to obtain third data.

[0052] Furthermore, after the second data in the sending direction is processed by the open source software in the WiFi driver to obtain the third data, the method also includes: triggering the second interrupt by the first central processing unit; performing the third stage data processing on the third data by the first central processing unit to obtain the fourth data.

[0053] Specifically, performing the third stage of data processing on the third data includes performing data processing on the third data through the closed source software in the WiFi driver; and sending the fourth data through the wireless side interface.

[0054] In another embodiment, the second stage data processing of the second data by the second central processor in step S206 may specifically include: when the data to be processed is receiving direction data, data processing is performed on the second data in the receiving direction by the open source software in the WiFi driver to obtain third data.

[0055] Furthermore, after processing the second data in the receiving direction through the open source software in the WiFi driver to obtain the third data, the method also includes: transferring the third data from the WiFi driver to the wired side interface through the IDM driver; and sending the third data through the wired side interface.

[0056] In an optional embodiment, before step S202, the method further includes: in the initialization phase of the WiFi chip, applying for a memory pool for the IDM driver and the WiFi driver in advance.

[0057] Specifically, the memory pool stores data packets of the IDM driver or the WiFi driver in the memory space in a stack manner.

[0058] Furthermore, the method also includes: when the IDM driver or WiFi driver receives a data packet, popping up a memory space corresponding to the data packet from the top of the memory pool, wherein the memory space is used to store the data packet; when the IDM driver or WiFi driver releases the data packet, pushing the memory space corresponding to the data packet from the top of the memory pool.

[0059] In another optional embodiment, before step S202, the method further includes: in the initialization phase of the WiFi chip, binding the first interrupt and the second interrupt to the first central processor; and binding the data forwarding interrupt to the second central processor.

[0060] Furthermore, the embodiments of the present application are not limited to dual-core CPUs and the above-mentioned interrupts. The embodiments of the present application can also be applied to other multi-core CPUs, where the complete data processing flow is divided into arbitrary stages by triggering interrupts, and the data packets are processed in multiple cores respectively by data forwarding interrupts.

[0061] In an embodiment of the present application, through the above-mentioned steps S202 to S206, the problem of CPU resource waste caused by the multi-core resource allocation method of the wifi chip in the related technology can be solved. By triggering an interrupt to interrupt the data processing flow of the wifi chip, multiple processing cores can execute a section of the data processing flow respectively, thereby balancing CPU resources and simplifying the difficulty for users to achieve multi-core optimization.

[0062] In another embodiment, the data forwarding queue in the above-mentioned application embodiment may be encapsulated as a closed-source wireless forwarding module (Wireless Forward Module, WFWD for short).

[0063] Figure 3 This is a schematic diagram of the original data flow of the WiFi chip. Figure 3 As shown, when the WiFi chip does not have a WFWD module, the original data flow needs to go through the following structure:

[0064] System chip 32 , IDM driver 34 , WiFi driver 36 , WiFi integrated circuit 38 .

[0065] In this embodiment, data in the sending direction flows from the wired side interface (LAN) into the wired part of the switch (SW) of the system chip 32, and then is forwarded to the WiFi driver 36 through the IDM driver 34. Finally, the WiFi driver sends the data to the WiFi integrated circuit 38 (IC).

[0066] Furthermore, the same is true when the data flow is in the reverse direction (receiving direction).

[0067] In this embodiment, both the IDM driver 34 and the WiFi driver 36 rely on CPU processing.

[0068] Figure 4 FIG. 1 is a schematic diagram of a data flow of a WiFi chip having a WFWD module according to an embodiment of the present application. Figure 4 As shown, the data flow of the WFWD module needs to go through the following structure:

[0069] System chip 32 , IDM driver 34 , wireless forwarding module 42 , WiFi driver 36 , WiFi integrated circuit 38 .

[0070] Specifically, the data flow with the WFWD module is a data flow in which a wireless forwarding module 42 (WFWD module) is added between the IDM driver 34 and the WiFi driver 36 in the original data flow. The wireless forwarding module 42 realizes uniform core distribution by cutting off the original data flow.

[0071] In this embodiment, the WFWD module only needs to open two interfaces to any manufacturer's WiFi data stream driver, namely, the queue entry interface and the queue exit interface for triggering interrupts. The user only needs to call the queue entry interface of the WFWD module at the appropriate position, cut off the original WiFi driver data flow, fill all the valid data into the queue of the WFWD module, and then trigger the WFWD module interrupt on another core, and then call the queue exit interface, and then the valid data can be taken out on another core and the second half of the data processing flow can be processed.

[0072] In one embodiment of the present application, the WiFi chip used may be MTK7916, which includes a multi-core CPU, an IDM module, a WFWD module, a Tx / Rx stack Pool (send / receive resource pool), and a WiFi Tx / Rx (send / receive) driver.

[0073] Furthermore, the CPU model of this chip is ZTE 128s, which contains two processor cores, namely CPU0 and CPU1. The CPU integrates an interrupt controller for scheduling the IDM module, WFWD module, WiFi driver and other system interrupts.

[0074] Figure 5 Schematic diagram of the data flow of the WiFi chip sending direction in the embodiment of the present application. Figure 5 As shown, in the WiFi data transmission direction, the data flow needs to go through the following structure:

[0075] Wired side interface 51 , internal direct storage access module 52 , sending memory pool 53 , wireless forwarding module 54 , WiFi driver sending the first half 55 , WiFi driver sending the second half 56 , WiFi sending firmware side driver 57 .

[0076] In this embodiment, the wired side interface 51 may specifically include a passive optical network PON interface, a wide area network WAN interface or a local area network LAN interface. Specifically, PON / WAN / LAN is the starting point for the wireless terminal device to send packets.

[0077] In this embodiment, the internal direct storage access module 52 (ie, IDM) is a submodule inside the CPU, which can replace the CPU to complete the data transfer between the WiFi driver and the PON / WAN / LAN driver, thereby reducing the CPU load.

[0078] In this embodiment, the sending memory pool 53 (Tx stack Pool) is a memory pool implemented in a memory space in a stack manner.

[0079] Specifically, the sending memory pool 53 needs to be applied in advance during the IDM / WiFi driver initialization phase. It is responsible for allocating memory space for packets received by the IDM / WiFi driver and reclaiming the memory space of packets released by the WiFi / IDM driver. When allocating memory, a section of memory space is popped from the top, and when reclaiming memory, a section of memory space is also pushed from the top.

[0080] In this embodiment, the wireless forwarding module 54 (ie, WFWD) can store the data sent by the IDM or WiFi driver into a queue, then retrieve the data from the queue by triggering an interrupt, and perform the next data flow processing on the designated CPU core.

[0081] Specifically, the WFWD module provides two interfaces for the Tx (transmit) process of the WiFi driver, namely the queue entry interface wfwd_tx_enq and the queue exit interface wfwd_tx_deq.

[0082] Furthermore, the WFWD module also pre-applies for two interrupts, one for sending and one for receiving. The one in the Tx process is the sending direction data forwarding interrupt wfwd_t. After the interrupt is triggered, the queue interface wfwd_tx_deq will be called to take out the data in the queue, and then switch to other cores to process the next data flow.

[0083] In this embodiment, the queue of the WFWD module in the sending direction is the sending direction queue wfwd_tx_queue, and each valid element in the queue points to the address space of the valid data packet stored in the sending memory pool 53 (Tx stack Pool). When a packet is received, it is inserted from the tail of the queue, and when a packet is sent, it is removed from the head of the queue.

[0084] In this embodiment, the WiFi driver sends the first half 55 and the WiFi driver sends the second half 56 both belong to the WiFiTx (send) driver, which is an open source software development kit (SDK) provided by the WiFi chip manufacturer and is used to process data packets and protocol packets received by the WiFi chip from the system or air interface.

[0085] In this embodiment, the WiFi sending firmware side driver 57 is a closed source SDK provided by the WiFi chip manufacturer, which is used to cooperate with the open source WiFi Tx driver to process data packets and protocol packets received by the WiFi chip from the system or air interface.

[0086] Figure 6 Schematic diagram of the data flow of the WiFi chip receiving direction in the embodiment of the present application. Figure 6As shown, in the WiFi data receiving direction, the data flow needs to go through the following structure:

[0087] WiFi receiving firmware side driver 61 , WiFi driver receiving 62 , receiving memory pool 63 , wireless forwarding module 64 , internal direct storage access module 65 , and wired side interface 66 .

[0088] In this embodiment, the WiFi receiving firmware side driver 61 is a closed source SDK provided by the WiFi chip manufacturer, which is used to cooperate with the open source WiFi Rx driver to process data packets and protocol packets received by the WiFi chip from the system or air interface.

[0089] In this embodiment, the WiFi driver receiving 62 (WiFi Rx driver) is an open source SDK provided by the WiFi chip manufacturer, and is used to process data packets and protocol packets received by the WiFi chip from the system or air interface.

[0090] In this embodiment, the receiving memory pool 63 (Rx stack Pool) is a memory pool implemented in a memory space in a stack manner.

[0091] Specifically, the receiving memory pool 63 needs to be applied in advance during the IDM / WiFi driver initialization phase. It is responsible for allocating memory space for packets received by the IDM / WiFi driver and reclaiming the memory space of packets released by the WiFi / IDM driver. When allocating memory, a section of memory space is popped up from the top, and when reclaiming memory, a section of memory space is also pushed in from the top.

[0092] In this embodiment, the wireless forwarding module 64 (ie, WFWD) can store the data sent by the IDM or WiFi driver into a queue, then retrieve the data from the queue by triggering an interrupt, and perform the next data flow processing on the designated CPU core.

[0093] Specifically, the WFWD module also provides two interfaces for the Rx (receiving) process of the WiFi driver, namely the queue entry interface wfwd_rx_enq and the queue exit interface wfwd_rx_deq.

[0094] Furthermore, the WFWD module also pre-applies for two interrupts, one for sending and one for receiving. The one in the Rx process is the receiving direction data forwarding interrupt wfwd_r. After the interrupt is triggered, the queue interface wfwd_rx_deq will be called to take out the data in the queue, and then switch to other cores to process the next data flow.

[0095] In this embodiment, the queue of the WFWD module in the sending direction is the sending direction queue wfwd_tx_queue, and each valid element in the queue points to the address space of the valid data packet stored in the receiving memory pool 63 (Rx stack Pool). When a packet is received, it is inserted from the tail of the queue, and when a packet is sent, it is removed from the head of the queue.

[0096] In this embodiment, the internal direct storage access module 65 (ie, IDM) is a submodule inside the CPU, which can replace the CPU to complete the data transfer between the WiFi driver and the PON / WAN / LAN driver, thereby reducing the CPU load.

[0097] In this embodiment, the wired side interface 66 may specifically include a passive optical network PON interface, a wide area network WAN interface or a local area network LAN interface. Similarly, PON / WAN / LAN is the end point for the wireless terminal device to receive packets.

[0098] Through the embodiment of the present application, it is only necessary to embed the queue entry and queue exit interfaces of the WFWD module into the original data transmission process of the WiFi driver, so that the data flow of the WiFi driver can be divided into different cores for processing, thereby playing a role in balancing the CPU load. Through this method, the multi-core optimization method implemented by the WFWD module can also be quickly adapted to other models of WiFi chips, simplifying the difficulty of users to implement multi-core optimization, and having high versatility.

[0099] Figure 7 1 is a flowchart of initializing the WFWD module in the embodiment of the present application. Figure 7 As shown, the initialization process of the WFWD module includes the following steps:

[0100] Step S701, loading the WFWD module;

[0101] Step S702, applying for WFWD interruption in the sending / receiving direction;

[0102] Step S703, initializing the send / receive direction queue and queue lock;

[0103] Step S704, initializing the tasklet function of the sending / receiving direction out of the queue;

[0104] Step S705, initializing the WFWD module data statistics file system;

[0105] Step S706, hook the sending / receiving function of the WiFi chip to the hook of the WFWD module.

[0106] In this embodiment, the WFWD module can be loaded during the boot process of the Linux system.

[0107] In this embodiment, after the WFWD module is loaded, it will first apply to the Linux system for interrupt resources in the transmission (Transport, referred to as Tx) and reception (Receive, referred to as rx) directions, namely wfwd_t and wfwd_r. After the application is successful, the two interrupts applied for are bound to CPU1.

[0108] Furthermore, the interrupts of the WiFi driver and IDM driver are on CPU0, and core division can be achieved by binding the wfwd_t and wfwd_r interrupts to different cores.

[0109] In this embodiment, step S703 respectively initializes the WFWD module sending direction queue wfwd tx queue and receiving direction queue wfwd rx queue and the locks protecting the two queues. The locks are used to prevent two processes from entering or exiting the queue at the same time, causing data corruption.

[0110] In this embodiment, step S704 initializes the tasklet processing functions of the WFWD module in the sending direction and the receiving direction respectively.

[0111] Furthermore, the tasklet processing function is not scheduled from CPU0 to CPU1, but follows the interrupt. The tasklet runs on the core where the interrupt is triggered. Since wfwd_t and wfwd_r have been initialized on CPU1, the loss of inter-core communication can be avoided.

[0112] In this embodiment, the data statistics file system in step S705 is used to record the WiFi chip model when the system is loaded and to perform statistics on the sent and received packets when the module is running.

[0113] In this embodiment, step S706 can hook the packet receiving and sending callback functions of different WiFi chips to the hook function of the WFWD module.

[0114] Specifically, the callback function is the function that the WiFi driver is about to process next, which is intercepted by the queue entry function of the WFWD module. The function to be processed is encapsulated into a callback function and provided to the WFWD module for calling when it is dequeued.

[0115] In this embodiment, the above steps S701 to S705 are common initialization steps for different WiFi chips, and step S706 is used to adapt to different models of WiFi chips. The interrupt triggering timing and the corresponding callback function content can also be further adjusted according to the number of cores.

[0116] Figure 8 1 is a flow chart of data processing inside the WFWD module in the sending direction according to an embodiment of the present application. Figure 8As shown, the data processing flow inside the WFWD module in the sending direction may specifically include the following steps:

[0117] Step S801, triggering IDM interruption;

[0118] Step S802, receiving data sent by IDM;

[0119] Step S803, determining whether the data in the IDM has been sent;

[0120] Step S804, wfwd tx enters the queue interface;

[0121] Step S805, determining whether the number of packets in the queue exceeds a threshold;

[0122] Step S806, discard the data;

[0123] Step S807, insert the data into the tail of the wfwd tx que queue;

[0124] Step S808, wfwd tx out queue interface;

[0125] Step S809, determine whether there is data in wfwd tx que;

[0126] Step S810, triggering wfwd tx interrupt wfwd_t;

[0127] Step S811, calling the interrupt service function hung under the interrupt;

[0128] Step S812, calling the tasklet function bound to the interrupt;

[0129] Step S813, determine whether there is data in wfwd tx que;

[0130] Step S814, taking the data out from the head of the wfwd tx que queue in sequence;

[0131] Step S815, call the WiFi driver Tx callback function:

[0132] Step S816, WiFi drives the first half of TX;

[0133] Step S817, triggering tx WiFi interruption;

[0134] Step S818, WiFi drives the second half of TX.

[0135] In this embodiment, Figure 8 The process in the dotted box is executed on CPU1, and the other processes are executed on CPU0.

[0136] In this embodiment, after receiving a certain amount of data, the IDM will trigger an interrupt to send a certain amount of data (for example, 256 data packets) to the WFWD module in a cyclic manner. The IDM interrupt is triggered on CPU0. If no other interrupt is triggered, the subsequent data processing flow will remain executed on CPU0.

[0137] In this embodiment, the WFWD module calls the queue entry interface to sequentially receive all data packets sent by the IDM and store them in the wfwd tx que.

[0138] In this embodiment, if the judgment in step S803 is no, step S804 is executed; if the judgment is yes, step S808 is executed.

[0139] In this embodiment, step S805 determines whether wfwd tx que exceeds a threshold value (20480). If so, the data packet is discarded (step S806). If not, the data packets are sequentially inserted into the tail of the wfwd tx que queue (step S807).

[0140] In this embodiment, after the IDM completes sending data in one interruption, it immediately triggers the wfwd tx out-queue interface.

[0141] In this embodiment, it is determined whether there is data in the wfwd tx que queue. If there is data, a wfwd_t interrupt is triggered. If not, no processing is performed.

[0142] Furthermore, when there is data in the wfwd tx que queue and the wfwd_t interrupt is triggered successfully, the interrupt service function bound to the wfwd_t interrupt is called. If the interrupt is triggered by CPU1, the interrupt service function will also run on CPU1, that is, the core division is completed at this time.

[0143] In this embodiment, the interrupt service function calls the tasklet processing function, hangs the task in the tasklet task queue of the Linux system, and is scheduled and executed in sequence by CPU1.

[0144] In this embodiment, step S814 cyclically takes out the data in the queue according to the number of data in the wfwd tx que queue, and calls the callback function of the wifi driver Tx direction.

[0145] Furthermore, the first half of the WIFI driver Tx is completed in the callback function.

[0146] Specifically, the first half of the WIFI driver in this embodiment can be to complete the descriptor filling step according to the requirements of the MTK7916 WIFI driver. After the step is completed, the WIFI driver itself will actively trigger the tx wifi interrupt interrupt, thereby completing the second half of the WIFI driver Tx.

[0147] In this embodiment, the tx wifi interrupt is interrupted on CPU0, so the second half of the WIFI driver also runs on CPU0.

[0148] Furthermore, after the second half of the WIFI driver Tx is completed, it will automatically enter the WIFI Tx firmware side driver process and send the data packet into the air via the WiFi chip.

[0149] Fig. 9 1 is a flow chart of data processing inside the WFWD module in the receiving direction according to an embodiment of the present application. Fig. 9 As shown, the data processing flow inside the WFWD module in the receiving direction may specifically include the following steps:

[0150] Step S901, triggering rx wifi interrupt;

[0151] Step S902, receiving data sent by the WiFi driver;

[0152] Step S903, determining whether the data in the WiFi driver has been sent;

[0153] Step S904, wfwd rx enters the queue interface;

[0154] Step S905, determining whether the number of packets in the queue exceeds a threshold;

[0155] Step S906, discard the data;

[0156] Step S907, insert the data into the tail of the wfwd rx que queue;

[0157] Step S908, wfwd rx out queue interface;

[0158] Step S909, determine whether there is data in wfwd rx que;

[0159] Step S910, triggering wfwd rx interrupt wfwd_r;

[0160] Step S911, calling the interrupt service function hung under the interrupt;

[0161] Step S912, calling the tasklet function bound to the interrupt;

[0162] Step S913, determine whether there is data in wfwd rx que;

[0163] Step S914, taking the data out from the head of the wfwd rx que queue in sequence;

[0164] Step S915, calling the WiFi driver Rx callback function;

[0165] Step S916, WiFi drives RX;

[0166] Step S917, PON / WAN / LAN.

[0167] In this embodiment, after the WiFi chip receives a certain number of data packets, the firmware side of the WiFi driver triggers the Rx direction data interrupt to call the tasklet function of the WiFi driver, and sends the data packets to the WFWD module in a loop. The WiFi driver Rx direction data interrupt is triggered on CPU0. If no other interrupt is triggered, the subsequent data processing flow remains executed on CPU0.

[0168] In this embodiment, the WFWD module calls the queue entry interface to sequentially receive all data packets sent from the firmware side in the Rx direction of the wifi driver, and store them in the wfwd rx que.

[0169] In this embodiment, step S905 determines whether wfwd rx que exceeds a threshold (for example, 20480). If so, the data is discarded (step S906). If not, the data is sequentially inserted into the tail of the wfwd rx que queue (step S907).

[0170] In this embodiment, after the wifi driver Rx direction firmware side completes sending data in one interrupt, it triggers the wfwd rx queue out interface.

[0171] In this embodiment, step S909 determines whether there is data in the wfwd rx que queue. If so, a wfwd_r interrupt is triggered (S910). If not, no processing is performed.

[0172] In this embodiment, when there is data in the wfwd rx que queue and the wfwd_r interrupt is triggered successfully, the interrupt service function bound to the wfwd_r interrupt is called. The interrupt is triggered by CPU1, and the interrupt service function also runs on CPU1, that is, the core division is completed at this time.

[0173] In this embodiment, the interrupt service function calls the tasklet processing function, hangs the task in the tasklet task queue of the Linux system, and is scheduled and executed in sequence by CPU1.

[0174] In this embodiment, step S914 takes out the data in the queue in a loop according to the number of data in the wfwd rx que queue, and calls the callback function of the wifi driver Rx direction. Specifically, the second half of the WIFI driver Rx can be completed in the callback function.

[0175] Specifically, the first half of the WIFI driver Rx in the embodiment of the present application mainly processes the interrupt response of the MTK7916 WIFI driver Rx direction and schedules the tasklet function triggered by the interrupt. After this step is completed, the WIFI driver itself will actively trigger the rx wifi interrupt interrupt, thereby triggering the second half of the process of the WIFI driver Rx direction.

[0176] In this embodiment, IDM receives data packets in the Rx direction of WiFi without being triggered by an interrupt. The data packets are directly forwarded to PON / WAN / LAN after being processed by IDM. Therefore, the processing flow driven by IDM follows the wfwd_r interrupt and also runs on CPU1.

[0177] According to another aspect of the embodiments of the present application, a data processing device for a WiFi chip is also provided.

[0178] Fig.10 is a block diagram of a data processing device of a WiFi chip according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0179] A first processing module 102, configured to perform a first stage of data processing on the data to be processed by a first central processing unit to obtain first data;

[0180] The cache module 104 is used to cache the first data into the data forwarding queue when the first central processor triggers the first interrupt;

[0181] The second processing module 106 is used to take out second data from the data forwarding queue and perform second-stage data processing on the second data through the second central processor when the second central processor triggers a data forwarding interrupt, wherein the second data is part or all of the first data.

[0182] In this embodiment, the device further includes:

[0183] The first trigger module is used to trigger the first interrupt through the first central processor when the number of data packets of the first data is equal to a first preset threshold; or to trigger the first interrupt through the first central processor when the cumulative time for obtaining the first data is equal to a second preset threshold.

[0184] In this embodiment, the cache module 104 may specifically include:

[0185] A first calling unit, used for calling the queue entry interface of the data forwarding queue;

[0186] The cache unit is used to sequentially cache multiple data packets in the first data into the data forwarding queue through the queue entry interface.

[0187] In this embodiment, the cache unit is also used to perform the following operations in sequence for each data packet in the first data: receiving the data packet through the queue entry interface; determining whether the total amount of data in the data forwarding queue is greater than or equal to a third preset threshold; if the judgment result is yes, discarding the data packet; if the judgment result is no, inserting the data packet at the tail of the data forwarding queue.

[0188] In this embodiment, the device further includes:

[0189] The second trigger module is used to call the dequeue interface of the data forwarding queue through the second central processor; when there is a data packet in the data forwarding queue, trigger the data forwarding interrupt through the second central processor.

[0190] In this embodiment, the device further includes a calling module.

[0191] A calling module is used to call the interrupt service function bound to the data forwarding interrupt through the second central processing unit; call the small task tasklet function through the interrupt service function, wherein the tasklet function is placed in the tasklet task queue and is scheduled and executed in sequence by the second central processing unit.

[0192] In this embodiment, the second processing module 106 may specifically include:

[0193] an extracting unit, configured to extract all data packets in the data forwarding queue from the head of the data forwarding queue in sequence to obtain the second data;

[0194] A second calling unit, configured to call a pre-packaged callback function through the second central processing unit;

[0195] A processing unit is used to perform a second stage of data processing on the second data through the callback function.

[0196] In this embodiment, the first processing module 102 is used to, when the data to be processed is sending direction data, move the sending direction data from the wired side interface to the WiFi driver through the internal direct storage access IDM driver, wherein the wired side interface includes a passive optical network PON interface, a wide area network WAN interface or a local area network LAN interface; or, when the data to be processed is receiving direction data, perform data processing on the receiving direction data through the closed source software in the WiFi driver.

[0197] In this embodiment, the second processing module 106 is also used to, when the data to be processed is sending direction data, perform data processing on the second data in the sending direction through the open source software in the WiFi driver to obtain third data; or, when the data to be processed is receiving direction data, perform data processing on the second data in the receiving direction through the open source software in the WiFi driver to obtain third data.

[0198] In an optional embodiment, the device may further include a third processing module.

[0199] The third processing module is used to perform data processing on the second data in the sending direction through the open source software in the WiFi driver to obtain third data, and then trigger a second interrupt through the first central processor; perform third-stage data processing on the third data through the first central processor to obtain fourth data, wherein the third-stage data processing on the third data includes: performing data processing on the third data through the closed-source software in the WiFi driver; and sending the fourth data through the wireless side interface.

[0200] In another optional embodiment, the third processing module is also used to perform data processing on the second data in the receiving direction through the open source software in the WiFi driver, and after obtaining the third data, transfer the third data from the WiFi driver to the wired side interface through the IDM driver; and send the third data through the wired side interface.

[0201] In one embodiment, the device further comprises a memory module.

[0202] The memory module is used to apply for a memory pool for the IDM driver and the WiFi driver in advance during the initialization phase of the WiFi chip, wherein the memory pool stores data packets of the IDM driver or the WiFi driver in a memory space in a stack manner.

[0203] The memory module is also used to pop up the memory space corresponding to the data packet from the top of the memory pool when the IDM driver or the WiFi driver receives the data packet, wherein the memory space is used to store the data packet; and to push the memory space corresponding to the data packet from the top of the memory pool when the IDM driver or the WiFi driver releases the data packet.

[0204] In one embodiment, the device further includes an initialization module, which is used to bind the first interrupt and the second interrupt to the first central processor during the initialization phase of the WiFi chip; and bind the data forwarding interrupt to the second central processor.

[0205] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.

[0206] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0207] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0208] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0209] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0210] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0211] The above description is only the preferred embodiment of the present application and is 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 principles of the present application shall be included in the protection scope of the present application.

Claims

1. A data processing method for a WiFi chip, characterized in that: The method comprises: Performing a first phase of data processing on the data to be processed by a first central processing unit to obtain first data; When the first central processing unit triggers a first interrupt, caching the first data into a data forwarding queue; When the second central processor triggers a data forwarding interrupt, second data is taken out from the data forwarding queue, and the second central processor performs second-stage data processing on the second data, wherein the second data is part or all of the first data.

2. The method according to claim 1, characterized in that After the first central processor performs the first stage of data processing on the data to be processed to obtain the first data, the method further includes: When the number of data packets of the first data is equal to a first preset threshold, triggering the first interruption by the first central processor; or, When the accumulated time for acquiring the first data is equal to a second preset threshold, the first interrupt is triggered by the first central processing unit.

3. The method according to claim 1, characterized in that Cache the first data into a data forwarding queue, including: Calling the queue entry interface of the data forwarding queue; Through the queue entry interface, multiple data packets in the first data are sequentially cached into the data forwarding queue.

4. The method according to claim 3, characterized in that The method of sequentially caching multiple data packets in the first data to the data forwarding queue through the queue entry interface includes: Perform the following operations on each data packet in the first data: receiving the data packet through the in-queue interface; Determining whether the total amount of data in the data forwarding queue is greater than or equal to a third preset threshold; If the judgment result is yes, discard the data packet; If the judgment result is no, the data packet is inserted into the tail of the data forwarding queue.

5. The method according to claim 3, characterized in that: After sequentially caching the plurality of data packets in the first data into the data forwarding queue, the method further includes: Calling the out-queue interface of the data forwarding queue by the second central processor; When there is a data packet in the data forwarding queue, the data forwarding interrupt is triggered by the second central processing unit.

6. The method according to claim 5, characterized in that After the data forwarding interrupt is triggered by the second central processing unit, the method further includes: Calling, by the second central processing unit, an interrupt service function bound to the data forwarding interrupt; The tasklet function is called through the interrupt service function, wherein the tasklet function is put into the tasklet task queue and is scheduled and executed in sequence by the second central processing unit.

7. The method according to claim 5, characterized in that Taking out second data from the data forwarding queue, and performing second-stage data processing on the second data in the second central processor, including: Taking out all the data packets in the data forwarding queue from the head of the data forwarding queue in sequence to obtain the second data; calling a pre-packaged callback function through the second central processing unit; The second data is processed in the second stage through the callback function.

8. The method according to any one of claims 1 to 7, characterized in that The data to be processed includes sending direction data obtained from the wired side interface and receiving direction data obtained from the wireless side interface; The data forwarding queue includes a sending direction queue and a receiving direction queue; Each of the data forwarding queues corresponds to an in-queue interface and an out-queue interface respectively; The data forwarding queue is a locked queue, and each of the data forwarding queues can only call the queue entry interface or the queue exit interface at the same time.

9. The method according to claim 8, characterized in that The first central processing unit performs the first stage of data processing on the data to be processed, including: In the case where the data to be processed is transmission direction data, the transmission direction data is transferred from the wired side interface to the WiFi driver through the internal direct storage access IDM driver, wherein the wired side interface includes a passive optical network PON interface, a wide area network WAN interface or a local area network LAN interface; or, In the case where the data to be processed is receiving direction data, the receiving direction data is processed by closed source software in the WiFi driver.

10. The method according to claim 9, characterized in that The second central processor performs a second stage of data processing on the second data, including: In the case where the data to be processed is data in the sending direction, the second data in the sending direction is processed by the open source software in the WiFi driver to obtain third data; or In the case where the data to be processed is receiving direction data, the second data in the receiving direction is processed by the open source software in the WiFi driver to obtain third data.

11. The method according to claim 10, characterized in that After the second data in the sending direction is processed by the open source software in the WiFi driver to obtain the third data, the method further includes: triggering a second interrupt by the first central processing unit; Performing third-stage data processing on the third data by the first central processor to obtain fourth data, wherein the third-stage data processing on the third data includes: performing data processing on the third data by closed-source software in the WiFi driver; The fourth data is sent through the wireless side interface.

12. The method according to claim 10, characterized in that After the second data in the receiving direction is processed by the open source software in the WiFi driver to obtain the third data, the method further includes: The third data is transferred from the WiFi driver to the wired side interface through the IDM driver; The third data is sent through the wired side interface.

13. The method according to claim 9, characterized in that Before the first central processor performs the first stage of data processing on the data to be processed, the method further includes: During the initialization phase of the WiFi chip, a memory pool is applied for the IDM driver and the WiFi driver in advance, wherein the memory pool stores data packets of the IDM driver or the WiFi driver in a memory space in a stack manner.

14. The method according to claim 13, characterized in that The method further comprises: When the IDM driver or the WiFi driver receives the data packet, a memory space corresponding to the data packet is popped out from the top of the memory pool, wherein the memory space is used to store the data packet; When the IDM driver or the WiFi driver releases the data packet, a memory space corresponding to the data packet is pushed into the memory pool from the top.

15. The method according to any one of claims 1 to 7, characterized in that Before the first central processor performs the first stage of data processing on the data to be processed, the method further includes: During the initialization phase of the WiFi chip, the first interrupt and the second interrupt are bound to the first central processor; The data forwarding interrupt is bound to the second central processing unit.

16. A data processing device for a WiFi chip, characterized in that: The device comprises: A first processing module, configured to perform a first stage of data processing on the data to be processed through a first central processing unit to obtain first data; a cache module, configured to cache the first data into a data forwarding queue when the first central processing unit triggers a first interrupt; The second processing module is used to take out second data from the data forwarding queue when the second central processor triggers a data forwarding interrupt, and perform second-stage data processing on the second data through the second central processor, wherein the second data is part or all of the first data.

17. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program executes the method described in any one of claims 1 to 15 when executed by a processor.

18. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 15.