Data processing method and apparatus for WIFI chip

By using the data forwarding queue in the WiFi chip to divide the data processing process into different cores for execution, the problem of CPU resource waste caused by multi-core resource allocation in the WiFi chip is solved, and more efficient resource utilization and performance improvement are achieved.

WO2024174603A1PCT designated stage expired Publication Date: 2024-08-29SANECHIPS TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/131623
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-24
Filing Date
2023-11-14
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

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

Method used

The first central processor performs first-stage data processing on the data to be processed, and caches the data into the data forwarding queue when an interrupt is triggered. The second central processor takes out the data from the queue when the data forwarding interrupt is triggered and performs the second stage. Processing to achieve segmentation of data processes and balanced CPU resource usage.

Benefits of technology

It effectively solves the problem of CPU resource waste caused by the multi-core resource allocation method of WiFi chips, simplifies the difficulty for users to achieve multi-core optimization, and improves the performance and resource utilization of WiFi chips.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023131623_29082024_PF_FP_ABST
    Figure CN2023131623_29082024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a data processing method and apparatus for a WiFi chip. The method comprises: acquiring from a wired-side interface first data to be processed in a sending direction; carrying out first-stage data processing on said first data by means of a first central processing unit, thereby obtaining first data; when the first central processing unit triggers a first interruption, caching the first data to a data forwarding queue in the sending direction; and when a second central processing unit triggers a data forwarding interruption in the sending direction, extracting second data from the data forwarding queue, and carrying out second-stage data processing on the second data by means of the second central processing unit.
Need to check novelty before this filing date? Find Prior Art

Description

A data processing method and device for WiFi chip

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] The present disclosure is based on Chinese patent application CN202310215912X filed on February 24, 2023, entitled “A data processing method and device for a WiFi chip”, and claims the priority of the patent application, and all the disclosed contents are incorporated into the present disclosure by reference. Technical Field

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

[0004] With the rapid development of consumer electronics and smart products, WiFi, the current mainstream wireless transmission technology, is facing increasing performance requirements. However, the performance bottleneck of WiFi depends not only on the throughput of the WiFi chip itself, but also requires a sufficiently powerful CPU to fully utilize its performance. Currently, multi-core processors are the mainstream method for improving CPU performance. Taking advantage of the multi-core nature of CPUs is the key to fully realizing the performance of WiFi chips.

[0005] Currently, there are two main techniques for balancing CPU multi-core resources. The first is core binding, which involves binding the interrupts of the WiFi driver and the internal direct memory access (IDM) driver to different cores. This allows the data processing flows of the two drivers to be triggered by their own interrupts and run on different cores. Experimental verification shows that when processing the same amount of data, the WiFi driver requires more CPU resources than the IDM driver. When the data volume is large, the core where the WiFi driver resides is often fully loaded, while the core where the IDM driver resides remains idle, resulting in reduced WiFi performance and wasted CPU resources. The second is the tasklet approach, a core-splitting method provided by the Linux kernel. While this method can split a single driver process, users need to write different tasklet initialization and processing functions for different WiFi chips, resulting in a high implementation cost. More importantly, directly using the tasklet approach for core-splitting results in inter-core communication losses, and excessive scheduling can increase CPU burden and affect performance.

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

[0007] Summary of the Invention

[0008] The embodiments of the present disclosure 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.

[0009] According to one embodiment of the present disclosure, a data processing method for a WiFi chip is provided. The method includes: performing a first-stage data processing on data to be processed by a first central processing unit to obtain first data; caching the first data in a data forwarding queue when the first central processing unit triggers a first interrupt; and retrieving second data from the data forwarding queue and performing a second-stage data processing on the second data by the second central processing unit when a second central processing unit triggers a data forwarding interrupt. The second data is part or all of the first data.

[0010] According to another embodiment of the present disclosure, a data processing device for a WiFi chip is provided. The device includes: a first processing module configured 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 configured to cache the first data in a data forwarding queue when the first central processing unit triggers a first interrupt; and a second processing module configured to retrieve second data from the data forwarding queue and perform a second stage of data processing on the second data by the second central processing unit when the second central processing unit triggers a data forwarding interrupt. The second data is part or all of the first data.

[0011] According to another embodiment of the present disclosure, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above method embodiments are executed.

[0012] According to another embodiment of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] FIG1 is a hardware structure block diagram of a data processing method of a WiFi chip according to an embodiment of the present disclosure;

[0014] FIG2 is a flow chart of a data processing method of a WiFi chip according to an embodiment of the present disclosure;

[0015] FIG3 is a schematic diagram of the original data flow of the WiFi chip;

[0016] FIG4 is a schematic diagram of a data flow of a WiFi chip having a WFWD module according to an embodiment of the present disclosure;

[0017] FIG5 is a schematic diagram of a WiFi chip data flow according to an embodiment of the present disclosure;

[0018] FIG6 is a schematic diagram of a process of receiving direction data of a WiFi chip according to an embodiment of the present disclosure;

[0019] FIG7 is a flowchart of initializing a WFWD module according to an embodiment of the present disclosure;

[0020] FIG8 is a flow chart of data processing within the WFWD module in the sending direction according to an embodiment of the present disclosure;

[0021] FIG9 is a flow chart of data processing within the WFWD module in the receiving direction according to an embodiment of the present disclosure;

[0022] FIG10 is a block diagram of a data processing device of a WiFi chip according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings and in conjunction with embodiments.

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

[0025] The method embodiments provided in the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, FIG1 is a hardware structure block diagram of the data processing method of the WiFi chip of the embodiment of the present disclosure. As shown in FIG1 , the hardware board may include one or more (only one is shown in FIG1 ) processors 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 above-mentioned mobile terminal may also include a transmission device 16 and an input and output device 18 for communication functions. It can be understood by those skilled in the art that the structure shown in FIG1 is only for illustration and does not limit the structure of the above-mentioned mobile terminal. For example, the mobile terminal may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .

[0026] 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 disclosure. 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, implementing the above-mentioned 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 examples, the memory 14 may further include a memory remotely located 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.

[0027] The transmission device 16 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by a communications provider. In one embodiment, the transmission device 16 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 16 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0028] In one embodiment of the present disclosure, a data processing method for a WiFi chip is provided. FIG2 is a flow chart of the data processing method for a WiFi chip according to an embodiment of the present disclosure. As shown in FIG2 , the flow chart includes the following steps:

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

[0030] Step S204, when the first central processing unit triggers the first interrupt, cache the first data into the data forwarding queue;

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

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

[0033] In an exemplary embodiment, after step S202, the method further includes: triggering the first interrupt by the first central processing unit 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 processing unit when the cumulative time for obtaining the first data is equal to a second preset threshold.

[0034] Furthermore, by setting the first preset threshold and the second preset threshold, it is possible to prevent the amount of data processed in a single 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.

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

[0036] Step S2042: calling the queue entry interface of the data forwarding queue;

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

[0038] In this embodiment, step S2044 may specifically include performing the following operations on each data packet in the first data in sequence: 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.

[0039] Specifically, during 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.

[0040] In an exemplary embodiment, after step S2044, the method further includes: calling a dequeue interface of the data forwarding queue by the second central processing unit; and triggering a data forwarding interrupt by the second central processing unit when there is a data packet in the data forwarding queue.

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

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

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

[0044] Step S2062: Take out all data packets in the data forwarding queue from the head of the data forwarding queue in sequence to obtain second data;

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

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

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

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

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

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

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

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

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

[0054] Furthermore, after processing the second data in the sending direction through the open source software in the WiFi driver to obtain third data, the method also includes: triggering a second interrupt through the first central processing unit; and performing third-stage data processing on the third data through the first central processing unit to obtain fourth data.

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

[0056] 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, the second data in the receiving direction is processed by the open source software in the WiFi driver to obtain third data.

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

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

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

[0060] Furthermore, the method also includes: when the IDM driver or WiFi driver receives a data packet, popping out 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.

[0061] In another exemplary embodiment, before step S202 , the method further includes: during 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.

[0062] Furthermore, the disclosed embodiments are not limited to dual-core CPUs and the aforementioned interrupts. The disclosed embodiments can also be applied to other multi-core CPUs, where the complete data processing flow can be divided into arbitrary stages by triggering interrupts, and data packets can be processed separately in multiple cores through data forwarding interrupts.

[0063] In the embodiment of the present disclosure, 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 art can be solved. By triggering an interrupt to interrupt the data processing flow of the WiFi chip, multiple processing cores are enabled to execute a section of the data processing flow respectively, thereby balancing CPU resources and simplifying the difficulty for users to achieve multi-core optimization.

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

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

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

[0067] 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 is then 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).

[0068] Furthermore, the same is true when the data flow is reversed (receiving direction).

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

[0070] Figure 4 is a schematic diagram of the data flow of the WiFi chip with the WFWD module according to an embodiment of the present disclosure. As shown in Figure 4, the data flow of the WFWD module needs to go through the following structure:

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

[0072] 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 achieves uniform core distribution by cutting off the original data flow.

[0073] In this embodiment, the WFWD module only needs to open two interfaces to any vendor's WiFi data stream driver: an in-queue interface and an out-queue interface for triggering interrupts. Users simply call the WFWD module's in-queue interface at the appropriate point, interrupting the original WiFi driver data flow and filling the WFWD module's queue with all valid data. Then, triggering a WFWD module interrupt on another core, calling the out-queue interface, and then retrieving the valid data on the other core to process the second half of the data processing flow.

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

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

[0076] Figure 5 is a schematic diagram of the data flow in the WiFi chip transmission direction according to an embodiment of the present disclosure. As shown in Figure 5, in the WiFi data transmission direction, the data flow needs to go through the following structure:

[0077] 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 , and WiFi sending firmware side driver 57 .

[0078] 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, the PON / WAN / LAN is the starting point for the wireless terminal device to send packets.

[0079] In this embodiment, the internal direct memory 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.

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

[0081] 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 for packets released by the WiFi / IDM driver. When allocating memory, a memory space is popped from the top, and when reclaiming memory, a memory space is also pushed from the top.

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

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

[0084] Furthermore, the WFWD module also pre-applies for two interrupts, one for sending and one for receiving. In the Tx process, the one 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.

[0085] In this embodiment, the queue of the WFWD module in the sending direction is the sending direction queue wfwd_tx_queue. 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 (tail) and when a packet is sent, it is removed from the head of the queue (head).

[0086] In this embodiment, the WiFi driver sends the first half 55 and the WiFi driver sends the second half 56 both belong to the WiFi Tx (transmit) 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.

[0087] In this embodiment, the WiFi sending firmware 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.

[0088] Figure 6 is a schematic diagram of the data flow in the receiving direction of the WiFi chip according to an embodiment of the present disclosure. As shown in Figure 6, in the WiFi data receiving direction, the data flow needs to go through the following structure:

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

[0090] In this embodiment, the WiFi receiving firmware 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.

[0091] In this embodiment, the WiFi receiving driver 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.

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

[0093] 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 for packets released by the WiFi / IDM driver. When allocating memory, a section of memory space is popped out from the top, and when reclaiming memory, a section of memory space is also pushed in from the top.

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

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

[0096] Furthermore, the WFWD module also pre-applies for two interrupts, one for sending and one for receiving. In the Rx process, the one 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.

[0097] In this embodiment, the queue of the WFWD module in the sending direction is the sending direction queue wfwd_tx_queue. 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.

[0098] In this embodiment, the internal direct memory 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.

[0099] 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, the PON / WAN / LAN is the end point for the wireless terminal device to receive packets.

[0100] Through the disclosed embodiments, simply by embedding the WFWD module's queue entry and exit interfaces into the WiFi driver's existing data transmission process, the WiFi driver's data flow can be split and processed across different cores, balancing the CPU load. This method also allows the multi-core optimization method implemented by the WFWD module to be quickly adapted to other WiFi chip models, simplifying multi-core optimization implementation and providing high versatility.

[0101] FIG7 is a flowchart of initializing the WFWD module according to an embodiment of the present disclosure. As shown in FIG7 , the initialization process of the WFWD module includes the following steps:

[0102] Step S701, loading the WFWD module;

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

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

[0105] Step S704, initializing the tasklet function for dequeuing in the sending / receiving direction;

[0106] Step S705: Initialize the WFWD module data statistics file system;

[0107] Step S706: Hook the sending / receiving function of the WiFi chip to the hook of the WFWD module.

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

[0109] In this embodiment, after loading, the WFWD module will first apply to the Linux system for the interrupt resources for the transmit (Transport, abbreviated as Tx) and receive (Receive, abbreviated as rx). If the application is successful, the two interrupts applied for will be bound to CPU1.

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

[0111] In this embodiment, step S703 initializes the WFWD module's transmit queue (wfwd tx queue) and receive queue (wfwd rx queue) and locks protecting the two queues. The locks are used to prevent two processes from entering or exiting the queue at the same time, which could cause data corruption.

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

[0113] Furthermore, the tasklet handler function is not dispatched from CPU0 to CPU1. Instead, it follows the interrupt, running on the core where the interrupt is triggered. Because wfwd_t and wfwd_r are initialized on CPU1, inter-core communication losses are avoided.

[0114] 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 sent and received packets when the module is running.

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

[0116] Specifically, the callback function is the function that the WiFi driver will 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.

[0117] In this embodiment, 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.

[0118] FIG8 is a flow chart of data processing within the WFWD module in the sending direction according to an embodiment of the present disclosure. As shown in FIG8 , the data processing flow within the WFWD module in the sending direction may specifically include the following steps:

[0119] Step S801, triggering IDM interruption;

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

[0121] Step S803, determine whether the data in the IDM has been sent;

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

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

[0124] Step S806, discard the data;

[0125] Step S807: insert the data into the tail of the wfwd tx que queue;

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

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

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

[0129] Step S811, calling the interrupt service function attached to the interrupt;

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

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

[0132] Step S814: Take the data out from the head of the wfwd tx que queue in sequence;

[0133] Step S815, calling the WiFi driver Tx callback function;

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

[0135] Step S817, triggering tx WiFi interruption;

[0136] Step S818: WiFi drives the second half of TX.

[0137] In this embodiment, the process within the dotted box in FIG8 is executed by CPU1, and the other processes are executed by CPU0.

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

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

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

[0141] In this embodiment, step S805 determines whether the wfwd tx que exceeds a threshold (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).

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

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

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

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

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

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

[0148] 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 this 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.

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

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

[0151] FIG9 is a flowchart of data processing within the WFWD module in the receiving direction according to an embodiment of the present disclosure. As shown in FIG9 , the data processing flow within the WFWD module in the receiving direction may specifically include the following steps:

[0152] Step S901, triggering rx wifi interrupt;

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

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

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

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

[0157] Step S906, discard the data;

[0158] Step S907: insert the data into the tail of the wfwd rx que queue;

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

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

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

[0162] Step S911, calling the interrupt service function attached to the interrupt;

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

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

[0165] Step S914: Take the data out from the head of the wfwd rx que queue in sequence;

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

[0167] Step S916, WiFi drives RX;

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

[0169] 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 WiFi driver's tasklet function, sending 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.

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

[0171] In this embodiment, step S905 determines whether the wfwd rx que exceeds a threshold (e.g., 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).

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

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

[0174] 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, core division is completed at this time.

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

[0176] In this embodiment, step S914 loops through the 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.

[0177] Specifically, the first half of the WIFI driver Rx in the embodiment of the present disclosure mainly processes the interrupt response in 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 WIFI driver Rx direction process.

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

[0179] According to another aspect of the embodiments of the present disclosure, a data processing device for a WiFi chip is further provided.

[0180] FIG10 is a block diagram of a data processing device of a WiFi chip according to an embodiment of the present disclosure. As shown in FIG5 , the device includes:

[0181] The first processing module 102 is 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;

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

[0183] The second processing module 106 is configured 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.

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

[0185] The first trigger module is configured to trigger the first interrupt through the first central processing unit 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 processing unit when the cumulative time for obtaining the first data is equal to a second preset threshold.

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

[0187] A first calling unit is configured to call an in-queue interface of the data forwarding queue;

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

[0189] In this embodiment, the cache unit is also configured to perform the following operations in sequence for each data packet in the first data: receive the data packet through the queue entry interface; determine 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, insert the data packet at the tail of the data forwarding queue.

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

[0191] The second trigger module is configured to call the dequeue interface of the data forwarding queue through the second central processing unit; when there is a data packet in the data forwarding queue, trigger the data forwarding interrupt through the second central processing unit.

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

[0193] A calling module is configured 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 scheduled and executed in sequence by the second central processing unit.

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

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

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

[0197] The processing unit is configured to perform a second-stage data processing on the second data through the callback function.

[0198] In this embodiment, the first processing module 102 is configured 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 an 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 closed-source software in the WiFi driver.

[0199] In this embodiment, the second processing module 106 is further configured 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.

[0200] In an exemplary embodiment, the apparatus may further include a third processing module.

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

[0202] In another exemplary embodiment, the third processing module is further configured to process the second data in the receiving direction through the open source software in the WiFi driver to obtain the third data, and then 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.

[0203] In one embodiment, the apparatus further comprises a memory module.

[0204] The memory module is configured 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.

[0205] The memory module is further configured to pop out a 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 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.

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

[0207] An embodiment of the present disclosure further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above method embodiments are executed.

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

[0209] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

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

[0211] 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 here.

[0212] Obviously, those skilled in the art should understand that the modules or steps of the present disclosure described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, 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 performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present disclosure is not limited to any particular combination of hardware and software.

[0213] The foregoing is merely an exemplary embodiment of the present disclosure and is not intended to limit the present disclosure. Those skilled in the art will readily appreciate that the present disclosure is susceptible to various modifications and variations. Any modifications, equivalent substitutions, improvements, and the like made within the principles of the present disclosure shall be included within the scope of protection of the present disclosure.

Claims

1. A data processing method for a WiFi chip, the method comprising: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: Taking out the second data from the data forwarding queue, and performing a second stage of 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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 space from the top of the memory pool.

15. The method according to any one of claims 1 to 7, wherein: 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, the device comprising: A first processing module is 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 processor triggers a first interrupt; The second processing module is configured 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.

17. A computer-readable storage medium, wherein: 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, wherein: 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.

Citation Information

Patent Citations

  • Method for improving the efficiency of network packet processing

    CN109117270A

  • Method and device for transmitting and receiving network interrupt data packet, electronic equipment and storage medium

    CN113037649A

  • Method for improving WiFi performance through CPU dynamic allocation, WiFi communication equipment and storage medium

    CN113835888A

  • Wi-Fi chip, Wi-Fi equipment and queue scheduling method

    CN114430591A

  • Method for distributing load in a multi-core system

    US20190108068A1