A network card type identification method, device and equipment and storage medium
Patent Information
- Application Number
- CN202311257344.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-09-26
AI Technical Summary
[0004]然而,随着需要适配的网卡数量越来越多,数组容量也越来越大,并且排列混乱,对于后续开发也增加了难度,确定网卡类型所需要的时间复杂度和空间复杂度也将越来越大,从而降低了网卡识别效率,另外,随着网卡类型的持续增多,数组的维护成本也将逐渐增大,并且,识别时间过长会造成系统开机后网卡信息等显示过慢,影响了用户的使用体验以及网卡在服务器中使用的性能要求
[0045]可见,本申请先获取待识别目标网卡的资产信息得到目标资产信息;其中,所述目标资产信息中包括所述目标网卡的设备标识符、厂商标识符和子系统识别码,然后基于所述目标资产信息中的所述目标网卡的设备标识符从预先创建的多个网卡类型数组中确定所述目标网卡对应的目标网卡类型数组;其中,不同的所述网卡类型数组对应不同的设备标识符,接着查找所述目标网卡类型数组中是否存在与所述目标网卡的厂商标识符相同的标识符,如果所述目标网卡类型数组中存在与所述目标网卡的厂商标识符相同的标识符,则将所述目标网卡类型数组中与所述目标网卡的厂商标识符对应的网卡类型作为所述目标网卡的网卡类型,得到目标网卡类型,如果所述目标网卡类型数组中不存在与所述目标网卡的厂商标识符相同的标识符,则查找所述目标网卡类型数组中是否存在与所述目标网卡的子系统识别码相同的识别码,如果所述目标网卡类型数组中存在与所述目标网卡的子系统识别码相同的识别码,则将所述目标网卡类型数组中与所述目标网卡的子系统识别码对应的网卡类型作为所述目标网卡的网卡类型,得到目标网卡类型。本申请通过设备标识符对网卡类型数组进行划分得到多个网卡类型数组,在对网卡类型进行识别时,先根据目标网卡的设备标识符确定出与目标网卡对应的目标网卡类型数组,然后基于目标网卡的厂商标识符和子系统识别码从目标网卡类型数组中确定出目标网卡的网卡类型,相对于传统的同时对设备标识符、厂商标识符、子系统厂商识别码和子系统设备识别码四个参数进行比对,本申请只需对厂商标识符和子系统识别码进行逐一比对,由于减少了比对的参数,因此能够大大降低网卡识别时数组查询的数量,提高网卡的识别效率,另外,由于对数组进行了分类,因此减小了单个数组的数据量,便于后期数组的维护。
Smart Images

Figure CN117290001B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for identifying network interface card (NIC) types. Background Technology
[0002] With the rapid development of servers and the diversification of usage scenarios, more and more functions need to be integrated into servers, and more and more components also need to be adapted to increase selectivity. These adaptations of different functions and components continuously improve the user experience of servers and meet the needs of more and more scenarios. For example, OCP (Open Compute Project) network interface cards (NICs) are a very common component in servers. Due to their advantages such as easy installation, high scalability, and form factor, their use is becoming more and more widespread, and the types of NICs are also constantly increasing.
[0003] Currently, network cards (NICs) on servers are typically identified through the BMC (Baseboard Management Controller). The specific identification process is as follows: After the server boots up, the BIOS (Basic Input Output System) first sends the NIC asset information to the BMC. Then, the BMC compares the information transmitted by the BIOS with the NIC information in a pre-stored array to determine the selected NIC type. Further, it determines whether the NIC supports NCSI (Network Controller Sideband Interface, a protocol defined for communication between the main controller's management controller and the NIC), the method of obtaining NIC information, and the NIC name. Finally, based on the determined acquisition method, it reads the corresponding NIC's register temperature for later heat dissipation control.
[0004] However, as the number of network cards that need to be adapted increases, the array capacity also becomes larger and more disordered, which increases the difficulty of subsequent development. The time and space complexity required to determine the network card type will also increase, thereby reducing the network card identification efficiency. In addition, as the number of network card types continues to increase, the maintenance cost of the array will also gradually increase. Furthermore, excessively long identification time will cause the display of network card information after the system boots up to be too slow, affecting the user experience and the performance requirements of the network card used in the server.
[0005] In summary, how to quickly identify different types of network interface cards (NICs) is a problem that still needs to be further solved in this field. Summary of the Invention
[0006] In view of this, the purpose of this application is to provide a network interface card (NIC) type identification method, apparatus, device, and storage medium, which can significantly reduce the number of array queries during NIC identification, improve NIC identification efficiency, and facilitate subsequent array maintenance. The specific solution is as follows:
[0007] Firstly, this application discloses a method for identifying network interface card (NIC) types, including:
[0008] The asset information of the target network interface card to be identified is obtained to obtain the target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identifier of the target network interface card;
[0009] Based on the device identifier of the target network card in the target asset information, the target network card type array corresponding to the target network card is determined from multiple pre-created network card type arrays; wherein, different network card type arrays correspond to different device identifiers;
[0010] Check if there exists an identifier in the target network interface card type array that is the same as the manufacturer identifier of the target network interface card;
[0011] If there is an identifier in the target network interface card (NIC) type array that is the same as the manufacturer identifier of the target NIC, then the NIC type corresponding to the manufacturer identifier of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, and the target NIC type is obtained.
[0012] If there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then search for an identifier in the target network card type array that is the same as the subsystem identifier of the target network card.
[0013] If there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card, then the network card type corresponding to the subsystem identification code of the target network card in the target network card type array is taken as the network card type of the target network card, and the target network card type is obtained.
[0014] Optionally, the subsystem identification code includes a subsystem manufacturer identification code and a subsystem device identification code;
[0015] Accordingly, if the target network interface card (NIC) type array contains an identification code that is identical to the subsystem identification code of the target NIC, then the NIC type corresponding to the subsystem identification code of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, including:
[0016] If there is an identification code in the target network card type array that is the same as the subsystem manufacturer identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem manufacturer identification code of the target network card shall be used as the network card type of the target network card;
[0017] If there is an identification code in the target network card type array that is the same as the subsystem device identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem device identification code of the target network card is taken as the network card type of the target network card.
[0018] Optionally, before obtaining the asset information of the target network interface card to be identified, the process further includes:
[0019] Collect asset information of different types of network interface cards (NICs) to obtain historical asset information; the historical asset information includes the device identifier, manufacturer identifier, and subsystem identification code of each of the different types of NICs.
[0020] The historical asset information is sent to the baseboard management controller via the basic input / output system.
[0021] The historical asset information is classified according to different device identifiers by the baseboard management controller to obtain multiple classified asset information;
[0022] Based on the asset information after each classification, create corresponding network card type arrays for each of the different types of network cards to obtain multiple network card type arrays;
[0023] All network interface card (NIC) type arrays are stored in the electrically erasable programmable read-only memory (EEPROM) of the motherboard;
[0024] Accordingly, determining the target network interface card (NIC) type array corresponding to the target NIC from a pre-created array of multiple NIC type arrays based on the device identifier of the target NIC in the target asset information includes:
[0025] Read all the network interface card (NIC) type arrays from the electrically erasable programmable read-only memory, and determine the target NIC type array corresponding to the target NIC from a plurality of pre-created NIC type arrays based on the device identifier of the target NIC in the target asset information.
[0026] Optionally, after creating corresponding network interface card (NIC) type arrays for each of the different types of NICs based on the classified asset information, and obtaining multiple NIC type arrays, the method further includes:
[0027] Determine the device identifier corresponding to each of the classified asset information;
[0028] The corresponding network interface card (NIC) type arrays are named according to the naming convention of the device identifiers corresponding to the classified asset information, so as to obtain the array name corresponding to each NIC type array.
[0029] Optionally, determining the target network interface card (NIC) type array corresponding to the target NIC from a pre-created array of multiple NIC type arrays based on the device identifier of the target NIC in the target asset information includes:
[0030] Check whether the array name corresponding to the multiple pre-created network interface card type arrays contains the device identifier from the target asset information;
[0031] If the array name corresponding to multiple network interface card (NIC) type arrays contains the device identifier from the target asset information, then the corresponding NIC type array is used as the target NIC type array for the target NIC.
[0032] Optionally, the network interface card (NIC) type identification method further includes:
[0033] Determine whether the target network card supports the network controller sideband interface communication mode;
[0034] If the target network card supports the network controller sideband interface communication mode, then the temperature information acquisition method and feature information of the target network card are determined, and the temperature information of the target network card is acquired through the temperature information acquisition method and the feature information.
[0035] Optionally, the temperature information acquisition method can be any one of the following: a first information acquisition method based on an integrated circuit bus, a second information acquisition method based on a management component transmission protocol at the upper layer and a fast peripheral component interconnection protocol at the lower hardware interface, and a third information acquisition method based on a management component transmission protocol at the upper layer and an integrated circuit bus at the lower hardware interface.
[0036] Secondly, this application discloses a network interface card (NIC) type identification device, comprising:
[0037] The information acquisition module is used to acquire asset information of the target network card to be identified, and obtain target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identification code of the target network card;
[0038] An array determination module is used to determine the target network card type array corresponding to the target network card from a pre-created array of multiple network card type arrays based on the device identifier of the target network card in the target asset information; wherein, different network card type arrays correspond to different device identifiers;
[0039] The first search module is used to search whether there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card;
[0040] The first type determination module is used to determine the target network card type by taking the network card type corresponding to the manufacturer identifier of the target network card in the target network card type array as the network card type of the target network card if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0041] The second search module is used to search for an identifier in the target network card type array that is the same as the subsystem identifier of the target network card if there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0042] The second type determination module is used to determine the target network card type by taking the network card type corresponding to the subsystem identification code of the target network card in the target network card type array as the network card type of the target network card if there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card.
[0043] Thirdly, this application discloses an electronic device, including a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the aforementioned network card type identification method.
[0044] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned network card type identification method.
[0045] As can be seen, this application first obtains the asset information of the target network interface card (NIC) to be identified, thereby obtaining the target asset information. The target asset information includes the device identifier, manufacturer identifier, and subsystem identifier of the target NIC. Then, based on the device identifier of the target NIC in the target asset information, it determines the target NIC type array corresponding to the target NIC from multiple pre-created NIC type arrays. Different NIC type arrays correspond to different device identifiers. Next, it checks whether there exists an identifier in the target NIC type array that is identical to the manufacturer identifier of the target NIC. If there is an identifier in the target NIC type array that is identical to the manufacturer identifier of the target NIC... If the target network interface card (NIC) type is determined by the identifier, the NIC type corresponding to the manufacturer identifier of the target NIC in the target NIC type array is used as the NIC type of the target NIC. If no identifier matching the manufacturer identifier exists in the target NIC type array, then an identifier matching the subsystem identifier of the target NIC is searched in the target NIC type array. If an identifier matching the subsystem identifier exists in the target NIC type array, then the NIC type corresponding to the subsystem identifier of the target NIC in the target NIC type array is used as the NIC type of the target NIC. This application divides the network interface card (NIC) type array into multiple NIC type arrays by using device identifiers. When identifying the NIC type, the target NIC type array corresponding to the target NIC is first determined based on the device identifier of the target NIC. Then, the NIC type of the target NIC is determined from the target NIC type array based on the manufacturer identifier and subsystem identifier of the target NIC. Compared with the traditional method of comparing four parameters simultaneously—device identifier, manufacturer identifier, subsystem manufacturer identifier, and subsystem device identifier—this application only needs to compare the manufacturer identifier and subsystem identifier one by one. Since the number of parameters to be compared is reduced, the number of array queries during NIC identification can be greatly reduced, improving the efficiency of NIC identification. In addition, since the arrays are classified, the data volume of a single array is reduced, which facilitates the maintenance of the arrays in the later stages. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0047] Figure 1 This is a flowchart of a network interface card (NIC) type identification method disclosed in this application;
[0048] Figure 2This is a flowchart of a specific network interface card (NIC) type identification method disclosed in this application;
[0049] Figure 3 This is a schematic diagram of the structure of a network card type identification device disclosed in this application;
[0050] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0052] This application discloses a method for identifying network interface card (NIC) types. See also... Figure 1 As shown, the method includes:
[0053] Step S11: Obtain the asset information of the target network card to be identified, and obtain the target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identification code of the target network card.
[0054] In this embodiment, when it is necessary to identify the network card type of a target network card, such as an OCP (Open Compute Project) network card or a PCIe (peripheral component interconnect express) network card, the asset information of the target network card to be identified is first obtained. Specifically, the asset information may include the device identifier (Device ID), vendor identifier (Vendor ID), and subsystem identifier (SDID) of the target network card to be identified. The subsystem identifier includes, but is not limited to, the subsystem vendor identifier (SVID) and the subsystem device identifier (SDID).
[0055] Step S12: Based on the device identifier of the target network card in the target asset information, determine the target network card type array corresponding to the target network card from a plurality of pre-created network card type arrays; wherein, different network card type arrays correspond to different device identifiers.
[0056] In this embodiment, after obtaining the asset information of the target network interface card (NIC) to be identified, the target NIC type array corresponding to the target NIC can be directly determined from multiple pre-created NIC type arrays based on the device identifier of the target NIC contained in the target asset information. It should be noted that different NIC type arrays correspond to different device identifiers (i.e., Device IDs).
[0057] In this embodiment, before obtaining the asset information of the target network interface card (NIC) to be identified, the method further includes: collecting asset information of different types of NICs to obtain historical asset information; the historical asset information includes the device identifier, manufacturer identifier, and subsystem identifier of each of the different types of NICs; sending the historical asset information to the baseboard management controller through the basic input / output system; classifying the historical asset information according to the different device identifiers through the baseboard management controller to obtain multiple classified asset information; creating corresponding NIC type arrays for each of the different types of NICs based on each of the classified asset information to obtain multiple NIC type arrays; and storing all the NIC type arrays in the electrically erasable programmable read-only memory (EEPROM) of the motherboard. In this embodiment, before identifying the target network card, the server can collect historical asset information of different types of network cards in advance. Then, the server sends the collected historical asset information to the Baseboard Management Controller (BMC) through the Basic Input Output System (BIOS). After receiving the historical asset information, the BMC classifies the historical asset information according to the different device identifiers (i.e., Device IDs) to obtain multiple classified asset information. Furthermore, based on each of the classified asset information, a corresponding network card type array is created for each of the different types of network cards. That is, asset information with the same Device ID is grouped into one category and recorded as an array, thus obtaining multiple network card type arrays. In addition, for the convenience of subsequent use, all the above network card type arrays can be stored in the electrically erasable programmable read-only memory (EEPROM) of the motherboard. The historical asset information may include, but is not limited to, the device identifier, manufacturer identifier, and subsystem identification code of each of the different types of network cards.
[0058] Furthermore, after creating corresponding network interface card (NIC) type arrays for each of the different types of NICs based on the categorized asset information, resulting in multiple NIC type arrays, the process may further include: determining the device identifier corresponding to each of the categorized asset information; and naming the corresponding NIC type arrays according to a naming convention that includes the device identifier corresponding to the categorized asset information, to obtain the array name corresponding to each NIC type array. For example, when the device identifier corresponding to the categorized asset information is / dev / eth0, the corresponding NIC type array can be named according to the naming format / dev / eth0+ncsi+map, thereby obtaining the corresponding array name.
[0059] Accordingly, determining the target network interface card (NIC) type array corresponding to the target NIC from a pre-created plurality of NIC type arrays based on the device identifier of the target NIC in the target asset information may specifically include: reading all the NIC type arrays from the electrically erasable programmable read-only memory (EEPROM), and determining the target NIC type array corresponding to the target NIC from the pre-created plurality of NIC type arrays based on the device identifier of the target NIC in the target asset information. That is, when performing NIC type identification, it is necessary to first read the pre-created NIC type array containing asset information for multiple different types of NICs from the EEPROM, and then determine the target NIC type array that has the same device identifier as the target NIC from the plurality of NIC type arrays based on the device identifier of the target NIC.
[0060] In one specific implementation, determining the target network interface card (NIC) type array corresponding to the target NIC from a pre-created plurality of NIC type arrays based on the device identifier of the target NIC in the target asset information may specifically include: checking whether the array names corresponding to the pre-created plurality of NIC type arrays contain the device identifier from the target asset information; if the array names corresponding to the plurality of NIC type arrays contain the device identifier from the target asset information, then the corresponding NIC type array is used as the target NIC type array of the target NIC. In this embodiment, it is possible to first check whether the array names corresponding to the pre-created plurality of NIC type arrays contain the device identifier of the target NIC in the target asset information; if the array names corresponding to the plurality of NIC type arrays contain the device identifier of the target NIC in the target asset information, then the corresponding NIC type array is used as the target NIC type array of the target NIC.
[0061] Step S13: Check if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0062] In this embodiment, after determining the target network card type array corresponding to the target network card from multiple pre-created network card type arrays, the system first searches the target network card type array to see if there is an identifier that is the same as the vendor identifier (i.e., Vendor ID) of the target network card.
[0063] Step S14: If there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then the network card type in the target network card type array that corresponds to the manufacturer identifier of the target network card is taken as the network card type of the target network card, and the target network card type is obtained.
[0064] In this embodiment, if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then the network card type corresponding to the manufacturer identifier of the target network card in the target network card type array is directly used as the network card type of the target network card, thereby obtaining the target network card type.
[0065] Step S15: If there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then check if there is an identifier in the target network card type array that is the same as the subsystem identifier of the target network card.
[0066] In this embodiment, if there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then it is possible to further search in the target network card type array for an identifier that is the same as the subsystem identifier of the target network card.
[0067] Step S16: If there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem identification code of the target network card is taken as the network card type of the target network card, and the target network card type is obtained.
[0068] In this embodiment, if there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem identification code of the target network card is taken as the network card type of the target network card, thereby obtaining the target network card type.
[0069] Furthermore, after identifying the network interface card (NIC) type of the target NIC, the process may further include: determining whether the target NIC supports the Network Controller Sideband Interface (NCSI) communication mode; if the target NIC supports the NCSI communication mode, then determining the temperature information acquisition method and characteristic information of the target NIC, and acquiring the temperature information of the target NIC using the temperature information acquisition method and the characteristic information. In this embodiment, after identifying the NIC type, it is further possible to determine whether the target NIC supports the NCSI communication mode. If the target NIC supports the NCSI communication mode, then determining the temperature information acquisition method and characteristic information of the target NIC, and then acquiring the temperature information of the target NIC using the temperature information acquisition method and the characteristic information.
[0070] Specifically, the temperature information acquisition method can be any one of the following: a first information acquisition method based on an integrated circuit bus (I2C, Inter-Integrated Circuit); a second information acquisition method based on a management component transport protocol at the upper layer and a fast peripheral component interconnect protocol (MCTP-OVER-PCIE) at the lower hardware interface; or a third information acquisition method based on a management component transport protocol at the upper layer and an integrated circuit bus (MCTP-OVER-I2C) at the lower hardware interface.
[0071] As can be seen, this embodiment first obtains the asset information of the target network interface card (NIC) to be identified to obtain target asset information. The target asset information includes the device identifier, manufacturer identifier, and subsystem identifier of the target NIC. Then, based on the device identifier of the target NIC in the target asset information, the target NIC type array corresponding to the target NIC is determined from multiple pre-created NIC type arrays. Different NIC type arrays correspond to different device identifiers. Next, it checks whether there is an identifier in the target NIC type array that is the same as the manufacturer identifier of the target NIC. If there is an identifier in the target NIC type array that is the same as the manufacturer identifier of the target NIC... If the target network interface card (NIC) type is not found in the target NIC type array, then the NIC type corresponding to the manufacturer identifier of the target NIC is taken as the NIC type of the target NIC. If the target NIC type array does not contain an identifier that is the same as the manufacturer identifier of the target NIC, then the target NIC type array is searched for an identifier that is the same as the subsystem identifier of the target NIC. If the target NIC type array contains an identifier that is the same as the subsystem identifier of the target NIC, then the NIC type corresponding to the subsystem identifier of the target NIC is taken as the NIC type of the target NIC. This application embodiment divides the network interface card (NIC) type array into multiple NIC type arrays by using device identifiers. When identifying the NIC type, the target NIC type array corresponding to the target NIC is first determined based on the device identifier of the target NIC. Then, the NIC type of the target NIC is determined from the target NIC type array based on the manufacturer identifier and subsystem identifier of the target NIC. Compared to the traditional method of comparing four parameters simultaneously—device identifier, manufacturer identifier, subsystem manufacturer identifier, and subsystem device identifier—this application only needs to compare the manufacturer identifier and subsystem identifier one by one. Since the number of parameters to be compared is reduced, the number of array queries during NIC identification can be greatly reduced, improving the efficiency of NIC identification. In addition, since the arrays are classified, the data volume of a single array is reduced, which facilitates the maintenance of the arrays in the later stages.
[0072] This application discloses a specific method for identifying network interface card (NIC) types. See also... Figure 2 As shown, the method includes:
[0073] Step S21: Obtain the asset information of the target network card to be identified, and obtain the target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identification code of the target network card, and the subsystem identification code includes the subsystem manufacturer identification code and the subsystem device identification code.
[0074] In this embodiment, the asset information of the target network card to be identified is first obtained, resulting in target asset information including device identifier, vendor identifier, subsystem vendor identifier (SVID), and subsystem device identifier (SDID).
[0075] Step S22: Based on the device identifier of the target network card in the target asset information, determine the target network card type array corresponding to the target network card from a plurality of pre-created network card type arrays; wherein, different network card type arrays correspond to different device identifiers.
[0076] Step S23: Check if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0077] Step S24: If there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then the network card type in the target network card type array that corresponds to the manufacturer identifier of the target network card is taken as the network card type of the target network card, and the target network card type is obtained.
[0078] Step S25: If there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then check if there is an identifier in the target network card type array that is the same as the subsystem identifier of the target network card.
[0079] Step S26: If there is an identification code in the target network card type array that is the same as the subsystem manufacturer identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem manufacturer identification code of the target network card is taken as the network card type of the target network card, and the target network card type is obtained.
[0080] In this embodiment, if there is an identification code in the target network card type array that is the same as the subsystem vendor identification code (SVID) of the target network card, then the network card type corresponding to the subsystem vendor identification code of the target network card in the target network card type array is directly used as the network card type of the target network card, thereby obtaining the target network card type.
[0081] Step S27: If there is an identification code in the target network card type array that is the same as the subsystem device identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem device identification code of the target network card is taken as the network card type of the target network card, and the target network card type is obtained.
[0082] In this embodiment, if there is no identification code in the target network card type array that is the same as the subsystem vendor identification code (SVID) of the target network card, then it is further determined whether there is an identification code in the target network card type array that is the same as the subsystem device identification code (SDID) of the target network card. If there is, the network card type in the target network card type array that corresponds to the subsystem device identification code of the target network card is taken as the network card type of the target network card, thereby obtaining the target network card type.
[0083] For more detailed processing procedures of steps S22 to S25, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0084] As can be seen, the network interface card (NIC) type identification scheme proposed in this application pre-configures multiple NIC type arrays in the BMC identification code based on different Device IDs. When identifying the NIC type of a target NIC, it first matches a target NIC type array based on the NIC's Device ID, and then matches based on the Vendor ID. If no identifier matching the Vendor ID is found, it then matches the SVID and SDID one by one. Since a large array is split into multiple smaller arrays based on the Device ID, the amount of data for array matching is reduced, improving the efficiency of NIC identification. Furthermore, it facilitates the maintenance and management of each small data set. Since no hardware modifications are required, hardware costs are saved, while still meeting the performance requirements of NICs used in servers.
[0085] Accordingly, this application also discloses a network card type identification device, see [link to relevant documentation]. Figure 3 As shown, the device includes:
[0086] The information acquisition module 11 is used to acquire asset information of the target network card to be identified, and obtain target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identification code of the target network card;
[0087] The array determination module 12 is used to determine the target network card type array corresponding to the target network card from a plurality of pre-created network card type arrays based on the device identifier of the target network card in the target asset information; wherein, different network card type arrays correspond to different device identifiers;
[0088] The first search module 13 is used to search whether there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card;
[0089] The first type determination module 14 is used to determine the target network card type by taking the network card type corresponding to the manufacturer identifier of the target network card in the target network card type array as the network card type of the target network card if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0090] The second search module 15 is used to search for an identifier in the target network card type array that is the same as the subsystem identifier of the target network card if there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card.
[0091] The second type determination module 16 is used to determine the target network card type by taking the network card type corresponding to the subsystem identification code of the target network card in the target network card type array as the network card type of the target network card if there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card.
[0092] The specific workflow of each of the above modules can be found in the relevant content disclosed in the foregoing embodiments, and will not be repeated here.
[0093] As can be seen, in this embodiment, the asset information of the target network card to be identified is first obtained to obtain the target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier, and subsystem identifier of the target network card; then, based on the device identifier of the target network card in the target asset information, the target network card type array corresponding to the target network card is determined from a plurality of pre-created network card type arrays; wherein, different network card type arrays correspond to different device identifiers; next, it is checked whether there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card; if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card... If the target network interface card (NIC) has the same identifier as the target NIC, then the NIC type corresponding to the manufacturer identifier of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, thus obtaining the target NIC type. If there is no identifier in the target NIC type array that is the same as the manufacturer identifier of the target NIC, then the target NIC type array is searched for an identifier that is the same as the subsystem identifier of the target NIC. If there is an identifier in the target NIC type array that is the same as the subsystem identifier of the target NIC, then the NIC type corresponding to the subsystem identifier of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, thus obtaining the target NIC type. This application embodiment divides the network interface card (NIC) type array into multiple NIC type arrays by using device identifiers. When identifying the NIC type, the target NIC type array corresponding to the target NIC is first determined based on the device identifier of the target NIC. Then, the NIC type of the target NIC is determined from the target NIC type array based on the manufacturer identifier and subsystem identifier of the target NIC. Compared to the traditional method of comparing four parameters simultaneously—device identifier, manufacturer identifier, subsystem manufacturer identifier, and subsystem device identifier—this application only needs to compare the manufacturer identifier and subsystem identifier one by one. Since the number of parameters to be compared is reduced, the number of array queries during NIC identification can be greatly reduced, improving the efficiency of NIC identification. In addition, since the arrays are classified, the data volume of a single array is reduced, which facilitates the maintenance of the arrays in the later stages.
[0094] In some specific embodiments, the subsystem identification code includes a subsystem manufacturer identification code and a subsystem device identification code;
[0095] Accordingly, the second type determination module 16 may specifically include:
[0096] The first network interface card (NIC) type identification unit is configured to, if there is an identification code in the target NIC type array that is the same as the subsystem manufacturer identification code of the target NIC, then take the NIC type corresponding to the subsystem manufacturer identification code of the target NIC as the NIC type of the target NIC;
[0097] The second network interface card (NIC) type identification unit is used to identify the NIC type corresponding to the subsystem device identification code of the target NIC if there is an identification code in the target NIC type array that is the same as the subsystem device identification code of the target NIC.
[0098] In some specific embodiments, the information acquisition module 11 may be preceded by:
[0099] The asset information acquisition unit is used to collect asset information of different types of network interface cards (NICs) to obtain historical asset information; the historical asset information includes the device identifier, manufacturer identifier, and subsystem identification code of each of the different types of NICs.
[0100] The asset information sending unit is used to send the historical asset information to the baseboard management controller through the basic input / output system;
[0101] An asset information classification unit is used to classify the historical asset information according to different device identifiers through the baseboard management controller, thereby obtaining multiple classified asset information.
[0102] An array creation unit is used to create corresponding network card type arrays for each of the different types of network cards based on the classified asset information, thereby obtaining multiple network card type arrays.
[0103] An array storage unit is used to store an array of all network card types into the electrically erasable programmable read-only memory of the motherboard;
[0104] Accordingly, the array determination module 12 may specifically include:
[0105] A network interface card (NIC) type array reading unit is used to read all the NIC type arrays from the electrically erasable programmable read-only memory;
[0106] The third network interface card (NIC) type identification unit is used to determine the target NIC type array corresponding to the target NIC from a plurality of pre-created NIC type arrays based on the device identifier of the target NIC in the target asset information.
[0107] In some specific embodiments, after the array creation unit, the system may further include:
[0108] An identifier determination unit is used to determine the device identifier corresponding to each of the classified asset information items;
[0109] The array naming unit is used to name the corresponding network interface card (NIC) type arrays according to the naming method of the device identifiers corresponding to the classified asset information, so as to obtain the array name corresponding to each NIC type array.
[0110] In some specific embodiments, the first type determination module 14 may specifically include:
[0111] The lookup unit is used to check whether the array name corresponding to the multiple pre-created network card type arrays contains the device identifier in the target asset information;
[0112] An array determination unit is used to determine the target network card type array as the target network card if the array name corresponding to multiple network card type arrays contains the device identifier in the target asset information.
[0113] In some specific embodiments, the network interface card (NIC) type identification device may further include:
[0114] The determination unit is used to determine whether the target network card supports the network controller sideband interface communication mode;
[0115] The method determination and information acquisition unit is used to determine the temperature information acquisition method and characteristic information of the target network card if the target network card supports the network controller sideband interface communication mode;
[0116] The temperature information acquisition unit is used to acquire the temperature information of the target network card through the temperature information acquisition method and the feature information.
[0117] In some specific embodiments, the temperature information acquisition method is any one of the following: a first information acquisition method based on an integrated circuit bus, a second information acquisition method based on a management component transmission protocol at the upper layer and a fast peripheral component interconnection protocol at the lower hardware interface, and a third information acquisition method based on a management component transmission protocol at the upper layer and an integrated circuit bus at the lower hardware interface.
[0118] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0119] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the network card type identification method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0120] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0121] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0122] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the network card type identification method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0123] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned network interface card (NIC) type identification method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0124] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0125] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0126] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0127] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0128] The above provides a detailed description of a network interface card (NIC) type identification method, apparatus, device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for identifying network interface card (NIC) types, characterized in that, include: The asset information of the target network interface card to be identified is obtained to obtain the target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identifier of the target network interface card; Based on the device identifier of the target network card in the target asset information, the target network card type array corresponding to the target network card is determined from multiple pre-created network card type arrays; wherein, different network card type arrays correspond to different device identifiers; Check if there exists an identifier in the target network interface card type array that is the same as the manufacturer identifier of the target network interface card; If there is an identifier in the target network interface card (NIC) type array that is the same as the manufacturer identifier of the target NIC, then the NIC type corresponding to the manufacturer identifier of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, and the target NIC type is obtained. If there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card, then search for an identifier in the target network card type array that is the same as the subsystem identifier of the target network card. If there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card, then the network card type corresponding to the subsystem identification code of the target network card in the target network card type array is taken as the network card type of the target network card, and the target network card type is obtained.
2. The network interface card (NIC) type identification method according to claim 1, characterized in that, The subsystem identification code includes the subsystem manufacturer identification code and the subsystem equipment identification code; Accordingly, if the target network interface card (NIC) type array contains an identification code that is identical to the subsystem identification code of the target NIC, then the NIC type corresponding to the subsystem identification code of the target NIC in the target NIC type array is taken as the NIC type of the target NIC, including: If there is an identification code in the target network card type array that is the same as the subsystem manufacturer identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem manufacturer identification code of the target network card shall be used as the network card type of the target network card; If there is an identification code in the target network card type array that is the same as the subsystem device identification code of the target network card, then the network card type in the target network card type array that corresponds to the subsystem device identification code of the target network card is taken as the network card type of the target network card.
3. The network interface card (NIC) type identification method according to claim 1, characterized in that, Before obtaining the asset information of the target network interface card to be identified, the process further includes: Collect asset information of different types of network interface cards (NICs) to obtain historical asset information; the historical asset information includes the device identifier, manufacturer identifier, and subsystem identification code of each of the different types of NICs. The historical asset information is sent to the baseboard management controller via the basic input / output system. The historical asset information is classified according to different device identifiers by the baseboard management controller to obtain multiple classified asset information; Based on the asset information after each classification, create corresponding network card type arrays for each of the different types of network cards to obtain multiple network card type arrays; All network interface card (NIC) type arrays are stored in the electrically erasable programmable read-only memory (EEPROM) of the motherboard; Accordingly, determining the target network interface card (NIC) type array corresponding to the target NIC from a pre-created array of multiple NIC type arrays based on the device identifier of the target NIC in the target asset information includes: Read all the network interface card (NIC) type arrays from the electrically erasable programmable read-only memory, and determine the target NIC type array corresponding to the target NIC from a plurality of pre-created NIC type arrays based on the device identifier of the target NIC in the target asset information.
4. The network interface card (NIC) type identification method according to claim 3, characterized in that, After creating corresponding network interface card (NIC) type arrays for each of the different types of NICs based on the classified asset information, resulting in multiple NIC type arrays, the process further includes: Determine the device identifier corresponding to each of the classified asset information; The corresponding network interface card (NIC) type arrays are named according to the naming convention of the device identifiers corresponding to the classified asset information, so as to obtain the array name corresponding to each NIC type array.
5. The network interface card (NIC) type identification method according to claim 4, characterized in that, The step of determining the target network card type array corresponding to the target network card from a pre-created array of multiple network card type arrays based on the device identifier of the target network card in the target asset information includes: Check whether the array name corresponding to the multiple pre-created network interface card type arrays contains the device identifier from the target asset information; If the array name corresponding to multiple network interface card (NIC) type arrays contains the device identifier from the target asset information, then the corresponding NIC type array is used as the target NIC type array for the target NIC.
6. The network interface card (NIC) type identification method according to any one of claims 1 to 5, characterized in that, Also includes: Determine whether the target network card supports the network controller sideband interface communication mode; If the target network card supports the network controller sideband interface communication mode, then the temperature information acquisition method and feature information of the target network card are determined, and the temperature information of the target network card is acquired through the temperature information acquisition method and the feature information.
7. The network interface card (NIC) type identification method according to claim 6, characterized in that, The temperature information of the target network card is obtained in any one of the following ways: a first information acquisition method based on an integrated circuit bus, a second information acquisition method based on a management component transmission protocol at the upper layer and a fast peripheral component interconnection protocol at the lower hardware interface, and a third information acquisition method based on a management component transmission protocol at the upper layer and an integrated circuit bus at the lower hardware interface.
8. A network interface card (NIC) type identification device, characterized in that, include: The information acquisition module is used to acquire asset information of the target network card to be identified, and obtain target asset information; wherein, the target asset information includes the device identifier, manufacturer identifier and subsystem identification code of the target network card; An array determination module is used to determine the target network card type array corresponding to the target network card from a pre-created array of multiple network card type arrays based on the device identifier of the target network card in the target asset information; wherein, different network card type arrays correspond to different device identifiers; The first search module is used to search whether there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card; The first type determination module is used to determine the target network card type by taking the network card type corresponding to the manufacturer identifier of the target network card in the target network card type array as the network card type of the target network card if there is an identifier in the target network card type array that is the same as the manufacturer identifier of the target network card. The second search module is used to search for an identifier in the target network card type array that is the same as the subsystem identifier of the target network card if there is no identifier in the target network card type array that is the same as the manufacturer identifier of the target network card. The second type determination module is used to determine the target network card type by taking the network card type corresponding to the subsystem identification code of the target network card in the target network card type array as the network card type of the target network card if there is an identification code in the target network card type array that is the same as the subsystem identification code of the target network card.
9. An electronic device, characterized in that, It includes a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the network card type identification method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the network card type identification method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method, system and device for obtaining network card identification number, and medium
CN112667538A
Multi-slot equipment network card detection method and device, electronic equipment and storage medium
CN116303148A