Ethernet media access control driving method, device, equipment and medium

By extracting configuration information in the user space and generating a private structure for Ethernet MAC driver debugging, the cumbersome and invisibility problems in the existing technology are solved, and a more efficient and flexible debugging process is achieved.

CN119248649APending Publication Date: 2025-01-03SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411354496.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The debugging process of existing Ethernet MAC drivers is complicated and complicated, and the loading process of PHY drivers is not visible in the user space, resulting in increased debugging difficulty and limited flexibility.

Method used

Extract the configuration information of the bus and physical layer integrated circuits in the user space, generate a private structure, perform MAC operation function debugging, and complete the binding between the bus and the physical layer. Load and unload tests through debug operation instructions, and finally re-examine the results. Add to the original driver loading process for verification.

Benefits of technology

Simplify the debugging process, improve debugging efficiency and flexibility, ensure the correctness and stability of debugging results, and avoid system errors caused by untimely update of configuration information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248649A_ABST
    Figure CN119248649A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses an Ethernet media access control driving method and device, equipment and a medium, and the method comprises the steps: in a user space, extracting first configuration information, second configuration information and attribute information from log information pre-mapped into the user space; according to the three pieces of information, a private structure body driven by the MAC is generated; debugging the MAC operation function according to the private structure body to generate a first debugging process; binding the bus and the physical layer integrated circuit according to the first configuration information and the second configuration information; according to the debugging operation instruction, completing a second debugging process corresponding to the loading test and the unloading test of the MAC driver; and after the first debugging process and the second debugging process are determined to be executed, adding the binding of the MAC operation function, the bus and the physical layer integrated circuit and the private structure body to the original Ethernet driver loading process again, and performing final debugging verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an Ethernet media access control driving method, device, equipment and medium. Background Art

[0002] The Linux kernel driver runs in kernel mode. If you want to debug the Ethernet Media Access Control (MAC) driver, you also need to modify and test the Linux kernel code continuously. Existing Ethernet MAC drivers often include the Management Data Input / Output (MDIO) bus registration and the physical layer (PHY) driver loading process. Each debugging requires modifying and compiling the kernel code and developing related hardware circuit boards. The process is cumbersome and complicated, and the PHY driver loading process is often invisible in user space, which adds many blind spots to debugging and limits the flexibility of Ethernet MAC driver modification and debugging. Summary of the invention

[0003] In view of this, the present invention provides an Ethernet media access control driver method, device, equipment and medium to solve the problem in the related art that when debugging the Ethernet MAC driver, the debugging process is cumbersome and complicated, there are blind spots in the debugging process, and the flexibility of Ethernet MAC driver modification and debugging is limited.

[0004] In a first aspect, the present invention provides an Ethernet media access control driving method, the method comprising:

[0005] In the user space, extracting first configuration information corresponding to the bus, second configuration information corresponding to the physical layer integrated circuit chip, and attribute information included in the hardware information from log information pre-mapped into the user space, wherein the log information is generated after registering the bus for managing the physical layer integrated circuit in the driver and completing the driver loading of the physical layer integrated circuit, and respectively generating log information corresponding to the registration process and the driver loading process;

[0006] Generate a private structure of the MAC driver according to the first configuration information and the second configuration information, and the attribute information included in the hardware information;

[0007] According to the private structure, the MAC operation function is debugged to generate a first debugging process;

[0008] According to the first configuration information and the second configuration information, the bus and the physical layer integrated circuit are bound;

[0009] According to the debugging operation instruction, complete the second debugging process corresponding to the loading test and the unloading test of the MAC driver;

[0010] When it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process for final debugging verification.

[0011] The Ethernet media access control driving method provided by the present invention has the following advantages:

[0012] By extracting the configuration information corresponding to the bus and physical layer integrated circuit chip and the attribute information in the hardware information from the log information pre-mapped into the user space, a private structure of the MAC driver is generated, and the MAC operation function is debugged according to the structure to generate the first debugging process. Then, the binding of the bus and the physical layer integrated circuit is completed according to the configuration information, and the second debugging process corresponding to the loading test and unloading test of the MAC driver is completed according to the debugging operation instruction. Finally, when it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process for the final debugging verification. The attribute information included in the first configuration information, the second configuration information, and the hardware information is mapped to the user space in the form of log information, and the debugging results in the MDIO bus registration and PHY driver loading process can be determined in the user space by reading the log file to ensure the correctness of the debugging results. In addition, in the method of the present application, the entire driver debugging process is split, and a part of the content, such as the debugging process of the MAC operation function, the binding process of MAC and PHY, and the debugging process of the MAC driver loading test and unloading test, is placed in the user space, and the entire Ethernet MAC driver is split to decouple the debugging of different parts. Increase the control of the entire debugging process. When debugging this part of the content separately, it is only necessary to operate in the user space, which simplifies the debugging process. Then, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process to ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, simplifying the complexity of debugging.

[0013] In an optional implementation, the MAC operation function is debugged according to the private structure to generate a first debugging process, which specifically includes:

[0014] Extract the actual address information of the hardware registers and the configuration information of the physical layer integrated circuit from the private structure;

[0015] Converting actual address information into virtual address information;

[0016] Generate debugging operation running logic according to the virtual address and the configuration information of the physical layer integrated circuit;

[0017] Debugging the MAC operation function according to the debugging operation running logic to generate a first debugging process;

[0018] Alternatively, when debugging the MAC operation function according to the virtual address and the configuration information of the physical layer integrated circuit, and generating a configuration information update request received during the first debugging process, the method further includes:

[0019] According to the update request, new configuration information is obtained, and the new configuration information is updated into the physical layer integrated circuit;

[0020] Triggering an interrupt operation, where the interrupt operation is used to stop the first debugging process and instruct to obtain new configuration information at the MAC layer;

[0021] Update the debugging operation running logic according to the new configuration information;

[0022] According to the updated debugging operation running logic, the debugging operation on the MAC operation function is completed.

[0023] Specifically, the method extracts the actual address information of the hardware register and the configuration information of the physical layer integrated circuit from the private structure, converts the actual address into a virtual address, then generates the debugging operation running logic according to the virtual address and the configuration information, and finally debugs the MAC operation function according to the logic, thereby avoiding the tedious process of manually searching and setting the hardware register address and configuration information, and improving the debugging efficiency. At the same time, when a configuration information update request is received, the current debugging process is stopped by triggering an interrupt operation, and it is instructed to obtain new configuration information at the MAC layer, and then the debugging operation running logic is updated according to the new configuration information, and finally the debugging operation of the MAC operation function is completed, so that the system can dynamically update the configuration information without recompiling and restarting, thereby enhancing the flexibility and scalability of the system. In addition, by generating the debugging operation running logic according to the virtual address and the configuration information of the physical layer integrated circuit, and debugging the MAC operation function according to the logic, the correctness and stability of the debugging operation can be ensured. At the same time, when a configuration information update request is received, the current debugging process is stopped by triggering an interrupt operation, and the MAC layer is instructed to obtain new configuration information. Then, the debugging operation running logic is updated according to the new configuration information, and finally the debugging operation of the MAC operation function is completed. This can avoid system errors and instability caused by untimely configuration information updates, thereby further improving the stability and reliability of the system.

[0024] In an optional implementation, in the user space, before extracting the first configuration information corresponding to the bus, the second configuration information corresponding to the physical layer integrated circuit, and the attribute information included in the hardware information from the log information pre-mapped into the user space, the method further includes:

[0025] In the driver, obtain the hardware information of the Ethernet MAC controller;

[0026] Complete the configuration and operation of the MAC controller according to the hardware information;

[0027] After completing the configuration and operation of the MAC controller, register the bus used to manage the physical layer integrated circuit according to the registration operation instruction, and complete the driver loading of the physical layer integrated circuit, generate log information corresponding to the registration process and the driver loading process, and map the log information to the preset user space.

[0028] Specifically, by obtaining the hardware information of the MAC controller in the driver and completing the configuration and operation according to the information, the driver can be better adapted to different hardware environments. At the same time, the log information is mapped into the user space, so that the driver can run on different operating systems and hardware platforms without a lot of modifications. In this process, by obtaining the hardware information and performing corresponding configuration and operation, the driver can be better adapted to different hardware environments, thereby improving the portability of the driver. At the same time, the log information is mapped into the user space, so that the driver can run on different operating systems and hardware platforms without a lot of modifications. This is because the user space is an independent operating environment provided by the operating system. Different operating systems and hardware platforms may have different kernel space implementations, but the interface of the user space is usually relatively stable. Therefore, mapping the log information into the user space can enable the driver to access and use the same log information when running on different operating systems and hardware platforms, thereby improving the portability of the driver. By mapping the log information into the user space, the driver developer can more conveniently view and analyze the operation of the driver. This helps developers locate and solve problems more quickly, thereby improving the maintainability of the driver. By registering the bus and completing the driver loading of the physical layer integrated circuit, it can ensure that the driver can communicate with the hardware correctly. At the same time, generating and mapping log information can help developers find and solve problems in the driver in a timely manner, thereby improving the reliability of the driver.

[0029] In an optional implementation, the actual address information of the hardware register includes actual address information corresponding to the hardware register to be accessed by the MAC controller and actual address information corresponding to the hardware register to be accessed by the physical layer integrated circuit.

[0030] In an optional implementation, the MAC operation function is debugged according to the private structure to generate a first debugging process, and when a preset debugging operation instruction is identified, the method further includes:

[0031] Jump out of the user space, enter the kernel space to execute the operation corresponding to the preset debugging operation instruction, and after executing the operation corresponding to the preset debugging operation instruction, enter the user space again to complete other debugging operations on the MAC operation function, wherein the preset debugging operation instruction is used to instruct the execution of the preset debugging operation, and the preset debugging operation cannot be completed in the user space, wherein the preset debugging operation instruction includes: a command for dynamically loading a module in the kernel and a command for unloading a module.

[0032] Specifically, when a preset debugging operation instruction is identified, it is determined that the preset debugging operation cannot be completed in the user space, so it is necessary to jump out of the user space and enter the kernel space for execution. And, after completion in the kernel space, enter the user space again to complete other debugging operations on the MAC operation function. Among them, the preset debugging operation instruction includes, for example, commands for dynamically loading modules and commands for unloading modules in the kernel. These commands can, for example, execute the process of registering a network device in the kernel and load it into the kernel, and complete the corresponding operation in the device driver. This process does not require compiling the system kernel, nor does it require transplanting the system kernel on the hardware circuit board to view the debugging results, reducing the operation steps and saving resources.

[0033] In an optional implementation, the first configuration information and the second configuration information are both embodied in the form of a first preset structure, wherein the form of the first preset structure is the same as the form of the original structure in the Ethernet MAC driver;

[0034] The MAC operation function is embodied in the user space in the form of a second preset structure, wherein the second preset structure has the same format as the structure of the MAC operation function in the kernel space.

[0035] Specifically, the configuration information is kept consistent with the original structure form in the Ethernet MAC driver to ensure that after the entire driver debugging is completed, it can be restored to the standard form of the kernel driver without modification as much as possible, and successfully completed loading and presentation during the system kernel startup process, so as to facilitate the use of debugging the MAC operation function in the user space; in addition, redefining the operation function structure of the Ethernet MAC driver in the user space can ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, which simplifies the complexity of debugging and does not add extra workload to the original Linux driver process.

[0036] In an optional implementation, the MAC operation function needs to include at least the following network device operation functions: ndo_open, ndo_start_xmit, ndo_stop, or ndo_set_MAC_address.

[0037] Specifically, the above network device operation function can ensure that the MAC driver operation function can achieve its basic function.

[0038] In a second aspect, the present invention provides an Ethernet media access control driving device, the device comprising:

[0039] An extraction module is used to extract, in the user space, first configuration information corresponding to the bus, second configuration information corresponding to the physical layer integrated circuit chip, and attribute information included in the hardware information from log information pre-mapped into the user space, wherein the log information is a bus registered in a driver program for managing the physical layer integrated circuit, and after the driver loading of the physical layer integrated circuit is completed, log information corresponding to the registration process and the driver loading process is generated respectively;

[0040] A generating module, configured to generate a private structure of a MAC driver according to the first configuration information and the second configuration information, and the attribute information included in the hardware information;

[0041] A first debugging module, used for debugging the MAC operation function according to the private structure to generate a first debugging process;

[0042] A binding module, used to complete the binding of the bus and the physical layer integrated circuit according to the first configuration information and the second configuration information;

[0043] A second debugging module, used to complete a second debugging process corresponding to a loading test and an unloading test of a MAC driver according to a debugging operation instruction;

[0044] The processing module is used to add the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure to the original Ethernet driver loading process for final debugging verification after determining that the first debugging process and the second debugging process are completed.

[0045] The Ethernet media access control driving device provided by the present invention has the following advantages:

[0046] By extracting the configuration information corresponding to the bus and physical layer integrated circuit chip and the attribute information in the hardware information from the log information pre-mapped into the user space, a private structure of the MAC driver is generated, and the MAC operation function is debugged according to the structure to generate the first debugging process. Then, the binding of the bus and the physical layer integrated circuit is completed according to the configuration information, and the second debugging process corresponding to the loading test and unloading test of the MAC driver is completed according to the debugging operation instruction. Finally, when it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process for the final debugging verification. The attribute information included in the first configuration information, the second configuration information, and the hardware information is mapped to the user space in the form of log information, and the debugging results in the MDIO bus registration and PHY driver loading process can be determined in the user space by reading the log file to ensure the correctness of the debugging results. In addition, in the method of the present application, the entire driver debugging process is split, and a part of the content, such as the debugging process of the MAC operation function, the binding process of MAC and PHY, and the debugging process of the MAC driver loading test and unloading test, is placed in the user space, and the entire Ethernet MAC driver is split to decouple the debugging of different parts. Increase the control of the entire debugging process. When debugging this part of the content separately, it is only necessary to operate in the user space, which simplifies the debugging process. Then, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process to ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, simplifying the complexity of debugging.

[0047] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the Ethernet media access control driving method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0048] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the Ethernet media access control driving method of the first aspect or any corresponding embodiment thereof.

[0049] In a fifth aspect, the present invention provides a computer program product, including computer instructions, wherein the computer instructions are used to enable a computer to execute the Ethernet media access control driving method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 It is a schematic diagram of the Ethernet MAC driver debugging process in the related art;

[0052] Figure 2 It is a flow chart of an Ethernet media access control driving method provided by an embodiment of the present invention;

[0053] Figure 3 It is a structural schematic diagram of part of the contents of debugging Ethernet MAC driver in kernel state provided by the present invention;

[0054] Figure 4 It is a structural schematic diagram of part of the contents of the Ethernet MAC driver debugged in user mode provided by the present invention;

[0055] Figure 5 It is a flow chart of another Ethernet media access control driving method provided by an embodiment of the present invention;

[0056] Figure 6 It is a structural block diagram of an Ethernet media access control driving device provided by an embodiment of the present invention;

[0057] Figure 7 It is a schematic diagram of the hardware structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0059] From the perspective of hardware design, Ethernet hardware circuits generally include MAC controllers and PHY.

[0060] Physical layer PHY: The electrical and optical signals, line status, clock reference, data editing and circuits required for data transmission and reception, and provides a standard interface to data link layer devices.

[0061] The data link layer MAC consists of a hardware controller and a MAC communication protocol. The MAC communication protocol is located in the lower half of the data link layer in the OSI seven-layer protocol and is mainly responsible for controlling and connecting the physical medium of the physical layer.

[0062] In today's embedded products, the typical application of Ethernet cards is to integrate a MAC in the SoC and add an Ethernet PHY chip in the peripheral expansion circuit, which together with the RJ45 and network cable form a complete Ethernet communication interface.

[0063] The network card PHY in the Linux system is uniformly managed through the MDIO (Management Data Input Output) bus, and the PHY is connected to the MDIO BUS through the MDIO interface. The MDIO bus object can be created by the network card driver or created and registered separately.

[0064] For the network hardware solution of SOC internal integrated MAC plus external PHY chip, the Ethernet MAC driver generally needs to include the following processes:

[0065] Get device tree hardware resources, MDIO bus registration, PHY driver loading, connect MAC controller and PHY chip. Currently, the whole process is completed during the MAC driver loading process started by Linux.

[0066] The Linux kernel driver runs in kernel mode. To debug the Ethernet MAC driver, the Linux kernel code needs to be modified and tested continuously. Existing Ethernet MAC drivers often include MDIO bus registration and PHY driver loading processes. Each debugging requires modification and compilation of the kernel code and related hardware circuit board development. The process is cumbersome and complicated, and the PHY driver loading process is often invisible in user space, which adds many blind spots to debugging and limits the flexibility of Ethernet MAC driver modification and debugging.

[0067] Ethernet MAC driver process:

[0068] 1. Write the device tree related to Ethernet MAC driver;

[0069] 2. Write the platform_driver structure to obtain relevant device tree information;

[0070] 3. Fill in the net_device_ops structure and write the MAC operation function;

[0071] 4. Register the MDIO bus and create a PHY device to match the PHY driver;

[0072] 5. Bind MAC and PHY.

[0073] All the above processes are carried out in the Linux kernel state. To debug the Ethernet MAC driver, it is necessary to modify it at the corresponding stage. After recompiling the Linux kernel, the Linux kernel system is transplanted on the hardware circuit board to test the modified results.

[0074] See Figure 1 As shown, Figure 1 The figure shows the schematic diagram of Ethernet MAC driver debugging process in the related technology, including writing device tree, writing MAC operation function, loading PHY driver, binding MAC and PHY, and checking debugging results. The debugging of the entire driver must be performed in kernel state (kernel space). Each debugging requires repeating the entire process of kernel compilation, hardware circuit board startup, etc., and checking the debugging results in user state (user space). This solution has the following defects:

[0075] 1. The debugging process is complicated. Each debugging requires modification of the Linux kernel code. After the code modification is completed, it needs to be compiled, and the Linux system kernel is started on the hardware circuit board to enter the user state to view the debugging results. The entire debugging stage needs to be repeated continuously, and the steps are cumbersome and complicated.

[0076] 2. The PHY driver loading process is included as an intermediate step in the Ethernet MAC driver loading process. The intermediate process is not visible, which increases the difficulty of debugging.

[0077] To solve the above problems, an embodiment of the present invention provides an Ethernet media access control driver embodiment. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0078] In this embodiment, an Ethernet media access control driving method is provided, which can be used for the above-mentioned terminal equipment, such as mobile phones, tablet computers, etc. Figure 2 FIG. 1 is a flow chart of an Ethernet media access control driving method provided by an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0079] Step S201: In the user space, first configuration information corresponding to the bus, second configuration information corresponding to the physical layer integrated circuit chip, and attribute information included in the hardware information are extracted from log information pre-mapped into the user space.

[0080] The log information is generated after registering the bus for managing the physical layer integrated circuit in the driver program and completing the driver loading of the physical layer integrated circuit, and the log information corresponding to the registration process and the driver loading process are generated respectively.

[0081] Specifically, in the user space, before extracting the first configuration information corresponding to the bus, the second configuration information corresponding to the physical layer integrated circuit, and the attribute information included in the hardware information from the log information pre-mapped into the user space, the following method steps need to be performed:

[0082] Step a1: in the driver, obtain the hardware information of the Ethernet MAC controller.

[0083] Specifically, the hardware information of the MAC controller is used to identify and configure the hardware device. When writing an Ethernet MAC driver, you first need to perform the initialization and configuration operations of the driver. Among them, the hardware information may include, for example, the MAC address, the type of controller, the supported functions, the attribute information of the hardware device, etc. The hardware information can be obtained by reading the device register, querying the specific interface of the hardware device, or using other related hardware access methods.

[0084] Step a2: Complete the configuration and operation of the MAC controller according to the hardware information.

[0085] Specifically, once the hardware information of the MAC controller is obtained, the driver can perform corresponding configuration and operations based on the information. Specific configurations may include setting MAC addresses, enabling or disabling specific functions, configuring transmission rates, etc. Operations may include sending and receiving Ethernet packets, handling interrupts, managing buffers, etc.

[0086] Step a3, after completing the configuration and operation of the MAC controller, register the bus for managing the physical layer integrated circuit according to the registration operation instruction, and complete the driver loading of the physical layer integrated circuit, and generate log information corresponding to the registration process and the driver loading process respectively.

[0087] Thereafter, the log information is mapped into the preset user space.

[0088] Specifically, after completing the configuration and operation of the MAC controller, the driver needs to register the bus used to manage the physical layer integrated circuit. The bus is a communication channel used to connect different devices in a computer system. By registering the bus, the driver can communicate with the physical layer integrated circuit. In addition to registering the bus, the driver also needs to complete the driver loading of the physical layer integrated circuit. The driver of the physical layer integrated circuit is loaded into the system and made to work in conjunction with the MAC controller. The driver loading process may, for example, include initializing the physical layer integrated circuit, configuring its working mode, establishing a connection with the MAC controller, etc.

[0089] After completing the bus registration and driver loading, the driver will generate log information corresponding to these processes. Among them, the log information may include, for example, the log information generated during the registration process, the log information generated during the driver loading process, any errors or abnormal conditions, etc. More importantly, the log information includes the first configuration information during the MDIO registration process and the second configuration information during the PHY driver loading process.

[0090] These log information are very useful for debugging and troubleshooting, and can help developers understand the execution of the driver. Finally, the driver maps the generated log information to the preset user space. The user space is the environment in which the user application runs in the operating system. By mapping the log information to the user space, the user application can access and read the log information. This allows users to view the corresponding logs in the application for monitoring, analysis or other related operations. Users can also check whether the debugging results are as expected, whether the MDIO bus registration and PHY driver loading are completed smoothly, and whether the necessary attribute information of the MAC operation function can be correctly provided.

[0091] Step S202: Generate a private structure of the MAC driver according to the first configuration information, the second configuration information, and the attribute information included in the hardware information.

[0092] Step S203: Debug the MAC operation function according to the private structure to generate a first debugging process.

[0093] Specifically, on the premise of successfully completing the MDIO bus registration and PHY driver loading, the debugging process of the MAC operation function is performed in the Linux user space. The first configuration information includes, for example, the type, address, interrupt and other information of the bus. The second configuration information includes, for example, the model, function, register setting and other information of the chip. The attribute information included in the hardware information includes, for example, the MAC address, transmission rate and the like.

[0094] In addition, when debugging the MAC operation function in user space, it is necessary to operate the hardware registers. Since the Linux system does not allow the user space to directly operate the underlying registers, it is necessary to map the hardware registers to the user space, and then directly operate the registers in the user space. Therefore, the generated MAC driver private structure must contain the hardware register addresses to be used by the MAC controller and the hardware register addresses to be used by the PHY chip. The hardware register addresses to be used by the MAC controller are passed to the user space through the log file generated during the MDIO bus registration process, that is, they are included in the first configuration information; the hardware register addresses to be used by the PHY chip are passed to the user space through the log file generated during the PHY driver loading process, that is, they are included in the second configuration information.

[0095] Then, a private structure is created to store the relevant information of the MAC driver. Specifically, the first configuration information, the second configuration information and the attribute information are filled into the corresponding fields of the private structure. The private structure can be used in the user space for further driver development, configuration management or other related operations.

[0096] Specifically, when debugging the MAC operation function, in the user space, by operating the / dev / mem device file, the hardware registers required to be used in the above log file are mapped to the user space, and the registers are directly operated in the user space to complete the debugging process of the MAC operation function.

[0097] In the network stack of the Linux kernel, the socket buffer is used as an important structure for processing network data, transmitting network data in the network protocol stack, and finally sending the data through the MAC controller and PHY chip.

[0098] Optionally, when debugging the MAC operation function in the user space, the socket buffer area needs to be used. However, the socket buffer area cannot be directly operated in the user space. In the process of debugging the MAC driver operation function, in the embodiment of the present application, the Socket API in the Linux system will be used to implement the user space operation on the socket buffer area.

[0099] Step S204: completing the binding of the bus and the physical layer integrated circuit according to the first configuration information and the second configuration information.

[0100] Step S205, completing the second debugging process corresponding to the loading test and the unloading test of the MAC driver according to the debugging operation instruction.

[0101] Specifically, the binding process of MAC and PHY is added in the user space. The loading and unloading process of Ethernet MAC driver is simulated in the user space. After completing the partial debugging of MDIO bus registration and PHY driver loading, the debugging and modification process for MAC operation function and MAC and PHY binding process does not need to repeat the complicated process of modifying kernel code, compiling Linux system kernel, and transplanting the modified Linux system kernel on the hardware circuit board in the related technology. Instead, the code can be debugged directly in the user space and the debugging results can be viewed.

[0102] Step S206, when it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are re-added to the original Ethernet driver loading process for final debugging verification.

[0103] Specifically, after completing all debugging and modification processes of the Ethernet MAC driver, the MAC operation function and the MAC and PHY binding process are added back to the original Ethernet MAC driver recording process compiled by the Linux kernel, and the debugging results are finally verified.

[0104] In the above method flow, please refer to Figure 3 As shown, Figure 3 The schematic diagram of the structure of the partial contents of debugging Ethernet MAC driver in kernel state in the embodiment of the present application is shown. The original device tree writing, MDIO bus registration and PHY driver loading part debugging are completed in kernel state, and the debugging results are transmitted to user state through the output log file. Among them, by outputting the log file, on the one hand, the configuration information can be accurately grasped, and on the other hand, the configuration information is transmitted for the debugging of the latter half of the user state space. Among them, the recording process of the device tree participates in the introduction of steps a1 and a2 introduced in the previous text.

[0105] Figure 4 The diagram below shows the structure of some parts of Ethernet MAC driver debugged in user mode. In user mode, the MAC operation function writing, debugging, and binding MAC and PHY processes that were originally required to be performed in kernel mode are completed, and finally, after debugging is completed, it is re-compiled into Linux driver to verify the debugging effect.

[0106] The Ethernet media access control driving method provided in this embodiment generates a private structure of the MAC driver by extracting the configuration information corresponding to the bus and the physical layer integrated circuit chip and the attribute information in the hardware information from the log information pre-mapped into the user space, and debugs the MAC operation function according to the structure to generate the first debugging process. Then, the binding of the bus and the physical layer integrated circuit is completed according to the configuration information, and the second debugging process corresponding to the loading test and unloading test of the MAC driver is completed according to the debugging operation instruction. Finally, when it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process for the final debugging verification. The attribute information included in the first configuration information, the second configuration information, and the hardware information is mapped to the user space in the form of log information, and the debugging results in the MDIO bus registration and PHY driver loading process can be determined in the user space by reading the log file to ensure the correctness of the debugging results. In addition, in the method of the present application, the entire driver debugging process is split, and a part of the content, such as the debugging process of the MAC operation function, the binding process of MAC and PHY, and the debugging process of the MAC driver loading test and unloading test, is placed in the user space, and the entire Ethernet MAC driver is split to decouple the debugging of different parts. Increase the control of the entire debugging process. When debugging this part of the content separately, it is only necessary to operate in the user space, which simplifies the debugging process. Then, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process to ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, simplifying the complexity of debugging.

[0107] In this embodiment, an Ethernet media access control driving method is provided, which can be used in the above-mentioned mobile terminals, such as mobile phones, tablet computers, etc. Figure 5 FIG. 1 is a flow chart of another Ethernet media access control driving method provided by an embodiment of the present invention. Figure 5 As shown, based on the foregoing embodiment, in an optional example, the MAC operation function is debugged according to the private structure to generate a first debugging process, including the following method steps:

[0108] Step S501, extracting the actual address information of the hardware register and the configuration information of the physical layer integrated circuit from the private structure.

[0109] Step S502: converting the actual address information into virtual address information.

[0110] Step S503: Generate debugging operation execution logic according to the virtual address and the configuration information of the physical layer integrated circuit.

[0111] Step S504: Debug the MAC operation function according to the debugging operation running logic to generate a first debugging process.

[0112] Specifically, in the private structure, find the fields storing the actual address information of the hardware register and the configuration information of the physical layer integrated circuit, read the values ​​of these fields, and obtain the actual address information and configuration information.

[0113] Then, the actual address of the hardware register can be mapped to the virtual address of the user space using the memory mapping mechanism provided by the operating system. Specifically, the address conversion can be completed by calling the relevant functions of the operating system or using a specific library. Then, based on the virtual address, determine the location of the hardware register that can be accessed in the user space. Combined with the configuration information of the physical layer integrated circuit, determine the debugging operation that needs to be performed, such as reading or writing the value of the register. Construct the corresponding debugging operation instructions or function calls to perform specific debugging operations. Use the generated debugging operation running logic to perform debugging operations in the user space. For example, it includes reading or writing the hardware register corresponding to the virtual address to verify the behavior of the MAC operation function. Observe the results of the debugging operation, such as the read register value or the return value of the operation, to determine whether the MAC operation function is working properly. Therefore, based on the debugging results, further analysis and debugging are performed to solve possible problems.

[0114] In an optional example, when converting a real address to a virtual address, the address translation may fail or be invalid. In order to handle these exceptions and take appropriate measures, the following error handling mechanism can be added to the code:

[0115] Check the return value: After performing the address conversion operation, check whether the return value indicates success. If the return value indicates failure or invalid, you can take appropriate error handling measures.

[0116] Catch exceptions: Use appropriate exception handling mechanisms, such as try-catch blocks, to catch exceptions that may be thrown during the address translation process. In the catch block, you can handle the exception and take appropriate measures.

[0117] Log error information: When handling exceptions, log detailed error information, including error type, error message, and related context information. This helps with subsequent troubleshooting and debugging.

[0118] Take recovery measures: Take appropriate recovery measures according to the specific situation, such as retrying address translation, using alternative addresses, or taking other appropriate actions to restore the normal operation of the system.

[0119] Notify users or administrators: When serious anomalies occur, consider notifying users or administrators so that they can take further action.

[0120] Record error logs: Record error information in error logs for subsequent analysis and troubleshooting.

[0121] In another optional example, when debugging the MAC operation function according to the virtual address and the configuration information of the physical layer integrated circuit, and generating a configuration information update request received during the first debugging process, the method further includes:

[0122] Step S505: acquiring new configuration information according to the update request, and updating the new configuration information into the physical layer integrated circuit.

[0123] Step S506: triggering an interrupt operation, where the interrupt operation is used to stop the first debugging process and instruct to obtain new configuration information at the MAC layer.

[0124] Step S507: Update the debugging operation running logic according to the new configuration information.

[0125] Step S508, completing the debugging operation on the MAC operation function according to the updated debugging operation running logic.

[0126] Specifically, if the MAC operation function is debugged according to the virtual address and the configuration information of the physical layer integrated circuit, when a configuration information update request is received during the first debugging process, it is also necessary to obtain new configuration information according to the update request, and update the new configuration information to the physical layer integrated circuit. Then the debugging operation is suspended, that is, an interrupt operation needs to be triggered to stop the first debugging process. After the MAC layer obtains the new configuration information, the debugging operation running logic is updated according to the new configuration information. Finally, the debugging operation of the MAC operation function is completed according to the updated debugging operation running logic.

[0127] An Ethernet media access control driving method provided by an embodiment of the present invention extracts the actual address information of the hardware register and the configuration information of the physical layer integrated circuit from a private structure, converts the actual address into a virtual address, then generates the debugging operation running logic according to the virtual address and the configuration information, and finally debugs the MAC operation function according to the logic, thereby avoiding the tedious process of manually searching and setting the hardware register address and the configuration information, and improving the debugging efficiency. At the same time, when a configuration information update request is received, the current debugging process is stopped by triggering an interrupt operation, and it is instructed to obtain new configuration information at the MAC layer, and then the debugging operation running logic is updated according to the new configuration information, and finally the debugging operation of the MAC operation function is completed, so that the system can dynamically update the configuration information without recompiling and restarting, thereby enhancing the flexibility and scalability of the system. In addition, by generating the debugging operation running logic according to the virtual address and the configuration information of the physical layer integrated circuit, and debugging the MAC operation function according to the logic, the correctness and stability of the debugging operation can be ensured. At the same time, when a configuration information update request is received, the current debugging process is stopped by triggering an interrupt operation, and the MAC layer is instructed to obtain new configuration information. Then, the debugging operation running logic is updated according to the new configuration information, and finally the debugging operation of the MAC operation function is completed. This can avoid system errors and instability caused by untimely configuration information updates, thereby further improving the stability and reliability of the system.

[0128] In an optional example, the actual address information of the hardware register includes actual address information corresponding to the hardware register to be accessed by the MAC controller and actual address information corresponding to the hardware register to be accessed by the physical layer integrated circuit.

[0129] In an optional example, according to the private structure, the MAC operation function is debugged to generate a first debugging process, and when a preset debugging operation instruction is identified, the method further includes:

[0130] Jump out of the user space, enter the kernel space to execute the operation corresponding to the preset debugging operation instruction, and after executing the operation corresponding to the preset debugging operation instruction, enter the user space again to complete other debugging operations on the MAC operation function, wherein the preset debugging operation instruction is used to instruct the execution of the preset debugging operation, and the preset debugging operation cannot be completed in the user space, wherein the preset debugging operation instruction includes: a command for dynamically loading a module in the kernel and a command for unloading a module.

[0131] Specifically, when a preset debugging operation instruction is identified, it is determined that the preset debugging operation cannot be completed in the user space, so it is necessary to jump out of the user space and enter the kernel space for execution. And, after completion in the kernel space, enter the user space again to complete other debugging operations on the MAC operation function. Among them, the preset debugging operation instruction includes, for example, commands for dynamically loading modules and commands for unloading modules in the kernel. These commands can, for example, execute the process of registering a network device in the kernel and load it into the kernel, and complete the corresponding operation in the device driver. This process does not require compiling the system kernel, nor does it require transplanting the system kernel on the hardware circuit board to view the debugging results, reducing the operation steps and saving resources.

[0132] In a specific example, for example, during the debugging process of a MAC driver, when an operation instruction to register a network device is identified, the operation to register a network device cannot be completed in the user space, and it is necessary to jump out of the user space and enter the kernel space to complete it. At this time, the method of insmod and rmmod loading module device drivers is used to load the process of registering a network device in the kernel into the kernel and in the device driver. The advantage of this method is that there is no need to compile the Linux system kernel when writing the process of loading the module device driver, nor is there any need to transplant the Linux system kernel on the hardware circuit board to view the debugging results. Reduce the operation steps and save resources.

[0133] In an optional example, the first configuration information and the second configuration information are both embodied in the form of a first preset structure, wherein the form of the first preset structure is the same as the form of an original structure in the Ethernet MAC driver;

[0134] The MAC operation function is embodied in the user space in the form of a second preset structure, wherein the second preset structure has the same format as the structure of the MAC operation function in the kernel space.

[0135] For example, the second configuration information can be presented in the form of a phy_device structure, which is consistent with the original structure form in the Ethernet MAC driver, ensuring that after the entire driver debugging is completed, it can be restored to the standard form of the Linux kernel driver with minimal modification, and successfully loaded during the Linux system kernel startup process.

[0136] Redefine the operation function structure of the Ethernet MAC driver in the user space to ensure that it is the same as the structure format required in the kernel (for example, struct net_device_ops). This ensures that after the entire driver is debugged, it can be restored to the kernel driver without modification as much as possible.

[0137] The configuration information is kept consistent with the original structure form in the Ethernet MAC driver to ensure that after the entire driver debugging is completed, it can be restored to the standard form of the kernel driver without modification as much as possible, and successfully completed loading and presentation during the system kernel startup process, so as to facilitate the use of debugging the MAC operation function in the user space; in addition, redefining the operation function structure of the Ethernet MAC driver in the user space can ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, which simplifies the complexity of debugging and does not add extra workload to the original Linux driver process.

[0138] In an optional example, the MAC operation function needs to include at least the following network device operation functions: ndo_open, ndo_start_xmit, ndo_stop, or ndo_set_MAC_address.

[0139] Specifically, the above network device operation function can ensure that the MAC driver operation function can achieve its basic function.

[0140] It should be noted that the above method embodiments are all described with Ethernet MAC as the application scenario, but in actual application, the method can also be applied to the debugging process of other driver modules. The driver process is relatively complex and can be divided into multiple parts. Different parts are placed in the Linux kernel recording process and the user space respectively, and the information required by the two parts is transmitted through the log file. Avoid mutual influence of the debugging of each part, and the debugging of the user space part does not need to repeat the Linux kernel code compilation, hardware development board transplantation and other processes, which can simplify the process to a certain extent and improve the debugging efficiency.

[0141] In this embodiment, an Ethernet media access control driver is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0142] This embodiment provides an Ethernet media access control driver device, such as Figure 6 As shown, it includes: an extraction module 601, a generation module 602, a first debugging module 603, a binding module 604, a second debugging module 605, and a processing module 606.

[0143] The extraction module 601 is used to extract, in the user space, the first configuration information corresponding to the bus, the second configuration information corresponding to the physical layer integrated circuit chip, and the attribute information included in the hardware information from the log information pre-mapped into the user space, wherein the log information is the log information corresponding to the registration process and the driver loading process respectively generated after the bus for managing the physical layer integrated circuit is registered in the driver program and the driver loading of the physical layer integrated circuit is completed;

[0144] A generating module 602, configured to generate a private structure of a MAC driver according to the first configuration information and the second configuration information, and the attribute information included in the hardware information;

[0145] A first debugging module 603, used to debug the MAC operation function according to the private structure and generate a first debugging process;

[0146] A binding module 604, configured to complete binding of the bus and the physical layer integrated circuit according to the first configuration information and the second configuration information;

[0147] The second debugging module 605 is used to complete the second debugging process corresponding to the loading test and the unloading test of the MAC driver according to the debugging operation instruction;

[0148] The processing module 606 is used to add the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure to the original Ethernet driver loading process for final debugging verification after determining that the first debugging process and the second debugging process are completed.

[0149] In an optional example, the first debugging module 603 is specifically configured to:

[0150] Extract the actual address information of the hardware registers and the configuration information of the physical layer integrated circuit from the private structure;

[0151] Converting actual address information into virtual address information;

[0152] Generate debugging operation running logic according to the virtual address and the configuration information of the physical layer integrated circuit;

[0153] Debugging the MAC operation function according to the debugging operation running logic to generate a first debugging process;

[0154] Alternatively, when the MAC operation function is debugged according to the virtual address and the configuration information of the physical layer integrated circuit, and a configuration information update request is received during the first debugging process, the first debugging module 603 is further used to:

[0155] According to the update request, new configuration information is obtained, and the new configuration information is updated into the physical layer integrated circuit;

[0156] Triggering an interrupt operation, where the interrupt operation is used to stop the first debugging process and instruct to obtain new configuration information at the MAC layer;

[0157] Update the debugging operation running logic according to the new configuration information;

[0158] According to the updated debugging operation running logic, the debugging operation on the MAC operation function is completed.

[0159] In an optional example, the device further includes: an acquisition module and a registration module;

[0160] The acquisition module is used to obtain the hardware information of the Ethernet MAC controller in the driver;

[0161] The processing module 606 is further used to complete the configuration and operation of the MAC controller according to the hardware information;

[0162] The registration module is used to register the bus for managing the physical layer integrated circuit according to the registration operation instruction after completing the configuration and operation of the MAC controller, and after completing the driver loading of the physical layer integrated circuit, generate log information corresponding to the registration process and the driver loading process respectively, and map the log information to the preset user space.

[0163] In an optional example, the actual address information of the hardware register includes actual address information corresponding to the hardware register to be accessed by the MAC controller and actual address information corresponding to the hardware register to be accessed by the physical layer integrated circuit.

[0164] In an optional example, the device further includes: a third debugging module 607;

[0165] The processing module 606 is further configured to jump out of the user space and enter the kernel space when a preset debugging operation instruction is recognized;

[0166] The third debugging module 607 is used to execute the operation corresponding to the preset debugging operation instruction, and after executing the operation corresponding to the preset debugging operation instruction, re-enter the user space so that the second debugging module 605 can continue to complete other debugging operations on the MAC operation function, wherein the preset debugging operation instruction is used to instruct the execution of the preset debugging operation, and the preset debugging operation cannot be completed in the user space, wherein the preset debugging operation instruction includes: a command for dynamically loading a module in the kernel and a command for unloading a module.

[0167] In an optional example, the first configuration information and the second configuration information are both embodied in the form of a first preset structure, wherein the form of the first preset structure is the same as the form of an original structure in the Ethernet MAC driver;

[0168] The MAC operation function is embodied in the user space in the form of a second preset structure, wherein the second preset structure has the same format as the structure of the MAC operation function in the kernel space.

[0169] In an optional example, the MAC operation function needs to include at least the following network device operation functions: ndo_open, ndo_start_xmit, ndo_stop, or ndo_set_MAC_address.

[0170] The Ethernet media access control driver in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0171] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0172] An Ethernet media access control driver provided by an embodiment of the present invention generates a private structure of a MAC driver by extracting configuration information corresponding to a bus and a physical layer integrated circuit chip and attribute information in hardware information from log information pre-mapped into a user space, and debugs a MAC operation function according to the structure to generate a first debugging process. Then, the binding of the bus and the physical layer integrated circuit is completed according to the configuration information, and the second debugging process corresponding to the loading test and unloading test of the MAC driver is completed according to the debugging operation instruction. Finally, when it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process for final debugging verification. The attribute information included in the first configuration information, the second configuration information, and the hardware information is mapped into the user space in the form of log information, and the debugging results in the MDIO bus registration and PHY driver loading process can be determined in the user space by reading the log file in the form of a log file to ensure the correctness of the debugging results. In addition, in the method of the present application, the entire driver debugging process is split, and a part of the content, such as the debugging process of the MAC operation function, the binding process of MAC and PHY, and the debugging process of the MAC driver loading test and unloading test, is placed in the user space, and the entire Ethernet MAC driver is split to decouple the debugging of different parts. Increase the control of the entire debugging process. When debugging this part of the content separately, it is only necessary to operate in the user space, which simplifies the debugging process. Then, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are added back to the original Ethernet driver loading process to ensure that after the debugging in the user space is completed, it can be smoothly transplanted back to the original Linux driver code, simplifying the complexity of debugging.

[0173] The embodiment of the present invention also provides a computer device having the above Figure 6 The Ethernet media access control driver is shown.

[0174] See also Figure 7 , Figure 7 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 7As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.

[0175] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include an integrated circuit. The integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0176] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0177] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device 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.

[0178] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0179] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0180] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0181] The embodiment of the present invention also provides a computer-readable storage medium. The method provided in the above embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or is implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0182] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0183] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. An Ethernet media access control driving method, characterized in that: The method comprises: In the user space, extracting first configuration information corresponding to the bus, second configuration information corresponding to the physical layer integrated circuit chip, and attribute information included in the hardware information from log information pre-mapped into the user space, wherein the log information is generated after registering the bus for managing the physical layer integrated circuit in the driver and completing the driver loading of the physical layer integrated circuit, and respectively generating log information corresponding to the registration process and the driver loading process; Generate a private structure of a MAC driver according to the first configuration information, the second configuration information, and the attribute information included in the hardware information; Debugging the MAC operation function according to the private structure to generate a first debugging process; According to the first configuration information and the second configuration information, completing the binding of the bus and the physical layer integrated circuit; According to the debugging operation instruction, complete the second debugging process corresponding to the loading test and the unloading test of the MAC driver; When it is determined that the first debugging process and the second debugging process are completed, the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure are re-added to the original Ethernet driver loading process for final debugging verification.

2. The method according to claim 1, characterized in that The debugging of the MAC operation function according to the private structure to generate a first debugging process specifically includes: Extracting actual address information of hardware registers and configuration information of the physical layer integrated circuit from the private structure; Converting the actual address information into virtual address information; Generate debugging operation running logic according to the virtual address and the configuration information of the physical layer integrated circuit; Debugging the MAC operation function according to the debugging operation running logic to generate the first debugging process; Alternatively, when the MAC operation function is debugged according to the virtual address and the configuration information of the physical layer integrated circuit, and a configuration information update request is received during the first debugging process, the method further includes: Acquire new configuration information according to the update request, and update the new configuration information into the physical layer integrated circuit; triggering an interrupt operation, where the interrupt operation is used to stop the first debugging process and instruct to obtain the new configuration information at the MAC layer; According to the new configuration information, the debugging operation running logic is updated; According to the updated debugging operation running logic, the debugging operation on the MAC operation function is completed.

3. The method according to claim 1 or 2, characterized in that: In the user space, before extracting the first configuration information corresponding to the bus, the second configuration information corresponding to the physical layer integrated circuit, and the attribute information included in the hardware information from the log information pre-mapped into the user space, the method further includes: In the driver, obtain the hardware information of the Ethernet MAC controller; According to the hardware information, complete the configuration and operation of the MAC controller; After completing the configuration and operation of the MAC controller, registering the bus for managing the physical layer integrated circuit according to the registration operation instruction, and completing the driver loading of the physical layer integrated circuit, respectively generate log information corresponding to the registration process and the driver loading process, and map the log information into a preset user space.

4. The method according to claim 2, characterized in that: The actual address information of the hardware register includes the actual address information corresponding to the hardware register to be accessed by the MAC controller and the actual address information corresponding to the hardware register to be accessed by the physical layer integrated circuit.

5. The method according to claim 1 or 2, characterized in that: In the process of debugging the MAC operation function according to the private structure to generate the first debugging function, when a preset debugging operation instruction is identified, the method further includes: Jump out of the user space, enter the kernel space to execute the operation corresponding to the preset debugging operation instruction, and after executing the operation corresponding to the preset debugging operation instruction, enter the user space again to complete other debugging operations on the MAC operation function, wherein the preset debugging operation instruction is used to instruct the execution of a preset debugging operation, and the preset debugging operation cannot be completed in the user space, wherein the preset debugging operation instruction includes: a command for dynamically loading a module in the kernel and a command for unloading a module.

6. The method according to claim 1 or 2, characterized in that: The first configuration information and the second configuration information are both embodied in the form of a first preset structure, wherein the form of the first preset structure is the same as the form of the original structure in the Ethernet MAC driver; The MAC operation function is embodied in the user space in the form of a second preset structure, wherein the form of the second preset structure is the same as the format of the structure of the MAC operation function in the kernel space.

7. The method according to any one of claims 1 or 2, characterized in that: The MAC operation function needs to include at least the following network device operation functions: ndo_open, ndo_start_xmit, ndo_stop, or ndo_set_MAC_address.

8. An Ethernet media access control driver, characterized in that: The device comprises: an extraction module, configured to extract, in a user space, first configuration information corresponding to a bus, second configuration information corresponding to a physical layer integrated circuit chip, and attribute information included in the hardware information from log information pre-mapped into the user space, wherein the log information is generated after registering a bus for managing the physical layer integrated circuit in a driver and completing driver loading of the physical layer integrated circuit, and respectively generating log information corresponding to a registration process and a driver loading process; A generating module, configured to generate a private structure of a MAC driver according to the first configuration information, the second configuration information, and the attribute information included in the hardware information; A first debugging module, configured to debug the MAC operation function according to the private structure and generate a first debugging process; A binding module, used to complete the binding of the bus and the physical layer integrated circuit according to the first configuration information and the second configuration information; A second debugging module, used to complete a second debugging process corresponding to a loading test and an unloading test of the MAC driver according to a debugging operation instruction; The processing module is used to add the MAC operation function, the binding of the bus and the physical layer integrated circuit, and the private structure to the original Ethernet driver loading process for final debugging verification after determining that the first debugging process and the second debugging process are completed.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the Ethernet media access control driving method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the Ethernet media access control driving method according to any one of claims 1 to 7.