Drive loading method and device, electronic equipment and storage medium
By performing strategic loading according to device type and access status during the media access control layer driver loading process, the problem of unavailable Ethernet devices is solved, and the system's network device management efficiency and stability are improved.
Patent Information
- Application Number
- CN202510327746.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, when the computer system loads the media access control layer driver, it may cause unavailable Ethernet devices, resulting in low network device management efficiency and poor system stability, especially when the processor integrates the media access control layer but does not connect to the physical layer transceiver.
By determining the device type and access status of the medium access control layer, driver loading is performed only when the device access status is connected, and driver loading requests in the unattached state are ignored to avoid unavailable Ethernet devices.
Improve the system's management efficiency and operation stability of network equipment, avoid errors and failures caused by unavailable Ethernet equipment, and ensure the normal operation of the system.
Smart Images

Figure CN120371408A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a driver loading method, apparatus, electronic device, and storage medium. Background Art
[0002] The media access control layer is a key part for realizing effective and orderly data communication between computer devices. The driver loading of the media access control layer is crucial for ensuring that the computer system can correctly access and use network resources.
[0003] In the prior art, when a computer starts up or an operating system is loaded, the computer identifies all the media access control layers installed. For each media access control layer, the system calls the corresponding media access control layer driver to perform driver loading, so as to generate an Ethernet device corresponding to the media access control layer in the operating system, enabling the operating system and applications to establish a network connection through the Ethernet device.
[0004] However, since there may be a media access control layer integrated in the processor in the computer, and this media access control layer may not be connected to a corresponding physical layer transceiver, driving and loading this media access control layer can easily generate unusable Ethernet devices in the operating system, which will not only reduce the management efficiency of the operating system for network devices, but also may reduce the stability of system operation. Summary of the Invention
[0005] In view of the above problems, embodiments of the present application are proposed to provide a driver loading method that can overcome or at least partially solve the above problems, which can improve the management efficiency of the system for network devices and the stability of system operation.
[0006] Correspondingly, embodiments of the present application also provide a driver loading apparatus, an electronic device, and a storage medium to ensure the implementation and application of the above method.
[0007] In a first aspect, embodiments of the present application disclose a driver loading method, the method including:
[0008] Responding to a driver loading request for a media access control layer, determining the device type corresponding to the media access control layer;
[0009] In the case where the device type is an integrated device, determining the device access status corresponding to the media access control layer;
[0010] In the case where the device access status is connected, performing driver loading on the media access control layer to generate an Ethernet device corresponding to the media access control layer;
[0011] When the device access status is not connected, ignore the driver loading request.
[0012] In a second aspect, an embodiment of the present application discloses a driver loading device, the device includes:
[0013] A device type module, configured to determine the device type corresponding to the media access control layer in response to a driver loading request for the media access control layer;
[0014] An access status module, configured to determine the device access status corresponding to the media access control layer when the device type is an integrated device;
[0015] A driver loading module, configured to perform driver loading on the media access control layer to generate an Ethernet device corresponding to the media access control layer when the device access status is connected; when the device access status is not connected, ignore the driver loading request.
[0016] Optionally, the device type module includes:
[0017] A device identification sub-module, configured to obtain the device identification corresponding to the driver loading request;
[0018] A first flag bit sub-module, configured to determine a first flag bit corresponding to the media access control layer based on the device identification;
[0019] A device type determination sub-module, configured to determine that the device type corresponding to the media access control layer is an integrated device when the first flag bit matches a first preset value.
[0020] Optionally, the device further includes:
[0021] A second flag bit module, configured to obtain a second flag bit of the local processor; wherein, the second flag bit is used to indicate whether the local processor includes a media access control layer with a device type of an integrated device;
[0022] A first execution module, configured to execute the step of determining the device type corresponding to the media access control layer when the second flag bit matches a second preset value;
[0023] A second execution module, configured to execute the step of performing driver loading on the media access control layer when the second flag bit does not match the second preset value.
[0024] Optionally, the second flag bit is written to a preset path by a target service running when the operating system is started, and the second flag bit module is further configured to read the second flag bit from the preset path.
[0025] Optionally, the access status module includes:
[0026] An acquisition sub-module, configured to acquire physical layer device information connected to a media independent interface corresponding to the media access control layer;
[0027] A non-access sub-module, configured to determine that the access status of the device corresponding to the media access control layer is non-access when the physical layer device information is empty;
[0028] An access status determination sub-module, configured to determine the access status of the device corresponding to the media access control layer based on the physical layer device information when the physical layer device information is not empty.
[0029] Optionally, the access status determination sub-module includes:
[0030] An information determination unit, configured to determine a basic mode status value of the physical layer device connected to the media independent interface and drive information bound to the physical layer device based on the physical layer device information;
[0031] A non-access determination unit, configured to determine that the access status of the device corresponding to the media access control layer is non-access when the drive information is empty or the basic mode status value does not belong to a preset interval;
[0032] An access determination unit, configured to determine that the access status of the device corresponding to the media access control layer is access when the basic mode status value belongs to the preset interval and the drive information is not empty.
[0033] Optionally, the device further includes:
[0034] A writing module, configured to write the device type corresponding to the media access control layer into a device structure corresponding to the media access control layer in a media access control layer driver, so that when the device type in the device structure in the media access control layer driver is an integrated device, the step of determining the access status of the device corresponding to the media access control layer is executed.
[0035] In a third aspect, an embodiment of the present application discloses an electronic device, including: a processor, a memory, a communication interface, and a communication bus, where the processor, the memory, and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the steps of any one of the foregoing drive loading methods.
[0036] Fourthly, an embodiment of the present application discloses a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, any of the drive loading methods in the embodiments of the present application can be implemented.
[0037] The drive loading method, device, electronic device and storage medium provided by the embodiments of the present application have the following advantages:
[0038] The present application provides a drive loading method, which can be used to load a drive for a media access control layer in a computer. The present application can respond to a drive loading request for the media access control layer, determine the device type corresponding to the media access control layer, and when the device type is an integrated device, determine the device access status corresponding to the media access control layer. When the device access status is connected, load the drive for the media access control layer to generate an Ethernet device corresponding to the media access control layer. When the device access status is not connected, ignore the drive loading request. When loading the drive for the media access control layer, different drive loading strategies can be adopted according to the device type and device access status corresponding to the media access control layer. When the device type of the media access control layer is an integrated device and the device access status of the media access control layer is not connected, no actual drive loading is performed, so that an unusable Ethernet device cannot be generated in the operating system, the system does not need to manage the unusable Ethernet device additionally, and errors and faults will not occur due to the invocation of the unusable Ethernet device, which helps to improve the management efficiency of the system for network devices and the stability of system operation. Description of the Drawings
[0039] Figure 1 is a flowchart of steps of an embodiment of a drive loading method of the present application;
[0040] Figure 2 is a schematic diagram of a processor interface of the present application;
[0041] Figure 3 is a schematic diagram of target service loading of the present application;
[0042] Figure 4 is a schematic diagram of second flag bit processing of the present application;
[0043] Figure 5 is a drive loading flowchart under a Linux operating system of the present application;
[0044] Figure 6 is a structural block diagram of an embodiment of a drive loading device of the present application;
[0045] Figure 7It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0046] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present application.
[0047] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In the embodiments of the present application, the term "plurality" refers to two or more, and other quantifiers are similar.
[0048] First, the concepts involved in the present application will be explained.
[0049] The Media Access Control (MAC) layer represents a part of the data link layer in a computer and is responsible for transmitting data frames on a shared medium (such as Ethernet). It is used to control how a device accesses the physical medium and performs operations such as address resolution, data encapsulation, and transmission. It can refer to the physical hardware or emulated hardware used to implement media access control, which is responsible for performing processes such as data frame encapsulation, parsing, addressing, and flow control. The media access control layer usually works in cooperation with the physical layer transceiver to achieve a complete Ethernet communication function.
[0050] The Physical Layer Transceiver (PHY) represents a part of the "physical layer" in a computer and is responsible for sending and receiving signals. The physical layer transceiver communicates with the media access control layer through a specific interface to achieve the network connection function of the computer.
[0051] The Media Independent Interface (MII), also known as the media - agnostic interface, is an interface used to connect a physical - layer transceiver and a media access control layer. The Media Independent Interface also includes some variant interfaces with similar functions, such as the Reduced Gigabit Media Independent Interface (RGMII), the Reduced Media Independent Interface (RMII), etc. These variant interfaces can also be used as communication interfaces between the physical - layer transceiver and the media access control layer. Among them, RGMII is usually used for Gigabit Ethernet, while RMII can be used for 10 / 100Mbps Ethernet. Some processors integrate the media access control layer, and these processors are usually equipped with corresponding Media Independent Interfaces and can be directly connected to the physical - layer transceiver.
[0052] An independent network device usually refers to a network device that integrates both a physical - layer transceiver and a media access control layer. These network devices are usually connected using standard bus interfaces. For example, a network card device connected to the motherboard through the Peripheral Component Interconnect Express (PCIe) or Universal Serial Bus (USB) standard interface.
[0053] The media access control layer driver is the driver software for the media access control layer, responsible for driving the media access control layer to perform data transmission and reception through the connected physical - layer transceiver, thereby realizing Ethernet communication. The media access control layer driver can load the driver for the media access control layer, thus generating a corresponding Ethernet device in the operating system as a logical network interface in the operating system. The media access control layer driver is usually located in the system kernel, and different system kernels may use different media access control layer drivers. For example, in the Linux kernel, the media access control layer driver can include the STMMAC driver. Among them, the STMMAC (STMicroelectronics GMAC) driver is the Ethernet MAC driver in the Linux kernel.
[0054] Figure 1 The flowchart of the steps of an embodiment of a driver - loading method according to the present application is shown. The method can be applied to a computer and may include the following steps:
[0055] Step 101: In response to a driver - loading request for the media access control layer, determine the device type corresponding to the media access control layer;
[0056] Step 102: When the device type is an integrated device, determine the device access status corresponding to the media access control layer;
[0057] Step 103: When the device access status is 'connected', load the driver for the media access control layer to generate an Ethernet device corresponding to the media access control layer;
[0058] Step 104: When the device access status is 'not connected', ignore the driver loading request.
[0059] The method provided by the embodiments of this application can be used in a computer installed with an operating system. In the embodiments of this application, the computer can include, but is not limited to, any of the following: server, smart phone, voice recorder, tablet computer, e-book reader, MP3 (Moving Picture Experts Group Audio Layer III) player, MP4 (Moving Picture Experts Group Audio Layer IV) player, laptop computer, in-vehicle computer, desktop computer, set-top box, smart TV, wearable device, etc.
[0060] The embodiments of this application do not limit the type of the operating system. The operating system can be an operating system based on the Linux kernel. For example, it can be any one of Debian, Ubuntu, CentOS (Community Enterprise Operating System), Kylin operating system, Founder operating system, etc. It can also include operating systems based on other kernels.
[0061] In the embodiments of this application, a computer can include a media access control layer, and an operating system can include a media access control layer driver for driving the media access control layer. During the startup process of the operating system, the driver of the physical layer device in the computer will be loaded, which can include the media access control layer. The operating system can load the driver for each media access control layer in the computer through the media access control layer driver therein, so that the media access control layer can manage and use the corresponding physical layer transceiver, and generate a corresponding Ethernet device in the operating system for user programs and system programs to call.
[0062] In the embodiments of this application, the processor of the computer can be built-in with a media access control layer. The processor can include a media independent interface. The media access control layer included in the computer can be connected to the physical layer transceiver through the media independent interface.
[0063] Refer to Figure 2 , Figure 2 which shows a schematic diagram of a processor interface provided by an embodiment of the present application. As Figure 2 shown, the processor may include two media independent interfaces, namely Gigabit Ethernet 0 (RGMII interface) and Gigabit Ethernet 1 (RGMII interface), and may also include other interfaces. That is, the processor can directly connect to the physical layer transceiver through the two RGMII interfaces. The user can install and connect the required physical layer transceiver through the RGMII interface of the processor, or can choose to leave the RGMII interface of the processor vacant, that is, not connect to the physical layer transceiver.
[0064] In an embodiment of the present application, some media access control layer drivers (such as STMMAC drivers) will load the drivers of the media access control layer carried on the computer when the computer is powered on, and generate an Ethernet device corresponding to the media access control layer in the operating system. The media access control layer may include the media access control layer in the processor, or may include the media access control layer on the network card connected through the standard bus interface of the computer. The network configuration scheme of the computer may include three methods: The first method is that the computer can only connect through the standard bus interface to an independent network device (such as a PCIe network card, a USB network card, etc.) that includes both a media access control layer and a physical layer transceiver, while the media independent interface of the processor is vacant; The second connection method is that the computer only connects to the physical layer transceiver through the media independent interface, while the standard bus interface does not connect to an independent network device; The third connection method is that the media independent interface of the computer connects to the physical layer transceiver, and the standard bus interface is simultaneously connected to an independent network device.
[0065] For the above three connection methods, the media access control layer built in the processor will be initialized through the media access control layer driver. In the above various connection methods, even if the media independent interface of the processor is not actually connected to the physical layer transceiver, the media access control layer built in the processor may still be initialized through the media access control layer driver, resulting in the generation of corresponding unusable Ethernet devices for the media access control layer that is not actually connected to the physical layer transceiver in the operating system.
[0066] Taking a computer with a Linux operating system equipped with a Feiteng processor as an example, if the motherboard of the computer is connected to a PCIe network card but the processor is not connected to a physical layer transceiver, after the computer starts up and enters the desktop, open the terminal program of the operating system and enter a network information viewing command (such as the ifconfig command). Multiple Ethernet devices will be queried, but only the Ethernet device corresponding to the PCIe network card can be used normally, while other Ethernet devices generated by loading the driver for the media access control layer of the processor cannot be used normally, resulting in unusable Ethernet devices.
[0067] In the embodiments of the present application, by optimizing the process of loading the media access control layer driver, unusable Ethernet devices can be avoided from being generated in the operating system.
[0068] In the embodiments of the present application, during the startup process of the computer's operating system, all media access control layers in the computer will be detected. For each media access control layer, the relevant program will call the media access control layer driver of the operating system kernel to load and initialize the media access control layer, generating corresponding Ethernet devices in the operating system. It should be noted that the relevant programs for calling the media access control layer driver may include the manufacturer's driver program corresponding to the media access control layer, the basic input / output system program, the operating system kernel program, etc., which are not specifically limited in the embodiments of the present application.
[0069] In the embodiments of the present application, when initializing the media access control layer by calling the media access control layer driver, relevant controller information of the media access control layer to be initialized is usually passed to the media access control layer driver. The controller information may include, but is not limited to, one of the controller name, controller model, manufacturer's driver name corresponding to the controller, etc., which are not specifically limited in the embodiments of the present application. Therefore, in response to the driver loading requests for each media access control layer in the computer, the device type corresponding to the media access control layer to be initialized can be determined according to the controller information in the driver loading request.
[0070] In the embodiments of the present application, different media access control layers may have different device types, and the device types may include integrated devices and independent devices. Among them, an integrated device means that the media access control layer is integrated in the processor; an independent device means that the media access control layer is set in an external device, such as the media access control layer set in an external network card. If the device type of a media access control layer is an integrated device, it indicates that the media access control layer may not be actually connected to a physical layer transceiver, and unusable Ethernet devices may be generated in the operating system after its initialization.
[0071] Specifically, in another embodiment, a first correspondence between controller information and device types can be established in advance. After obtaining a driver loading request for the media access control layer, the above-mentioned first correspondence is queried according to the controller information corresponding to the driver loading request to obtain the device type corresponding to the media access control layer. In another embodiment, the controller information of the media access control layer of the integrated device can be made to have different information characteristics from the controller information of the media access control layer of the standalone device. For example, the controller name of the media access control layer of the integrated device can be made to have a different naming length from the controller name of the media access control layer of the standalone device. Thus, after obtaining the controller information corresponding to the driver loading request, the controller information can be parsed, and the device type corresponding to the media access control layer can be determined according to its information characteristics. The embodiments of the present application do not specifically limit the method for determining the device type corresponding to the media access control layer.
[0072] In the embodiments of the present application, if the device type of the media access control layer is an integrated device, the device access status corresponding to the media access control layer can be further determined. The device access status is used to indicate whether the media access control layer is connected to an available physical layer transceiver, and the device access status can include connected and not connected. Specifically, it can be checked whether the media access control layer is directly connected to the corresponding physical layer transceiver. If the media access control layer is connected to a physical layer transceiver, it can be determined that the device access status of the media access control layer is connected. If the media access control layer is not connected to a physical layer transceiver, it can be determined that the device access status of the media access control layer is not connected.
[0073] In the embodiments of the present application, if the device access status of the media access control layer is connected, the driver loading request corresponding to the media access control layer can be continued to be processed, and the media access control layer driver can perform driver loading on the media access control layer, thereby implementing the initialization operation of the media access control layer and generating an Ethernet device corresponding to the media access control layer in the operating system.
[0074] In the embodiments of the present application, if the device access status of the media access control layer is not connected, the driver loading request corresponding to the media access control layer can be ignored, thereby skipping the initialization process of the media access control layer and avoiding generating an unavailable Ethernet device corresponding to the media access control layer in the operating system.
[0075] In one example, the media access control layer driver can be the STMMAC driver. During the computer startup process, it is found that there is a media access control layer A integrated in the processor and a media access control layer B in the PCIe network card in the computer. For the media access control layer A, the operating system can run the vendor driver program corresponding to the media access control layer A for processing.
[0076] The vendor driver of Media Access Control layer A can send a driver loading request for Media Access Control layer A to the STMMAC driver in the operating system kernel. The solution of the embodiment of the present application can intercept the driver loading request, and then determine the device type of Media Access Control layer A according to the controller information of Media Access Control layer A carried in the driver loading request. After determining that the device type of Media Access Control layer A is an integrated device, the device access status of Media Access Control layer A can be further determined. If the device access status of Media Access Control layer A is connected, the driver loading request for Media Access Control layer A can be sent to the STMMAC driver for continued processing, so as to load the driver for Media Access Control layer A and generate an Ethernet device corresponding to Media Access Control layer A in the operating system; if the device access status of Media Access Control layer A is not connected, the driver loading request for Media Access Control layer A can be intercepted and ignored, so as to avoid generating an unusable Ethernet device corresponding to Media Access Control layer A in the operating system.
[0077] After that, it can continue to respond to the driver loading request sent by the vendor driver corresponding to Media Access Control layer B to the STMMAC driver. After determining that the device type of Media Access Control layer B is an independent device according to the driver loading request, the driver loading request for Media Access Control layer B can be sent to the STMMAC driver for continued processing, so as to load the driver for Media Access Control layer B and generate an Ethernet device corresponding to Media Access Control layer B in the operating system.
[0078] In an alternative embodiment of the present application, the determining the device type corresponding to the Media Access Control layer may include:
[0079] Step S11: Obtain the device identifier corresponding to the driver loading request;
[0080] Step S12: Determine the first flag bit corresponding to the Media Access Control layer based on the device identifier;
[0081] Step S13: When the first flag bit matches the first preset value, determine that the device type corresponding to the Media Access Control layer is an integrated device.
[0082] In the embodiments of the present application, a driver loading request may be sent by a vendor driver corresponding to the corresponding media access control layer. The vendor driver may have a corresponding device identifier. The device identifier is used to represent the identifier of the media access control layer to be initialized by the vendor driver that sends the driver loading request. The device identifier may be obtained by parsing the driver loading request, or by tracing the vendor driver that sends the driver loading request and querying the driver information of the vendor driver. The embodiments of the present application do not specifically limit the manner of the device identifier corresponding to the vendor driver that sends the driver loading request. It should be noted that since different media access control layers usually correspond to different vendor drivers, the driver name of the vendor driver that sends the driver loading request can be directly obtained as the device identifier corresponding to the driver loading request.
[0083] In the embodiments of the present application, the controller information may include the above-mentioned device identifier, that is, the device type corresponding to the media access control layer can be determined through the device identifier. The first corresponding relationship between the device identifiers of different vendor drivers and the first flag bit used to reflect the device type can be pre-configured. Thus, after obtaining the driver loading request for the media access control layer, the device identifier corresponding to the vendor driver corresponding to the driver loading request is obtained; the first corresponding relationship is queried through the device identifier to obtain the first flag bit of the media access control layer corresponding to the driver loading request; and when the first flag bit is equal to the first preset value, it is determined that the device type of the media access control layer is an integrated device. In the embodiments of the present application, all the device identifiers of the media access control layers supported by the media access control layer driver and their corresponding first flag bits may be recorded in the first corresponding relationship.
[0084] In the embodiments of the present application, each step may be implemented by adding an independent program or process in the operating system, or by adjusting the existing media access control layer driver, so that the existing media access control layer initialization logic in the operating system can be maintained, the modification of the media access control layer initialization process can be reduced, and it helps to reduce the adaptation difficulty of the solution of the present application to the existing operating system architecture.
[0085] In the following, taking the media access control layer driver as the STMMAC driver as an example, the solution of the embodiments of the present application will be illustrated. First, an example of adjusting the STMMAC driver to implement the above-mentioned method for determining the device type corresponding to the media access control layer will be given:
[0086] A first structure including a device identifier field and a first flag bit field, a set of enumerations corresponding to the first flag bit field (i.e., the value range of the first flag bit), and a first array with the above first structure as an element may be defined in the STMMAC driver. The above first corresponding relationship may be included through the first array.
[0087] Exemplarily, the first structure stmmac_quirk may include the following fields:
[0088] devname: Device identifier;
[0089] quirk: The first flag bit.
[0090] A set of enumerations corresponding to the first flag bit field quirk may be as follows:
[0091] QUIRK_NONE: Indicates a stand-alone device;
[0092] QUIRK_PHY_CONNECT_CHECK: Indicates an integrated device.
[0093] The first array stmmac_quirks[] may be as follows:
[0094]
[0095] Among them, the first corresponding relationship of the above first array may indicate that the device identifier "PHYT00*" corresponds to the first flag bit QUIRK_PHY_CONNECT_CHECK, and the device identifier "LOON00*" corresponds to the first flag bit QUIRK_PHY_CONNECT_CHECK. The * in the device identifier in the above first array may represent a wildcard.
[0096] If the STMMAC driver receives a driver loading request, the STMMAC driver may determine the device identifier corresponding to the driver loading request, and match the device identifier in the first array to determine the first flag bit corresponding to the device identifier. Exemplarily, if the device identifier is "PHYT002", the corresponding first flag bit obtained after matching in the first array may be QUIRK_PHY_CONNECT_CHECK.
[0097] In the embodiment of the present application, after obtaining the first flag bit corresponding to the media access control layer, the first flag bit may be matched with a first preset value. If the first flag bit matches the first preset value, it may be determined that the device type of the media access control layer is an integrated device. If the first flag bit does not match the first preset value, it may be determined that the device type of the media access control layer is a stand-alone device.
[0098] Continuing with the above example, the first preset value may be "QUIRK_PHY_CONNECT_CHECK". After determining the first flag bit corresponding to the media access control layer, the first flag bit may be matched with the first preset value. If the match is successful, it is determined that the device type of the media access control layer is an integrated device.
[0099] In the embodiments of the present application, through steps S11 to S13, the device identifier corresponding to the media access control layer for which driver loading is currently in progress can be determined based on the driver loading request of the media access control layer, and then the device type corresponding to the media access control layer for which driver loading is currently in progress can be accurately judged according to the device identifier, which helps to improve the accuracy of judging the device type of the media access control layer corresponding to the driver loading request.
[0100] In an alternative embodiment of the present application, before determining the device type corresponding to the media access control layer, it may include:
[0101] Step S111: Obtain a second flag bit of the local processor; wherein, the second flag bit is used to indicate whether the local processor includes a media access control layer with a device type of an integrated device;
[0102] Step S112: When the second flag bit matches a second preset value, execute the step of determining the device type corresponding to the media access control layer;
[0103] Step S113: When the second flag bit does not match the second preset value, execute the step of performing driver loading on the media access control layer.
[0104] In the embodiments of the present application, before executing step S11, it may first be judged whether the local processor in the computer includes a media access control layer of an integrated device; if the local processor does not include a media access control layer of an integrated device, it means that the media access control layer in the local machine will not generate unusable Ethernet devices in the operating system after initialization, so the subsequent steps can be skipped, and the subsequent driver loading requests for each media access control layer can be directly responded to in a conventional manner; if the local processor includes a media access control layer of an integrated device, step S11 can be further executed to further determine whether to ignore or normally process the driver loading request.
[0105] In the embodiments of the present application, after a driver loading request for the media access control layer is issued, step S111 may be first executed to obtain a second flag bit of the local processor. The second flag bit may indicate whether the local processor is a processor of the media access control layer including an integrated device, that is, it indicates the processor type. The processor type may include the type of the integrated media access control layer and the type of the non-integrated media access control layer. Thus, the second flag bit corresponding to the processor type may indicate whether the local processor is a processor that can connect to a physical layer transceiver through a media independent interface. If the second flag bit matches the second preset value, it may be determined that the local processor is a processor of the media access control layer including an integrated device, and step S11 may be further executed to obtain the device identifier corresponding to the driver loading request. If the second flag bit does not match the second preset value, it may be determined that the local processor is a processor of the media access control layer without an integrated device, and it is impossible for the operating system to generate an unusable Ethernet device. Therefore, the driver loading of the media access control layer may be directly performed in response to the driver loading request for the media access control layer.
[0106] In the embodiments of the present application, through the above steps S111 to S113, in the case where an unusable Ethernet device may be generated, the subsequent process of determining whether to ignore the driver loading request for the media access control layer may be performed. In the case where an unusable Ethernet device cannot be generated, the driver loading of the media access control layer may be directly performed in response to the driver loading request for the media access control layer in a conventional manner, which can improve the operation efficiency in the implementation process of the present solution and reduce the consumption of hardware resources required to implement the present solution.
[0107] In an alternative embodiment of the present application, the second flag bit is written to a preset path by a target service running when the operating system is started. The obtaining of the second flag bit of the local processor may include:
[0108] Reading the second flag bit from the preset path.
[0109] In the embodiments of the present application, the second flag bit may be written to the preset path of the computer when the operating system of the computer is started, so that when a driver loading request for the media access control layer is obtained, the second flag bit may be directly read from the above preset path, further improving the response efficiency for the driver loading request.
[0110] Specifically, when the operating system starts up, it can run a target service for writing the second flag bit. The target service obtains the processor identifier of the local processor, matches the processor identifier with a preset identifier set to determine the processor type corresponding to the processor identifier of the local processor, and then writes the second flag bit corresponding to the processor type of the local processor to a preset path. The processor identifier may include at least one of, but is not limited to, a processor identifier, a processor name, a processor model, etc. The above-mentioned preset identifier set may include the processor identifiers corresponding to multiple processors integrated with a media access control layer. That is, if the processor identifier of the local processor matches a certain identifier in the preset representation set, it can be determined that the local processor is a processor integrated with a media access control layer; otherwise, it can be determined that the local processor is a processor not integrated with a media access control layer.
[0111] Referring to Figure 3 , Figure 3 FIG. shows a schematic diagram of loading a target service provided by an embodiment of the present application. As Figure 3 shown, the target service (such as stmmac-config.service) can be pre-installed in the operating system and configured to start automatically when the computer boots up. When the computer boots up, the Basic Input Output System (BIOS) program is first executed, and the operating system kernel (Operating System Kernel, OSKernel) is loaded by the basic input output system program. The operating system kernel loads and initializes the system (such as init, systemd, etc.). After the initialization system is loaded, it loads each service in the service queue that includes the target service one by one (for example, the service queue may include other service 1, other service 2, the target service, etc.). After the target service runs, a processor information acquisition process is generated, and the processor information acquisition process obtains the processor identifier of the local processor.
[0112] In an embodiment of the present application, the preset identifier set can be implemented in the above-mentioned processor information acquisition process. After the processor information acquisition process obtains the processor identifier, it can determine the processor type corresponding to the processor identifier based on the preset identifier set, and thus determine the second flag bit corresponding to the processor type.
[0113] Further, to improve the writing efficiency of the second flag bit, when it is determined that the processor type of the local processor is integrated with the media access control layer, the corresponding second flag bit can be written to the preset path; while when the processor type of the local processor is not integrated with the media access control layer, the preset path does not include the second flag bit. Thus, when the processor type is not integrated with the media access control layer, it is possible to determine whether the second flag bit in the preset path matches the second preset value only by detecting whether the second flag bit exists in the preset path without performing the second flag bit writing operation. This helps to further improve the running efficiency of this solution.
[0114] Referring Figure 4 , Figure 4 shows a schematic diagram of second flag bit processing provided by an embodiment of the present application. As Figure 4 shown, the processor information acquisition process first reads the local processor information and parses it to obtain the processor identifier; then determines whether the second flag bit corresponding to the processor identifier can be matched in the preset identifier set; if the processor identifier of the local processor can be matched in the preset identifier set, it can be determined whether there is a first file recording the second flag bit in the preset path. If the first file does not exist in the preset path, a first file is created in the preset path and the second flag bit corresponding to the local processor is recorded in the first file. If the first file exists in the preset path, it means that there is already a first file containing the second flag bit corresponding to the local processor in the preset path, and the processor information acquisition process can be directly ended. If the processor identifier of the local processor cannot be matched in the preset identifier set, it means that the processor type of the local processor is not integrated with the media access control layer. It can be determined whether there is a first file recording the second flag bit in the preset path. If the first file exists in the preset path, the first file is deleted and then the processor information acquisition process is ended. If the first file does not exist in the preset path, the processor information acquisition process is ended.
[0115] In an alternative embodiment of the present application, the determining the device access status corresponding to the media access control layer may include:
[0116] Step S21, obtaining the physical layer device information connected to the media independent interface corresponding to the media access control layer;
[0117] Step S22, when the physical layer device information is empty, determining that the device access status corresponding to the media access control layer is not accessed;
[0118] Step S23, when the physical layer device information is not empty, determining the device access status corresponding to the media access control layer based on the physical layer device information.
[0119] In an embodiment of the present application, after determining that the device type of the media access control layer corresponding to the currently processed driver loading request is an integrated device, in order to further determine the device access status of the media access control layer, the device access status corresponding to the media access control layer can be determined by obtaining the physical layer device information connected to the media access control layer. Among them, the physical layer device information connected to the media access control layer may include at least one of, but is not limited to, a physical layer device identification code, a physical layer device name, and the like.
[0120] In an embodiment of the present application, since the media access control layer integrated in the local processor is connected to the corresponding physical layer transceiver through the media independent interface of the local processor, therefore, the physical layer device information connected to the media access control layer can be obtained by performing an interface scan on the media independent interface corresponding to the media access control layer.
[0121] Exemplarily, if the operating system is an operating system based on the Linux kernel, the "mdiobus_get_phy" function in the operating system can be called to perform an interface scan on the media independent interface related to the media access control layer to obtain the physical layer device information of the physical layer device connected to the media independent interface (in the Linux operating system, the physical layer device information may be a structure named phydev). It should be noted that in different operating systems, different methods can be used to obtain the physical layer device information, and the embodiments of the present application do not make specific limitations.
[0122] If the media access control layer is not connected to a device through the media independent interface, the relevant physical layer device information cannot be obtained, that is, the obtained physical layer device information is empty. Therefore, in an embodiment of the present application, when the physical layer device information corresponding to the media access control layer is empty, the device access status corresponding to the media access control layer can be determined as not accessed.
[0123] In an embodiment of the present application, if the obtained physical layer device information corresponding to the media access control layer is not empty, it indicates that the media access control layer is connected to a physical layer device through the corresponding media independent interface. However, when the media access control layer accesses the physical layer device, it is still possible to generate an unavailable physical layer device in the operating system during driver loading. For example, in the case of a physical layer device failure or disablement connected to the media access control layer, even if the driver is loaded for the media access control layer, an unavailable Ethernet device will still be generated in the operating system. Therefore, in order to further improve the accuracy of driver loading and avoid generating an unavailable Ethernet device in the system, the device access status corresponding to the media access control layer can be further determined according to the physical layer device information corresponding to the media access control layer.
[0124] In an embodiment of the present application, preset device information for indicating normal operation of a device may be pre-configured. After obtaining the physical layer device information corresponding to the media access control layer, the physical layer device information may be matched with the preset device information. If the physical layer device information matches the preset device information, it is determined that the access status of the device corresponding to the media access control layer is connected. If the physical layer device information does not match the preset device information, it may be determined that the access status of the device corresponding to the media access control layer is not connected.
[0125] In an embodiment of the present application, through the above steps S21 to S23, the access status of the device corresponding to the media access control layer may be determined based on the physical layer device information connected through the media independent interface corresponding to the media access control layer, which helps to improve the accuracy of determining the access status of the device in the media access control layer.
[0126] Further, determining the access status of the device corresponding to the media access control layer based on the physical layer device information may include:
[0127] Step S231: Based on the physical layer device information, determine the basic mode status value of the physical layer device connected to the media independent interface, and the driver information bound to the physical layer device;
[0128] Step S232: When the driver information is empty or the basic mode status value does not belong to a preset interval, determine that the access status of the device corresponding to the media access control layer is not connected;
[0129] Step S233: When the basic mode status value belongs to the preset interval and the driver information is not empty, determine that the access status of the device corresponding to the media access control layer is connected.
[0130] In an embodiment of the present application, the basic mode status value of the physical layer device connected to the media independent interface and the driver information bound to the physical layer device may be obtained from the physical layer device information. Among them, the basic mode status value is a parameter defined by the media independent interface for representing the basic state of the physical layer transceiver, and is usually stored in the Basic Mode Status Register (BMSR) of the physical layer transceiver. The basic mode status value may be composed of multiple binary bits, and different binary bits may represent different basic states through different value settings. These basic states may represent, but are not limited to, information such as working mode and whether there is an error. The driver information bound to the physical layer device may be used to represent the information of the device driver bound to the physical layer device in the operating system. This driver information enables the operating system and the computer to correctly identify and operate the corresponding physical layer device, so that the physical layer device can function properly.
[0131] In an embodiment of the present application, in the case that the obtained physical layer device information does not include the basic mode status value and / or driver information of the physical layer device, the corresponding basic mode status value and / or driver information can also be obtained based on information such as the physical layer device identification code in the physical layer device information.
[0132] Exemplarily, if the operating system is Linux, the obtained physical layer device information may include a physical layer device identifier (phyid). The basic mode status register of the physical layer device corresponding to the physical layer device identifier can be read through a physical layer device reading function (phy_read function) to obtain the corresponding basic mode status value. The driver information bound to the physical layer device is included in the physical layer device information (phydev structure). The phydev->drv field in the phydev structure can be directly obtained to obtain the driver pointer corresponding to the physical layer device, and then the driver information corresponding to the physical layer device information can be obtained based on the driver pointer.
[0133] In an embodiment of the present application, after obtaining the driver information corresponding to the physical layer device connected to the media access control layer, it can be determined whether the driver information is empty. If the driver information is empty, it means that there is no available driver for the physical layer device connected to the media access control layer in the operating system, and the operating system cannot be normally called. Then, it can be determined that the access status of the device corresponding to the media access control layer is not connected, so as to avoid driver loading for the media access control layer and avoid generating unusable Ethernet devices. If the driver information is not empty, the basic mode status value can be further compared with a preset interval to determine the inclusion relationship between the basic mode status value and the preset interval. If the basic mode status value does not belong to the preset interval, it means that the corresponding physical layer device is in an unavailable state. At this time, it can be determined that the access status of the device corresponding to the media access control layer is not connected, so as to avoid driver loading for the media access control layer and avoid generating unusable Ethernet devices.
[0134] In an embodiment of the present application, the above preset interval may include all basic mode status values indicating that the physical layer device can be used normally. Different preset intervals can be configured for different operating environments. Exemplarily, if the operating system is a Linux system, the preset interval can be set to (0, +∞).
[0135] It should be noted that in the above judgment process, it can be determined first whether the driver information is empty, or it can be determined first whether the basic mode status value belongs to the preset interval, or it can be determined in parallel. The embodiments of the present application do not make specific limitations.
[0136] In the embodiment of the present application, if the basic mode status value belongs to a preset interval, it indicates that the corresponding physical layer device is in an unavailable state. If the driver information is not empty, it indicates that the physical layer device connected to the corresponding media access control layer has an available driver in the operating system. Therefore, when the basic mode status value belongs to the preset interval and the driver information is not empty, it can be determined that the access status of the device corresponding to the media access control layer is connected.
[0137] Further, before performing step S231, the physical layer device identifier (phy_id) corresponding to the corresponding physical layer device can be obtained from the physical layer device information, and it is determined whether the physical layer device identifier is empty. If the physical layer device identifier is empty, it indicates that the physical layer device is not correctly identified or loaded, and it can be directly determined that the access status of the device corresponding to the corresponding media access control layer is not connected, thereby avoiding performing steps S231 to S233 and improving the recognition efficiency of the device access status. If the physical layer device identifier is not empty, then jump to step S231 for execution.
[0138] In the embodiment of the present application, through the above steps S231 to S233, it is possible to detect the access status of the device corresponding to the media access control layer from multiple dimensions of the basic mode status and the driver information, which helps to improve the detection accuracy of the device access status.
[0139] Further, after determining the device type corresponding to the media access control layer, it may further include:
[0140] Writing the device type corresponding to the media access control layer into the device structure corresponding to the media access control layer in the media access control layer driver, so that when the device type in the device structure is an integrated device, the step of determining the access status of the device corresponding to the media access control layer is executed.
[0141] In the embodiment of the present application, when the media access control layer driver performs driver loading for the media access control layer, it relies on the corresponding device structure in the media access control layer driver. The hardware details corresponding to the corresponding media access control layer are defined in the device structure. Different media access control layers may correspond to different device structures. Exemplarily, in the STMMAC driver, the device structure is struct stmmac_priv.
[0142] In the embodiments of the present application, after obtaining the device type corresponding to the media access control layer, the device type can be written into the device structure corresponding to the corresponding media access control layer. The device structure is located in the media access control layer driver. When the media access control layer driver loads the driver for the media access control layer, it can obtain the device type of the media access control layer based on the corresponding device structure and adopt different driver loading logics for different device types. If the media access control layer driver determines that the device type is an independent device through the device structure, it can continue to run using the conventional driver loading logic to load the driver for the corresponding media access control layer. If the media access control layer driver determines that the device type is an integrated device through the device structure, the media access control layer driver can first execute the process of determining the device access status. When the media access control layer driver determines that the device access status is connected, it can continue to run using the conventional driver loading logic to load the driver for the corresponding media access control layer. When the media access control layer driver determines that the device access status is not connected, the driver loading process for the corresponding media access control layer can be aborted to avoid generating unusable Ethernet devices in the operating system.
[0143] Exemplarily, if the operating system is a Linux system and the media access control layer driver is an STMMAC driver, a quirk member can be added to the device structure (struct stmmac_priv) of the STMMAC driver. The quirk member is used to record the third flag bit representing the device type corresponding to the corresponding media access control layer. The data type of the quirk member can be an unsigned integer (unsigned int), and the following device structure can be obtained:
[0144]
[0145] When STMMAC loads the driver for the media access control layer, it can read the quirk member in the corresponding device structure to obtain the third flag bit and jump to different driver loading processes according to the value of the third flag bit. For example, when the third flag bit is equal to QUIRK_NONE (indicating an independent device), the driver is directly loaded according to the conventional driver loading process. When the third flag bit is equal to QUIRK_PHY_CONNECT_CHECK (indicating an integrated device), step 102 is executed to determine the device access status corresponding to the media access control layer, and subsequent operations are performed according to the device access status.
[0146] Refer to Figure 5 , Figure 5 shows a driver loading flow chart provided by the embodiments of the present application under a Linux operating system. As Figure 5As shown, under the Linux operating system, the STMMAC driver module can be loaded through user control tools such as kmod. After the STMMAC driver is loaded, it can first read the second flag bit of the local processor. When the second flag bit indicates that the local processor integrates a media access control layer (i.e., the second flag bit matches the second preset value), in response to the vendor driver's request for loading the driver for the media access control layer by calling the external interface function of the STMMAC driver (such as stmmac_dvr_probe), the device identifier corresponding to the vendor driver that locally calls the STMMAC driver is obtained. Then, through this device identifier, the first array stmmac_quirks[] is traversed to obtain the first flag bit corresponding to the device identifier, and this first flag bit is assigned to the third flag bit of the device structure corresponding to the device identifier, thereby realizing recording the device type corresponding to the media access control layer to be loaded in the device structure of the STMMAC driver. Then the STMMAC driver continues to execute the driver loading process and enters the driver loading process based on this device structure. The STMMAC driver can read this device structure through the added device check function (such as stmmac_check_phy), detect the third flag bit therein, and determine the corresponding device access status and return the corresponding check result if it is determined that the third flag bit matches the first preset value. The STMMAC driver can judge whether to ignore the current driver loading process according to the check result. After ignoring the current driver loading process, the computer resources occupied by the current driver loading process can be released.
[0147] In the embodiments of the present application, the device type can be written into the device structure of the media access control layer driver, so that the media access control layer driver can implement this solution while maintaining the original driver loading logic, which helps to reduce the modification of the original driver loading process and improve the running stability.
[0148] In summary, the present application provides a driver loading method, which can be used to load a driver for the media access control layer in a computer. The present application can respond to a driver loading request for the media access control layer, determine the device type corresponding to the media access control layer, and when the device type is an integrated device, determine the device access status corresponding to the media access control layer. When the device access status is connected, the driver for the media access control layer is loaded to generate an Ethernet device corresponding to the media access control layer. When the device access status is not connected, the driver loading request is ignored. When loading the driver for the media access control layer, different driver loading strategies can be adopted according to the device type and device access status corresponding to the media access control layer. When the device type of the media access control layer is an integrated device and the device access status of the media access control layer is not connected, no actual driver loading is performed, so that it is possible to avoid generating unusable Ethernet devices in the operating system, enabling the system to not need to manage unusable Ethernet devices additionally, and not generating errors and faults due to calling unusable Ethernet devices, which helps to improve the management efficiency of network devices in the system and the stability of system operation.
[0149] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present application are not limited by the described action sequences, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present application.
[0150] Referring to Figure 6 , a structural block diagram of an embodiment of a driver loading device according to the present application is shown. The device includes:
[0151] A device type module 201, configured to respond to a driver loading request for the media access control layer and determine the device type corresponding to the media access control layer;
[0152] An access status module 202, configured to determine the device access status corresponding to the media access control layer when the device type is an integrated device;
[0153] A driver loading module 203, configured to load the driver for the media access control layer to generate an Ethernet device corresponding to the media access control layer when the device access status is connected; and ignore the driver loading request when the device access status is not connected.
[0154] Optionally, the device type module includes:
[0155] The device identification sub-module is used to obtain the device identification corresponding to the drive loading request;
[0156] The first flag bit sub-module is used to determine the first flag bit corresponding to the media access control layer based on the device identification;
[0157] The device type determination sub-module is used to determine that the device type corresponding to the media access control layer is an integrated device when the first flag bit matches a first preset value.
[0158] Optionally, the device further includes:
[0159] The second flag bit module is used to obtain the second flag bit of the local processor; wherein, the second flag bit is used to indicate whether the local processor includes a media access control layer with a device type of an integrated device;
[0160] The first execution module is used to execute the step of determining the device type corresponding to the media access control layer when the second flag bit matches a second preset value;
[0161] The second execution module is used to execute the step of performing drive loading on the media access control layer when the second flag bit does not match the second preset value.
[0162] Optionally, the second flag bit is written to a preset path by a target service running when the operating system is started, and the second flag bit module is further used to read the second flag bit from the preset path.
[0163] Optionally, the access status module includes:
[0164] The acquisition sub-module is used to acquire the physical layer device information connected to the media independent interface corresponding to the media access control layer;
[0165] The non-access sub-module is used to determine that the device access status corresponding to the media access control layer is non-access when the physical layer device information is empty;
[0166] The access status determination sub-module is used to determine the device access status corresponding to the media access control layer based on the physical layer device information when the physical layer device information is not empty.
[0167] Optionally, the access status determination sub-module includes:
[0168] The information determination unit is used to determine the basic mode status value of the physical layer device connected to the media independent interface and the drive information bound to the physical layer device based on the physical layer device information;
[0169] An unconnected determination unit, configured to determine that the device access status corresponding to the media access control layer is unconnected when the drive information is empty or the basic mode status value does not belong to a preset interval;
[0170] A connected determination unit, configured to determine that the device access status corresponding to the media access control layer is connected when the basic mode status value belongs to a preset interval and the drive information is not empty.
[0171] Optionally, the device further includes:
[0172] A writing module, configured to write the device type corresponding to the media access control layer into the device structure corresponding to the media access control layer in the media access control layer driver, so that when the device type in the device structure of the media access control layer driver is an integrated device, the step of determining the device access status corresponding to the media access control layer is executed.
[0173] In summary, the present application provides a driver loading device, which can be used to load a driver for the media access control layer in a computer. The present application can respond to a driver loading request for the media access control layer, determine the device type corresponding to the media access control layer, and when the device type is an integrated device, determine the device access status corresponding to the media access control layer. When the device access status is connected, load a driver for the media access control layer to generate an Ethernet device corresponding to the media access control layer. When the device access status is unconnected, ignore the driver loading request. When loading a driver for the media access control layer, different driver loading strategies can be adopted according to the device type and device access status corresponding to the media access control layer. When the device type of the media access control layer is an integrated device and the device access status of the media access control layer is unconnected, no actual driver loading is performed, so that it is possible to avoid generating unusable Ethernet devices in the operating system, enabling the system to not need to manage unusable Ethernet devices additionally, and not generating errors and failures due to calling unusable Ethernet devices, which helps to improve the management efficiency of network devices in the system and the stability of system operation.
[0174] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, refer to the partial description of the method embodiment.
[0175] Referring to Figure 7 , it is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 7As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete communication with each other through the communication bus. The memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the steps of the driver loading method in the foregoing embodiments.
[0176] An embodiment of the present application provides a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a program or a processor of a terminal, the terminal can execute the steps of the driver loading method in the foregoing embodiments.
[0177] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is the difference from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0178] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0179] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0180] These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal devices to work in a predictive manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device realizes the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0181] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one process or multiple processes and / or boxes. Figure 1 One process or multiple processes and / or boxes Figure 1 Steps for the functions specified in one box or multiple boxes.
[0182] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the element.
[0183] Specific examples are used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A driver loading method, characterized in that, The method includes: In response to a driver loading request for the media access control layer, determining the device type corresponding to the media access control layer; When the device type is an integrated device, determining the device access status corresponding to the media access control layer; When the device access status is connected, performing driver loading on the media access control layer to generate an Ethernet device corresponding to the media access control layer; When the device access status is not connected, ignoring the driver loading request.
2. The method according to claim 1, wherein The determining the device type corresponding to the media access control layer includes: Obtaining the device identifier corresponding to the driver loading request; Based on the device identifier, determining a first flag bit corresponding to the media access control layer; When the first flag bit matches a first preset value, determining that the device type corresponding to the media access control layer is an integrated device.
3. The method according to claim 1, characterized in that, The method further includes: Obtaining a second flag bit of the local processor; wherein, the second flag bit is used to indicate whether the local processor includes a media access control layer with a device type of an integrated device; When the second flag bit matches a second preset value, performing the step of determining the device type corresponding to the media access control layer; When the second flag bit does not match the second preset value, performing the step of performing driver loading on the media access control layer.
4. The method according to claim 3, wherein The second flag bit is written to a preset path by a target service running when the operating system starts. The obtaining the second flag bit of the local processor includes: Reading the second flag bit from the preset path.
5. The method according to claim 1, characterized in that The determining the device access status corresponding to the media access control layer includes: Obtaining the physical layer device information connected to the media independent interface corresponding to the media access control layer; When the physical layer device information is empty, determining that the device access status corresponding to the media access control layer is not connected; When the physical layer device information is not empty, determining the device access status corresponding to the media access control layer based on the physical layer device information.
6. The method according to claim 5, wherein The determining the device access status corresponding to the media access control layer based on the physical layer device information includes: Based on the physical layer device information, determining the basic mode status value of the physical layer device connected to the media independent interface and the driver information bound to the physical layer device; When the driver information is empty or the basic mode status value does not belong to a preset interval, determining that the device access status corresponding to the media access control layer is not connected; When the basic mode status value belongs to the preset interval and the driver information is not empty, determining that the device access status corresponding to the media access control layer is connected.
7. The method according to claim 1, characterized in that After determining the device type corresponding to the media access control layer, the method further includes: Write the device type corresponding to the media access control layer into the device structure corresponding to the media access control layer in the media access control layer driver, so that when the device type in the device structure of the media access control layer driver is an integrated device, execute the step of determining the device access status corresponding to the media access control layer.
8. A drive loading device, characterized in that, The device includes: A device type module, configured to determine the device type corresponding to the media access control layer in response to a driver loading request for the media access control layer; An access status module, configured to determine the device access status corresponding to the media access control layer when the device type is an integrated device; A driver loading module, configured to, when the device access status is connected, perform driver loading on the media access control layer to generate an Ethernet device corresponding to the media access control layer; and when the device access status is not connected, ignore the driver loading request.
9. An electronic device, characterized in that, It includes: A processor, a memory, a communication interface, and a communication bus, where the processor, the memory, and the communication interface complete communication with each other through the communication bus; The memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the steps of the driver loading method according to any one of claims 1 to 7.
10. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium, and when the program or instruction is executed by the processor, the steps of the driver loading method according to any one of claims 1 to 7 are implemented.