A control method, device, electronic device, storage medium and product for a network card
By real-time detection of data packet interaction and automatically switching network card working mode and plug-in and unplug operations, the problem of network card offline during computer board testing is solved, the testing efficiency and delivery efficiency are improved, and manual intervention is reduced.
Patent Information
- Application Number
- CN202510705569.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-05-29
AI Technical Summary
During the large-scale computer board testing, the computer board to be tested frequently offline causes PXE to be frequently offline, which cannot be discovered in time, resulting in test failure and wasted labor and time costs.
Through the control device, the data packet interaction situation is detected in real time, the network card working mode is automatically switched and the plug-in and unplugging operation is simulated, so as to realize the automatic plug-in and unplugging and working mode switching of the network card, reducing manual intervention.
It improves the efficiency of computer board testing, saves labor and time costs, improves test efficiency and delivery throughput rate, and reduces the need for manual monitoring.
Smart Images

Figure CN120238466B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of servers, and particularly to a control method, device, electronic device, storage medium and product for a network card. Background Art
[0002] In the field of computer hardware manufacturing, with the explosive growth in the demand for data centers and cloud computing devices, the production scale of computer boards such as motherboards, graphics cards, and server boards has been expanding day by day. Therefore, the testing of computer boards is particularly important. Usually, when a factory tests a computer board, it needs to connect a Universal Serial Bus (USB) network card through a network cable to perform a Preboot Execution Environment (PXE) boot test using the network.
[0003] During the large-scale computer board testing process, the computer board to be tested has the problem of frequent PXE offline. Therefore, it is necessary to manually monitor the testing situation of the computer board to be tested, and when an abnormality occurs in the test or PXE goes offline, the USB network card needs to be re-plugged. This method results in the inability to detect PXE offline in a timely manner, and even test failures, wasting human and time costs. Summary of the Invention
[0004] This application provides a control method, device, electronic device, storage medium and product for a network card, so as to at least solve the problem in the related art that during the startup test of a computer board to be tested, the network card offline cannot be detected in a timely manner, resulting in test failures and wasting human and time costs.
[0005] This application provides a control method for a network card, which is applied to a control module of a control device. The control device further includes a mirror module and a link cut-off module; one end of the control device is connected to a computer board to be tested, and the other end is connected to a network card; the method includes: detecting in real time whether there is data packet interaction in the mirror module, the data packet being a data packet sent by the computer board to be tested to the network card during the PXE boot test, and the working mode of the network card being the first working mode; when it is detected that there is no data packet interaction in the mirror module within a preset time period, detecting whether the network card in the first working mode has been plugged or unplugged; if not, sending a first cut-off instruction to the link cut-off module, and the first cut-off instruction is used to instruct the link cut-off module to perform a plugging or unplugging operation on the network card in the first working mode.
[0006] The present application also provides a control device for a network card. One end of the control device for the network card is connected to a computer board to be tested, and the other end is connected to a network card. The control device for the network card includes: a detection module, configured to detect in real time whether there is data packet interaction in an image module, where the data packet is a data packet sent by the computer board to be tested to the network card during the pre-boot execution environment startup test, and the working mode of the network card is the first working mode; the detection module is further configured to, when it is detected that there is no data packet interaction in the image module within a preset time period, detect whether the network card in the first working mode has been plugged or unplugged; a transceiver module, configured to, if not, send a first cut-off instruction to a link cut-off module, where the first cut-off instruction is used to instruct the link cut-off module to perform a plugging or unplugging operation on the network card in the first working mode.
[0007] The present application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any one of the above network card control methods when executing the computer program.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above network card control methods are implemented.
[0009] The present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of any one of the above network card control methods are implemented.
[0010] Through the present application, since it is possible to determine whether the data packet transmission between the computer board to be tested and the network card is normal during the pre-boot execution environment startup test by detecting whether there is data packet interaction in the image module, and then in the case of detecting no data packet interaction for a long time, that is, when the network card has an abnormality or is offline, the fault can be discovered in time, and the plugging or unplugging operation on the network card can be performed in time. It is impossible to manually monitor the test situation or perform plugging or unplugging processing, which improves the test efficiency of the board to be tested, saves labor costs and time costs, realizes the test of different computer boards compatible with network cards, and greatly improves the test efficiency and delivery straight-through rate while reducing manual participation in the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required for the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0012] Figure 1 It is a topological structure diagram of a network card control system provided by an embodiment of the present application;
[0013] Figure 2 It is a structural block diagram of a control device provided by an embodiment of the present application;
[0014] Figure 3 It is a schematic flowchart of a control method for a network card provided by an embodiment of the present application;
[0015] Figure 4 It is a schematic flowchart of another control method for a network card provided by an embodiment of the present application;
[0016] Figure 5 It is a structural block diagram of a control device provided by an embodiment of the present application;
[0017] Figure 6 It is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present application. Specific embodiments
[0018] 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 only a 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 creative efforts shall fall within the protection scope of the present application.
[0019] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0020] In order to enable those skilled in the art of this technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0021] In combination with the specific application environment architecture or specific hardware architecture on which the execution of the network card control method depends, the specific application environment architecture or specific hardware architecture is described herein.
[0022] The embodiments of the present application are applied to the scenario of using a USB network card for PXE boot to perform network boot testing on a computer board. Among them, the USB network card is used to support network packet processing during PXE boot.
[0023] In the related art, during the large-scale computer board testing process, it is necessary to manually monitor the testing situation of the computer board to be tested, and when an abnormality occurs in the test or the PXE goes offline, the USB network card needs to be re-plugged. This method results in the inability to detect PXE offline in a timely manner, and even test failures, wasting human and time costs. In addition, different computer boards support different working modes of the Universal Serial Bus (USB) network card. Therefore, when actually using the USB network card for PXE boot during testing, it is necessary to manually switch the working mode of the USB network card compatible with different computer boards.
[0024] To solve the above technical problems, the embodiment of the present application provides a method for controlling a network card. This method determines the situation of the computer board to be tested using the USB network card for PXE boot test based on the data packet interaction by the control device, and then switches the working mode of the network card and simulates manual plugging and unplugging. In this way, not only can the network card be automatically plugged and unplugged, but also the working mode of the network card can be switched to match the computer board to be tested, improving the test efficiency of the board to be tested and saving human and time costs.
[0025] The following takes Figure 1 the network card control system shown as an example to describe the method provided by the embodiment of the present application.
[0026] As Figure 1 shown, Figure 1 is the topological structure diagram of a network card control system provided by the embodiment of the present application. Figure 1 In it, the network card control system 100 includes a computer board 101 to be tested, a control device 102, a network card 103, and a server 104. The computer board 101 to be tested is connected to the control device 102 through a USB cable; the control device 102 is connected to the network card 103 through a USB cable. The network card 103 is connected to the server 104 through a network cable.
[0027] Among them, the computer board 101 to be tested can be a modular component with specific functions in a computer hardware system. Usually, it is carried on a printed circuit board and integrates various electronic components and integrated circuits to realize core functions such as data processing, signal transmission, and function expansion. For example, the computer board 101 to be tested can be a main control type board, an expansion type board, or a special type board.
[0028] The control device 102 can be a device with computing and communication capabilities. The control device 102 includes a control module 1021, a mirror module 1022, a link cut-off module 1023, a mode selection module 1024, a storage module 1025, and a dip switch 1026. As Figure 2 shown, Figure 2A structural block diagram of the control device provided in an embodiment of the present application; Figure 2 In the figure, the mode selection module 1024, the mirror module 1022, and the link disconnection module 1023 are connected in sequence; the control module 1021 is connected to the mode selection module 1024, the mirror module 1022, the link disconnection module 1023, and the storage module 1025 respectively; the mode selection module 1024 is also connected to the dip switch 1026.
[0029] The control module 1021 may be a Field-Programmable Gate Array (FPGA) integrated circuit, which is also called an FPGA module.
[0030] Mirror module 1022 can be a hardware device that extends the USB interface. For example, mirror module 1022 can be a universal serial bus hub. Mirror module 1022 is used to capture and distribute USB data packets through firmware. One path copies and distributes USB data packets to control module 1021, while the other path transmits data packets normally to network card 103.
[0031] The link disconnection module 1023 can be any switching integrated circuit with the function of cutting off power and restoring power. The link disconnection module 1023 is used to implement the plug-in and pull-out operations on the network card.
[0032] The mode selection module 1024 can be any channel switching integrated circuit with a selection function and uses the logic of a link switching switch. The mode selection module 1024 is used to implement the working mode switching of the network card.
[0033] The storage module 1025 can be any device with a storage function. The storage module 1025 is used to store the firmware information of the FPGA module and save the working status of the network card so that the network card can work according to the memory content when the power is off and the network card is plugged in again.
[0034] The dip switch 1026 can be a mechanical switch that can be used to manually turn on or off a circuit or set a state by manually turning a dial block. The dip switch 1026 is an externally reserved dip switch that can manually select the working mode of the network card.
[0035] Network card 103 can be a network adapter connected to a computer via a USB interface. Network card 103 is also called a USB network card. Network card 103 is also equipped with an indicator light. This indicator light is used to display an alarm signal. Network card 103 is used to receive data packets sent by the computer board under test. Network card 103 can be used to convert between the USB protocol and the Ethernet protocol.
[0036] Server 104 can be a network-based startup and deployment tool, mainly used to remotely boot computer boards through a local area network, enabling them to load an operating system or run a test program without local storage. Server 104 is also referred to as a PXE server.
[0037] Figure 1 The control system of the network card shown is only for illustration and is not intended to limit the technical solutions of this application. Those skilled in the art should understand that in the specific implementation process, the control system of the network card may also include more devices, which are not limited.
[0038] An embodiment of this application provides a method for controlling a network card, which is applied to Figure 1 the control module shown, such as Figure 3 shown, Figure 3 is a schematic flowchart of a method for controlling a network card provided by an embodiment of this application. The method for controlling the network card includes the following steps:
[0039] S301: Real-time detect whether there is data packet interaction in the mirror module.
[0040] Among them, the data packet is a data packet sent by the computer board to be tested to the network card during the pre-boot execution environment startup test.
[0041] The working mode of the network card is the first working mode.
[0042] The working modes include USB2.0 working mode or USB3.0 working mode. Among them, the maximum speed of the USB2.0 working mode is lower than that of the USB3.0 working mode. The transmission method of the USB2.0 working mode is half-duplex transmission, and the transmission method of the USB3.0 working mode is full-duplex transmission. The USB2.0 working mode is usually applicable to keyboards, mice, etc., and the USB3.0 working mode is usually applicable to external hard drives, external graphics cards, etc. The network card in the USB2.0 working mode is in a stable J / K state when idle. The network card in the USB3.0 working mode may have periodic TS1 / TS2 pulses when idle. Optionally, the working modes may also include more modes such as USB3.1 working mode or USB4.0 working mode, which are not limited.
[0043] Exemplarily, after the computer board to be tested is powered on and starts up, the computer board to be tested begins to transmit data packets to the network card. First, the computer board to be tested transmits data packets to the mode selection module through the USB interface; after receiving the data packets, the mode selection module forwards the data packets to the mirror module; after receiving the data packets, the mirror module continues to transmit the data packets to the link cut-off control module on one path, and copies and forwards the data packets to the control module on the other path; if the control module can receive the data packets forwarded by the mirror module, it is detected that there is data packet interaction in the mirror module. On the contrary, if the control module cannot receive the data packets forwarded by the mirror module, it is detected that there is no data packet interaction in the mirror module.
[0044] S302: When it is detected that there is no data packet interaction in the mirror module within a preset time period, check whether the network card in the first working mode has been plugged or unplugged.
[0045] Among them, the preset time period can be set according to actual needs. For example, the preset time period can be 180 seconds.
[0046] Exemplarily, if the control module cannot receive the data packets forwarded by the mirror module, the timing function is started. When the accumulated timing reaches 180 seconds and the control module still cannot receive the data packets forwarded by the mirror module, it is determined that there is no data packet interaction in the mirror module within the preset time period. At this time, the number of times of plugging or unplugging operations performed is read from the storage module; if the number is 0, it is determined that the network card in the first working mode has not been plugged or unplugged; if the number is not 0, it is determined that the network card in the first working mode has been plugged or unplugged.
[0047] Optionally, if the control module detects data packet interaction in the mirror module, it continues to check whether there is data packet interaction in the mirror module.
[0048] S303: If not, send the first cut-off instruction to the link cut-off module.
[0049] Among them, the first cut-off instruction is used to instruct the link cut-off module to perform plugging or unplugging operations on the network card in the first working mode.
[0050] Exemplarily, if the control module detects that the network card in the first working mode has not been plugged or unplugged, it sends the first cut-off instruction to the link cut-off module. After receiving the first cut-off instruction, the link cut-off module performs plugging or unplugging operations on the network card in the first working mode. Specifically, the link cut-off module first controls the signal cut-off of the network card, then cuts off the power supply of the network card to make the network card in a completely offline state. After a period of time, it controls the power supply connection of the network card, and then controls the signal connection of the network card to achieve the function of simulating plugging or unplugging.
[0051] It can be understood that when the control module detects that there is no data packet interaction between the mirror module, that is, when there is a compatibility offline problem between the computer board and the network card, that is, when the USB network card is in an unconnected state, the control device needs to perform a plugging and unplugging operation on the network card.
[0052] In one example, before the link cutting module performs a plugging and unplugging operation on the network card, the control module obtains the working state of the network card; and stores the working state in the storage module.
[0053] It can be understood that after the plugging and unplugging operation is performed on the network card, the control module obtains the working state from the storage module and restores the working state.
[0054] In some alternative embodiments, if the control module detects that a network card in the first working mode has performed a plugging and unplugging operation, it obtains the first plugging and unplugging count of the network card having performed the plugging and unplugging operation; if the first plugging and unplugging count is less than or equal to the first threshold, it sends a first cutting instruction to the link switching module.
[0055] Wherein, the first threshold can be set according to actual needs. For example, the first threshold can be 10 times.
[0056] Optionally, if the first plugging and unplugging count is greater than the first threshold, the control module sends a first selection instruction to the mode selection module.
[0057] Wherein, the first selection instruction is used to instruct the mode selection module to switch the working mode of the network card from the first working mode to the second working mode.
[0058] It can be understood that if the first working mode is the USB2.0 working mode, then the second working mode is the USB3.0 working mode. If the first working mode is the USB3.0 working mode, then the second working mode is the USB2.0 working mode. If the network card can work for a period of time after being plugged and unplugged multiple times in the first working mode, but then cannot work after a period of time, and this state persists multiple times, it will be determined that there is a compatibility problem with the current USB protocol, and then the network card needs to be switched to the second working mode.
[0059] In some alternative embodiments, after the mode selection module switches the working mode of the network card from the first working mode to the second working mode, the control module sends a second cutting instruction to the link cutting module.
[0060] Wherein, the second cutting instruction is used to instruct the link cutting module to perform a plugging and unplugging operation on the network card in the second working mode.
[0061] It can be understood that at this time, the second cutting instruction is used to make the second working mode effective. Therefore, at this time, the link cutting module performs a plugging and unplugging operation on the network card in the second working mode, which is not counted in the plugging and unplugging count of the network card having performed the plugging and unplugging operation.
[0062] In some alternative embodiments, when the network card is in the second working mode, the control module continues to detect whether there is packet interaction in the mirroring module; when it is detected that there is no packet interaction in the mirroring module within a preset time period, it is detected whether the network card in the second working mode has been plugged or unplugged; if not, a second cut-off instruction is sent to the link cut-off module.
[0063] Optionally, if the control module detects that the network card in the second working mode has been plugged or unplugged, the second plugging / unplugging times when the network card has been plugged or unplugged are obtained; if the second plugging / unplugging times are less than or equal to the first threshold, a second cut-off instruction is sent to the link switching module.
[0064] In some alternative embodiments, if the second plugging / unplugging times are greater than the first threshold, the control module sends a second selection instruction to the mode selection module.
[0065] Wherein, the second selection instruction is used to instruct the mode selection module to switch the working mode of the network card from the second working mode back to the first working mode.
[0066] In one example, the working mode of the network card is switched from the first working mode to the second working mode and then switched back from the second working mode to the first working mode, which is recorded as one mode switching round.
[0067] In some alternative embodiments, the control module obtains the number of mode switching rounds; when the control module detects that there is no packet interaction in the mirroring module within a preset time period and the number is greater than the second threshold, it is determined that the network card has an irreparable error.
[0068] Wherein, the second threshold can be set according to actual needs. For example, the second threshold can be 2 times.
[0069] Optionally, after the control module determines that the network card has an irreparable error, an alarm message is sent to the network card. Wherein, the alarm message is used to instruct the network card to display an alarm signal. The alarm signal can be displayed on the indicator light of the network card. For example, the indicator light of the network card is displayed in red.
[0070] It can be understood that when the number of mode switching rounds executed by the network card reaches the second threshold, it indicates that the packets between the network card and the computer board to be tested in different working modes cannot be normally transmitted. At this time, it is determined that the network card has an irreparable error, and an alarm message needs to be sent to prompt the tester to perform fault recovery on the network card.
[0071] In some alternative embodiments, when the control module detects that there is no packet interaction in the mirroring module within a preset time period and the number is less than or equal to the second threshold, a third selection instruction is sent to the mode selection module.
[0072] Among them, the third selection instruction is used to instruct the mode selection module to switch the working mode of the network card.
[0073] Optionally, the control module receives a transmission request from the server; obtains a first weight value for the amount of transmitted data, a second weight value for the expected transmission duration, and a third weight value for the expected device power consumption value; determines, according to the amount of transmitted data, the expected transmission duration, and the expected device power consumption limit of the data packet to be transmitted, the degree to which each mode in multiple modes meets the amount of transmitted data, the maximum value of the degree to which all modes meet the amount of data, the degree to which each mode meets the transmission duration, the maximum value of the degree to which all modes meet the transmission duration, the degree to which the power consumption of each mode is within the limit, and the maximum value of the degree to which all modes have power consumption within the limit; determines the score of each mode according to the degree to which each mode in multiple modes meets the amount of transmitted data, the maximum value of the degree to which all modes meet the amount of data, the first weight value, the degree to which each mode meets the transmission duration, the maximum value of the degree to which all modes meet the transmission duration, the second weight value, the degree to which the power consumption of each mode is within the limit, the maximum value of the degree to which all modes have power consumption within the limit, and the third weight value; and determines the mode with the highest score as the target mode.
[0074] Among them, the transmission request carries the amount of transmitted data, the expected transmission duration, and the expected device power consumption limit of the data packet to be transmitted.
[0075] Among them, the control module determines the score of each mode based on a preset formula according to the degree to which each mode in multiple modes meets the amount of transmitted data, the maximum value of the degree to which all modes meet the amount of data, the first weight value, the degree to which each mode meets the transmission duration, the maximum value of the degree to which all modes meet the transmission duration, the second weight value, the degree to which the power consumption of each mode is within the limit, the maximum value of the degree to which all modes have power consumption within the limit, and the third weight value.
[0076] The preset formula can be: .
[0077] Among them, is the score of each mode. is the maximum value of the degree to which all modes meet the amount of data; is the maximum value of the degree to which all modes meet the transmission duration; is the maximum value of the degree to which all modes have power consumption within the limit.
[0078] is the first weight value; is the second weight value; is the third weight value. The sum of the first weight value, the second weight value, and the third weight value is 1.
[0079] is the degree to which each mode meets the amount of transmitted data; The degree to which each mode meets the transmission duration; The degree to which the power consumption of each mode is within the limit.
[0080] Among them, the degree to which each mode meets the amount of transmitted data satisfies . Among them, is the amount of transmitted data, is the expected transmission duration, is the transmission rate of each mode.
[0081] The degree to which each mode meets the transmission duration satisfies . Among them, . and are respectively the longest duration and the shortest duration of the amount of transmitted data for all modes. is the duration required for each mode to transmit the amount of data.
[0082] The degree to which the power consumption of each mode is within the limit satisfies . Among them, is the expected device power consumption limit; is the power consumption limit of each mode; is the minimum power consumption limit among all modes.
[0083] Optionally, after determining the target mode, the control module sends a selection instruction to the mode selection module, so that the mode selection module switches the working mode of the network card to the target mode.
[0084] It can be understood that for common USB working modes such as USB2.0 (high-speed mode, theoretical maximum transmission rate 480 Mbps), USB3.0 (super high-speed mode, theoretical maximum transmission rate 5 Gbps), USB3.1 (further improved transmission rate, USB3.1 Gen1 is USB3.0, USB3.1 Gen2 theoretical maximum transmission rate 10 Gbps), USB3.2 (up to 20 Gbps), and USB4 (up to 40 Gbps), etc., and there are also different power supply modes such as USB PD (power transmission) mode, etc. Different modes have differences in aspects such as transmission speed and power support. Therefore, the control module can comprehensively consider the degree to which each mode in multiple modes meets the amount of transmitted data, the maximum value of the degree of meeting the amount of data in all modes, the first weight value of the amount of transmitted data, the degree to which each mode meets the transmission duration, the maximum value of the degree of meeting the transmission duration in all modes, the second weight value of the transmission duration, the degree to which each mode's power consumption is within the limit, the maximum value of the degree of power consumption within the limit in all modes, and the third weight value of the power consumption limit, to determine the score of each mode, so that the determined target mode better matches the computer board to be tested and improves the test efficiency.
[0085] Based on Figure 3 the method shown in the figure, the control module detects in real time whether there is data packet interaction in the mirror module, and when it detects that there is no data packet interaction in the mirror module within a preset time period, it detects whether the network card in the first working mode has been plugged or unplugged; and if the network card has not been plugged or unplugged, it sends a first cut-off instruction to the link cut-off module to perform a re-plugging operation on the network card.
[0086] Since it is possible to judge whether the data packet transmission between the computer board to be tested and the network card is normal when the pre-boot execution environment of the computer board to be tested is started by detecting whether there is data packet interaction in the mirror module, it is possible to detect a failure in time when there is no data packet interaction for a long time, that is, when the network card is abnormal or offline, and perform a plugging and unplugging operation on the network card in time. It is impossible to manually monitor the test situation or perform plugging and unplugging processing, which improves the test efficiency of the board to be tested, saves labor costs and time costs, realizes the test of different computer boards compatible with network cards, and greatly improves the test efficiency and delivery straight-through rate while reducing manual participation in the test.
[0087] An embodiment of the present application provides another method for controlling a network card, as Figure 4 shown Figure 4 is a schematic flowchart of another method for controlling a network card provided by an embodiment of the present application. The method for controlling the network card includes the following steps:
[0088] S401: Power on and boot the computer board to be tested.
[0089] S402: Detect in real time whether there is data packet interaction in the mirror module.
[0090] For details, please refer to Figure 3 step S301 of the embodiment shown, which will not be elaborated here.
[0091] S403: If so, maintain the current state and continue to detect.
[0092] S404: If it is detected that there is no data packet interaction in the mirror module, it is detected whether the time when there is no data packet interaction in the mirror module is greater than a preset time period. If not, continue to detect whether there is data packet interaction in the mirror module.
[0093] S405: If so, detect whether the network card has been plugged or unplugged.
[0094] Among them, for S403 to S405, please refer to Figure 3 step S302 of the embodiment shown, which will not be elaborated here.
[0095] S406: If the network card has not been plugged or unplugged, send a cut-off instruction to the link cut-off module to perform a plugging and unplugging operation on the network card.
[0096] S407: If so, detect whether the number of times the network card is plugged and unplugged is greater than the first threshold. If not, execute S406.
[0097] S408: If the number of times the network card is plugged and unplugged is greater than the first threshold, detect whether the mode polling count is greater than the second threshold.
[0098] S409: If not, send a selection command to the mode selection module to switch the working mode of the network card.
[0099] S410: If the mode polling count is greater than the second threshold, determine that an irreparable error has occurred in the network card, and the indicator light of the network card shows a red light.
[0100] Among them, for details of S406 to S410, please refer to Figure 3 Step S303 of the embodiment shown, which will not be elaborated here.
[0101] It can be understood that the control module can automatically switch the working mode of the USB network card and simulate the function of automatically plugging and unplugging the USB network card, which can solve the problem of unstable connection of the USB network card caused by project compatibility during the production process. In addition, when problems such as frequent offline and accidental offline of the computer board to be tested occur, there is no need to wait for manual inspection to find the abnormality and then deal with it, which greatly reduces the monitoring work of engineers. At the same time, there is no need for the monitoring personnel to notify the on-site workers for on-site operations, reducing the operations of the production line workers. When the computer board to be tested is under pressure testing, it often takes more than 48 hours. Therefore, during the production of the computer board to be tested, if the PXE offline is not discovered in time, it often delays several hours. Especially during the night pressure testing, it even delays dozens of hours. For the computer board to be tested with poor compatibility and prone to frequent PXE offline problems, it will seriously affect the operation and delivery. Therefore, the control module's timely automatic switching of the working mode of the USB network card and the function of simulating the automatic plugging and unplugging of the USB network card can greatly improve the delivery efficiency.
[0102] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0103] The embodiment of the present application also provides a control device, as Figure 5 shown, Figure 5 is a structural block diagram of a control device provided by an embodiment of the present application; one end of the control device of the network card is connected to the computer board to be tested, and the other end is connected to the network card; the control device of the network card includes:
[0104] The detection module 501 is used to detect in real time whether there is data packet interaction in the mirror module. The data packet is the one sent by the network card when the computer board to be tested performs a pre-boot execution environment startup test, and the working mode of the network card is the first working mode.
[0105] The detection module 501 is further used to detect whether the network card in the first working mode has been plugged or unplugged when it is detected that there is no data packet interaction in the mirror module within a preset time period.
[0106] The transceiver module 502 is used to, if not, send a first cut-off instruction to the link cut-off module. The first cut-off instruction is used to instruct the link cut-off module to perform a plugging or unplugging operation on the network card in the first working mode.
[0107] In some optional embodiments, the detection module 501 is further used to, if it is detected that the network card in the first working mode has been plugged or unplugged, obtain the first plugging or unplugging times of the network card; the transceiver module 502 is further used to, if the first plugging or unplugging times is less than or equal to the first threshold, send a first cut-off instruction to the link switching module.
[0108] In some optional embodiments, the transceiver module 502 is further used to, if the first plugging or unplugging times is greater than the first threshold, send a first selection instruction to the mode selection module. The first selection instruction is used to instruct the mode selection module to switch the working mode of the network card from the first working mode to the second working mode.
[0109] In some optional embodiments, after the mode selection module switches the working mode of the network card from the first working mode to the second working mode, the transceiver module 502 is further used to send a second cut-off instruction to the link cut-off module. The second cut-off instruction is used to instruct the link cut-off module to perform a plugging or unplugging operation on the network card in the second working mode.
[0110] In some optional embodiments, the detection module 501 is further used to detect whether there is data packet interaction in the mirror module when the working mode of the network card is the second working mode; to detect whether the network card in the second working mode has been plugged or unplugged when it is detected that there is no data packet interaction in the mirror module within a preset time period; the transceiver module 502 is further used to, if not, send a second cut-off instruction to the link cut-off module.
[0111] In some optional embodiments, the detection module 501 is further used to, if it is detected that the network card in the second working mode has been plugged or unplugged, obtain the second plugging or unplugging times of the network card; the transceiver module 502 is further used to, if the second plugging or unplugging times is less than or equal to the first threshold, send a second cut-off instruction to the link switching module.
[0112] In some alternative embodiments, the transceiver module 502 is further configured to, if the second insertion / removal count is greater than the first threshold, send a second selection instruction to the mode selection module, where the second selection instruction is used to instruct the mode selection module to switch the working mode of the network card back from the second working mode to the first working mode.
[0113] In some alternative embodiments, when the working mode of the network card switches from the first working mode to the second working mode and then back from the second working mode to the first working mode, it is recorded as one mode switching round.
[0114] In some alternative embodiments, the detection module 501 is further configured to obtain the count of mode switching rounds; when it detects that there is no data packet interaction in the mirror module within a preset time period and the count is greater than the second threshold, it determines that the network card has an irreparable error.
[0115] In some alternative embodiments, the transceiver module 502 is further configured to, when it detects that there is no data packet interaction in the mirror module within a preset time period and the count is less than or equal to the second threshold, send a third selection instruction to the mode selection module, where the third selection instruction is used to instruct the mode selection module to switch the working mode of the network card.
[0116] In some alternative embodiments, the detection module 501 is further configured to obtain the working state of the network card before the link disconnection module performs an insertion / removal operation on the network card; and store the working state in the storage module.
[0117] In some alternative embodiments, the transceiver module 502 is further configured to, after determining that the network card has an irreparable error, send an alarm message to the network card, where the alarm message is used to instruct the network card to display an alarm signal.
[0118] For the description of the features in the embodiments corresponding to the control device of the network card, reference can be made to the relevant descriptions in the embodiments corresponding to the control method of the network card, which will not be elaborated here one by one.
[0119] The embodiments of the present application further provide an electronic device, as Figure 6 shown, Figure 6 is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present application. The electronic device includes a processor 10 and a memory 20. The memory 20 stores a computer program, and the processor 10 is configured to run the computer program to execute the steps in any of the above embodiments of the network card control method.
[0120] The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the steps in any of the above embodiments of the network card control method when running.
[0121] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media that can store computer programs, such as USB flash drives, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disks, magnetic disks, or optical discs.
[0122] The embodiments of the present application also provide a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the control method of the network card.
[0123] The embodiments of the present application also provide another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the control method of the network card.
[0124] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0125] The above has introduced in detail a control method, device, electronic device, storage medium, and product of a network card provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and modifications can still be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A control method for a network card, characterized in that, A control module applied to a control device, the control device further comprising a mirroring module and a link cutting module; One end of the control device is connected to a computer board to be tested, and the other end is connected to a network card; the method includes: Real-time detecting whether there is packet interaction in the mirroring module, the packet being a packet sent by the computer board to be tested to the network card during a pre-boot execution environment startup test, and the working mode of the network card being a first working mode; When it is detected that there is no such packet interaction in the mirroring module within a preset time period, detecting whether the network card in the first working mode has been plugged and unplugged; If not, sending a first cut-off instruction to the link cutting module, the first cut-off instruction being used to instruct the link cutting module to perform the plugging and unplugging operation on the network card in the first working mode.
2. The method according to claim 1, wherein The method further includes: If it is detected that the network card in the first working mode has been plugged and unplugged, obtaining a first plugging and unplugging count of the network card having been plugged and unplugged; If the first plugging and unplugging count is less than or equal to a first threshold, sending the first cut-off instruction to the link switching module.
3. The method according to claim 2, wherein The control device further includes a mode selection module; the method further includes: If the first plugging and unplugging count is greater than the first threshold, sending a first selection instruction to the mode selection module, the first selection instruction being used to instruct the mode selection module to switch the working mode of the network card from the first working mode to a second working mode.
4. The method according to claim 3, wherein After the mode selection module switches the working mode of the network card from the first working mode to the second working mode, the method further includes: Sending a second cut-off instruction to the link cutting module, the second cut-off instruction being used to instruct the link cutting module to perform the plugging and unplugging operation on the network card in the second working mode.
5. The method according to claim 4, characterized in that, The method further includes: When the working mode of the network card is the second working mode, detecting whether there is packet interaction in the mirroring module; When it is detected that there is no such packet interaction in the mirroring module within the preset time period, detecting whether the network card in the second working mode has been plugged and unplugged; If not, sending the second cut-off instruction to the link cutting module.
6. The method according to claim 5, wherein The method further includes: If it is detected that the network card in the second working mode has been plugged and unplugged, obtaining a second plugging and unplugging count of the network card having been plugged and unplugged; If the second plugging and unplugging count is less than or equal to the first threshold, sending the second cut-off instruction to the link switching module.
7. The method according to claim 6, wherein The method further includes: If the second plugging and unplugging count is greater than the first threshold, sending a second selection instruction to the mode selection module, the second selection instruction being used to instruct the mode selection module to switch the working mode of the network card from the second working mode back to the first working mode.
8. The method according to claim 7, characterized in that, The working mode of the network card switching from the first working mode to the second working mode and then back from the second working mode to the first working mode is recorded as one mode switching round.
9. The method according to claim 8, wherein The method further includes: Obtaining the count of the mode switching rounds; When it is detected that there is no data packet interaction of the mirror module within the preset time period and the number of times is greater than the second threshold, it is determined that there is an irreparable error in the network card.
10. The method according to claim 9, wherein The method further includes: When it is detected that there is no data packet interaction of the mirror module within the preset time period and the number of times is less than or equal to the second threshold, a third selection instruction is sent to the mode selection module, and the third selection instruction is used to instruct the mode selection module to switch the working mode of the network card.
11. The method according to claim 1, wherein The control device further includes a storage module, and the method further includes: Before the link disconnection module performs the plugging and unplugging operation on the network card, obtain the working state of the network card; Store the working state in the storage module.
12. The method according to claim 9, characterized in that The method further includes: After it is determined that there is an irreparable error in the network card, an alarm message is sent to the network card, and the alarm message is used to instruct the network card to display an alarm signal.
13. An electronic device, characterized in that, It includes: A memory for storing a computer program; A processor for implementing the steps of the control method of the network card according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the control method of the network card according to any one of claims 1 to 12 when executed by a processor.
15. A computer program product, comprising a computer program, characterized in that, The computer program implements the steps of the control method of the network card according to any one of claims 1 to 12 when executed by a processor.
Citation Information
Patent Citations
Test box for board card and complete machine diagnosis test
CN110647431A
Network card pressure measurement method, device and equipment based on network card mode and medium
CN118449895A