Bandwidth testing method and bandwidth testing device
By automatically comparing the first bandwidth information and the second bandwidth information of the PCIe device, the problems of low efficiency and high cost of manual manual testing are solved, and efficient and accurate testing of the bandwidth allocation of PCIe devices are achieved.
Patent Information
- Application Number
- CN202510495142.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-07-08
AI Technical Summary
In the prior art, the method of manually testing the success rate of bandwidth allocation of PCIe equipment is inefficient, has high maintenance costs and is prone to testing operation errors.
A bandwidth testing method and apparatus are provided to automatically compare the two to determine the correctness of bandwidth allocation by acquiring the first bandwidth information of a PCIe device and the second bandwidth information allocated by the basic input and output system, including using a processing module to acquire and compare information to generate test results.
It realizes batch automation inspection of PCIe equipment bandwidth, reduces labor cost investment, improves testing efficiency and accuracy, and reduces maintenance costs.
Smart Images

Figure CN120281688A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of bandwidth testing, and in particular to a bandwidth testing method and a bandwidth testing device. Background Art
[0002] PCIe (Peripheral Component Interconnect Express) is a high-speed serial computer expansion card standard, mainly used to connect a CPU (Central Processing Unit) and various expansion cards. In related technologies, bandwidth can be automatically allocated to PCIe devices. After the bandwidth allocation of the PCIe devices is completed, the success rate of the automatic allocation is determined by manual testing. However, the above method for determining the success rate of automatic allocation is inefficient, has a high maintenance cost, and is prone to test operation errors. Summary of the Invention
[0003] The present application provides a bandwidth testing method and a bandwidth testing device to at least solve the problems of low efficiency, high maintenance cost, and prone test operation errors in determining the success rate of automatic allocation by manual testing in related technologies.
[0004] The present application provides a bandwidth testing method, including:
[0005] Obtaining first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices;
[0006] Comparing the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result; the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
[0007] The present application further provides a bandwidth testing device, including:
[0008] A first processing module, configured to obtain first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices;
[0009] A second processing module, configured to compare the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result; the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
[0010] The present application further 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 bandwidth testing methods when executing the computer program.
[0011] The present application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of any of the above bandwidth testing methods are implemented.
[0012] The present application also provides a computer program product including a computer program, wherein when the computer program is executed by a processor, the steps of any of the above bandwidth testing methods are implemented.
[0013] With the present application, by obtaining the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device, the actual bandwidth of each PCIe device and the bandwidth allocated to each PCIe device are effectively obtained, and the first bandwidth information and the second bandwidth information corresponding to the same PCIe device are respectively compared to obtain a test result, enabling batch inspection of the bandwidth of each PCIe device automatically; therefore, the technical problems of low efficiency, high maintenance cost and easy occurrence of test operation errors in determining the success rate of automatic allocation by manual testing can be solved, achieving the technical effects of reducing the input of labor costs, improving the test efficiency, performing tests based on a standardized test process, and improving the test accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0015] Figure 1 One of the schematic flowcharts of a bandwidth testing method provided by an embodiment of the present application;
[0016] Figure 2 One of the schematic diagrams of the principle of a bandwidth testing method provided by an embodiment of the present application;
[0017] Figure 3 Another schematic diagram of the principle of a bandwidth testing method provided by an embodiment of the present application;
[0018] Figure 4 Another schematic flowchart of a bandwidth testing method provided by an embodiment of the present application;
[0019] Figure 5 Schematic diagram of the structure of a bandwidth testing device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] 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.
[0021] 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, so 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.
[0022] In order to enable those skilled in the art of the present 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.
[0023] An embodiment of the present application provides a bandwidth testing method, and the method will be described in detail in combination with the execution process of the bandwidth testing method.
[0024] Specifically, Figure 1 FIG. is a flowchart of a bandwidth testing method provided according to an embodiment of the present application.
[0025] As Figure 1 shown, the bandwidth testing method includes: step 110 and step 120.
[0026] The bandwidth testing method can be used to test the bandwidth of PCIe devices set under different operating systems.
[0027] For example, it can test PCIe devices under the Windows system, PCIe devices under the Linus system, PCIe devices under the MAC system, etc.
[0028] It should be noted that there can be multiple PCIe devices under each operating system.
[0029] Step 110: Obtain the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device;
[0030] In this step, the PCIe device is a high-speed peripheral designed based on the PCIe bus standard, used to connect a computer motherboard and various expansion devices, and provide high-bandwidth and low-latency data transmission capabilities.
[0031] PCIe devices can include: graphics cards, solid-state drives, network cards, network adapters, sound cards, etc.
[0032] The bandwidth of the PCIe bus standard is closely related to its version and the number of lanes.
[0033] The following are the detailed information about different versions of PCIe and their bandwidths:
[0034] PCIe 1.0: The bit transfer rate on the line is 2.5 Gb / s, using 8 / 10 encoding, so the bandwidth of PCIe 1.0x1 is 250 MB / s.
[0035] PCIe 2.0: The bit transfer rate on the line doubles to 5 Gb / s, using 8 / 10 encoding, so the bandwidth of PCIe 2.0x1 is 500 MB / s.
[0036] PCIe 3.0: The bit transfer rate on the line is 8 Gb / s, using 128 / 130 encoding, so the bandwidth of PCIe 3.0x1 is 1 GB / s.
[0037] PCIe 4.0: The bit transfer rate on the line is increased to 16 GT / s.
[0038] PCIe 5.0: The highest bit transfer rate on the line can reach 32 GT / s.
[0039] In addition, the bandwidth of PCIe is also related to the number of its lanes.
[0040] For example, the theoretical maximum bandwidth of a PCIe x1 slot is 1 GB / s, suitable for devices with low data transfer requirements; the theoretical maximum bandwidth of a PCIe x4 slot is 4 GB / s, suitable for devices with medium bandwidth requirements; the theoretical maximum bandwidth of a PCIe x8 slot is 8 GB / s, suitable for devices with higher data transfer speed requirements; the PCIe x16 slot has the highest theoretical maximum bandwidth of 16 GB / s.
[0041] The first bandwidth information is the actual bandwidth of the PCIe device.
[0042] The Basic Input / Output System (BIOS) is a key interface between computer hardware and the operating system, responsible for system startup, hardware initialization, and low-level hardware control.
[0043] The second bandwidth information is the bandwidth automatically allocated by the Basic Input / Output System for the PCIe device.
[0044] It should be noted that the bandwidths allocated to different PCIe devices may be different or the same.
[0045] During the actual execution process, during the computer startup process, the Basic Input / Output System assigns a fixed bus number to the root port of each PCIe device.
[0046] As Figure 2 shown, the allocation of the RootPort bandwidth of the CPU is actually different bandwidth allocations formed by different combinations of the function numbers (FunctionNumber) in the RootPort.
[0047] For example, if the functions used in the RootPort are configured as 0, 2, 4, 6, then the bandwidth of this RootPort is x4x4x4x4.
[0048] Another example, if the functions used in the RootPort are configured as 0, 2, 4, then the bandwidth of this RootPort is x4x4x8.
[0049] Another example, if the functions used in the RootPort are configured as 0, 4, then the bandwidth of this RootPort is x8x8, and so on.
[0050] During the actual execution process, the first bandwidth information corresponding to each PCIe device and the second bandwidth information corresponding to each PCIe device can be collected in advance, and the first bandwidth information and the second bandwidth information of the same PCIe device are associated and stored in a database table to obtain the first bandwidth information and the second bandwidth information corresponding to each PCIe device from the database table.
[0051] The database table storing the first bandwidth information and the second bandwidth information can be as Figure 3 shown.
[0052] It should be noted that the information in the same row of the database table is used to represent the bandwidth information of the same PCIe device.
[0053] The specific types of the information in each column of the database table can be determined based on the actual situation, and this application does not make any limitations.
[0054] For example, in the case where the PCIe device is a graphics card, the first bandwidth information and the second bandwidth information of this graphics card can be stored in the same row of the database table, and this row of data is marked to represent that the information in this row is the bandwidth information of the graphics card.
[0055] The specific form of the mark can be determined based on the actual situation. For example, the mark can be the type of the PCIe device or the serial number of the PCIe device, etc., and this application does not make any limitations.
[0056] Step 120: Compare the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result.
[0057] In this step, the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
[0058] The test result may include: correct bandwidth allocation or abnormal bandwidth allocation.
[0059] It should be noted that in the case of abnormal bandwidth allocation, specific abnormal information can be further output.
[0060] In the actual execution process, after obtaining the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device, each PCIe device can be traversed to perform a bandwidth test on each PCIe device.
[0061] During the traversal process, for the same PCIe device, obtain the first bandwidth information corresponding to the same PCIe device and the second bandwidth information corresponding to the same PCIe device, compare whether the first bandwidth information and the second bandwidth information corresponding to the same PCIe device are consistent, and obtain a test result.
[0062] In the actual execution process, when the test results of all PCIe devices are correct bandwidth allocation, the total test result can be output, that is, the bandwidth allocation of all PCIe devices is correct.
[0063] When the test results of at least some PCIe devices among all PCIe devices are abnormal bandwidth allocation, information such as the specific type or serial number of at least some PCIe devices can be output to inform the user that the bandwidth allocation of at least some PCIe devices is abnormal.
[0064] In the actual execution process, a bandwidth traversal matching program can be established by writing code in Python to traverse each PCIe device and test each PCIe device.
[0065] The specific operation steps are as follows:
[0066] (1) Construct a partial matching table: Traverse the pattern string to generate the lengths of the longest prefix and suffix at each position, and this table can be generated within O(m) time.
[0067] class KMPMatcher:
[0068] def _init_(self, pattern);
[0069] self.pattern = pattern
[0070] self.lps = self.build_lps(pattern)
[0071] def build_lps(self, pattern);
[0072] m = len(pattern)
[0073] lps = [0] * m
[0074] length = 0 # length is initialized to 0
[0075] i = 1
[0076] while i < m;
[0077] if pattern[i] == pattern[length];
[0078] length += 1
[0079] lps[i] = length
[0080] i += 1
[0081] else:
[0082] if length != 0;
[0083] length = lps[length - 1] # backtrack
[0084] else:
[0085] lps[i] = 0
[0086] i += 1
[0087] return lps
[0088] (2) Perform matching: During the matching process, use the partial match table to determine the number of characters to skip, and search for the pattern string in the text to perform efficient matching.
[0089] class KMPMatcher:
[0090] Def_init_(self, pattern);
[0091] self.pattern = pattern
[0092] self.lps = self.build_lps(pattern)
[0093] def build_lps(self, pattern);
[0094] m = len(pattern)
[0095] lps = [0] * m
[0096] length = 0
[0097] i = 1
[0098] while i < m:
[0099] if pattern[i] == pattern[length];
[0100] length += 1
[0101] lps[i] = length
[0102] i += 1
[0103] else:
[0104] if length != 0;
[0105] length = lps[length - 1]
[0106] else:
[0107] lps[i] = 0
[0108] i += 1
[0109] return lps
[0110] def kmp_search(self, text);
[0111] n = len(text)
[0112] m = len(self.pattern)
[0113] i = 0 # text pointer
[0114] j = 0 # pattern pointer
[0115] while i < n:
[0116] if self.pattern[j] == text[i]:
[0117] i += 1
[0118] j += 1
[0119] if j==m:
[0120] print(f "The position of the pattern string in the text: {ij}")
[0121] j = self.lps[j-1] #After finding a match, update the pattern pointer
[0122] elifi <n and self.pattern[j]!=text[i]:
[0123] if j!=0:
[0124] j = self.lps[j-1] # Skip the matched part
[0125] else:
[0126] i+=1
[0127] Through the above program code, the first bandwidth information and the second bandwidth information of the PCIe device of each PCIe slot can be compared to determine the correctness of the second bandwidth information.
[0128] Of course, in the actual execution process, the program code can also be written in other computer languages for testing, and this application does not limit this.
[0129] It should be noted that computer firmware design does not need to be concerned with complex bandwidth allocation design, which reduces the complexity of the diversity of computer CPU PCIe port connection forms due to the large number of computer models and many user customization requirements, improves the efficiency of computer firmware version development and the production efficiency of various configuration models.
[0130] During the research and development process, the inventor discovered that in the related technology, bandwidth can be automatically allocated to PCIe devices. After the bandwidth allocation of PCIe devices is completed, the success rate of automatic allocation is determined by manual testing. However, the above method of determining the success rate of automatic allocation is inefficient, has high testing costs, and is prone to test operation errors.
[0131] The present application obtains the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated to each PCIe device by the basic input and output system, effectively obtains the actual bandwidth of each PCIe device and the bandwidth allocated to each PCIe device, and compares the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain the test result. The application can automatically perform batch inspection on the bandwidth of each PCIe device, reduce labor cost investment, improve test efficiency, perform testing based on a standardized test process, and improve test accuracy.
[0132] According to the bandwidth testing method provided by the embodiments of the present application, by obtaining the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device, comparing the first bandwidth information and the second bandwidth information corresponding to the same PCIe device respectively, and obtaining the test results, it is possible to automatically batch-check the bandwidth of each PCIe device, reduce the input of labor costs, improve the test efficiency, and improve the accuracy of the test.
[0133] In some embodiments, the first bandwidth information may include:
[0134] At least one of slot bandwidth, maximum supported bandwidth of the device, current operating bandwidth, and generated bandwidth.
[0135] In this embodiment, the slot bandwidth is the theoretical bandwidth provided by the PCIe slot.
[0136] The slot bandwidth is related to the version and number of channels of the slot.
[0137] The maximum supported bandwidth of the device is the maximum bandwidth supported by the PCIe device.
[0138] The current operating bandwidth is the bandwidth achieved by the PCIe device during actual use.
[0139] The generated bandwidth is the generated bandwidth based on the bandwidth allocation rule of the rootport function.
[0140] The generated bandwidth can be generated based on the information included in the table as Figure 2 shown.
[0141] During the actual execution process, according to the actual test requirements, one or more of the slot bandwidth, maximum supported bandwidth of the device, current operating bandwidth, and generated bandwidth can be obtained.
[0142] For example, when it is necessary to test the slot bandwidth and the maximum supported bandwidth of each PCIe device, the slot bandwidth, maximum supported bandwidth of the device, and the second bandwidth information corresponding to each PCIe device can be obtained.
[0143] Compare the slot bandwidth and the second bandwidth information corresponding to the same PCIe device to obtain the test result corresponding to the slot bandwidth.
[0144] Compare the maximum supported bandwidth of the device and the second bandwidth information corresponding to the same PCIe device to obtain the test result corresponding to the maximum supported bandwidth of the device.
[0145] Fuse the test result corresponding to the slot bandwidth and the test result corresponding to the maximum supported bandwidth of the device to obtain the test result of the same PCIe device.
[0146] For another example, when it is necessary to test the maximum supported bandwidth, current operating bandwidth, and generated bandwidth of each PCIe device, the maximum supported bandwidth, current operating bandwidth, generated bandwidth, and second bandwidth information corresponding to each PCIe device can be obtained.
[0147] The maximum supported bandwidth, current operating bandwidth, and generated bandwidth corresponding to the same PCIe device are respectively compared with the second bandwidth information to obtain a test result.
[0148] According to the bandwidth test method provided by the embodiments of the present application, by determining that the first bandwidth information can include one or more of the slot bandwidth, maximum supported bandwidth, current operating bandwidth, and generated bandwidth, the type of bandwidth included in the first bandwidth information can be flexibly selected based on actual test requirements, improving the flexibility of testing, reducing unnecessary tests, and improving test efficiency.
[0149] In some embodiments, step 120 may further include:
[0150] When the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, the test result corresponding to the same PCIe device is obtained as abnormal information;
[0151] When the first bandwidth information and the second bandwidth information corresponding to the same PCIe device match, the test result corresponding to the same PCIe device is obtained as a test pass message.
[0152] In this embodiment, the abnormal information is information for prompting the user that the bandwidth allocation of the same PCIe device is incorrect.
[0153] The abnormal information may include: the BIOS configured bandwidth is less than the slot bandwidth, the BIOS configured bandwidth is less than the maximum bandwidth supported by the device, the BIOS configured bandwidth does not match the generated bandwidth, the BIOS configured bandwidth is greater than the slot bandwidth, and the BIOS configured bandwidth is greater than the maximum bandwidth supported by the device, etc.
[0154] The test pass message is information for prompting the user that the bandwidth allocation of the same PCIe device is correct.
[0155] During the actual execution process, taking the PCIe device in the first row of CPU0 PE0 of the same PCIe device as Figure 3 an example, where the first bandwidth information is the slot bandwidth and the maximum supported bandwidth of the device, the information (X4) in the eighth column of this row can be compared with the information (X4) in the first column of this row to test the consistency between the slot bandwidth of the same PCIe device and the bandwidth allocated by the basic input / output system. The information in the eighth column of this row matches the information in the first column of this row, indicating that the slot bandwidth of the same PCIe device is consistent with the bandwidth allocated by the basic input / output system.
[0156] Then, compare the information in the eighth column (X4) with the information in the third column (X4) of this row. If the information in the eighth column of this row matches the information in the third column of this row, it indicates that the maximum supported bandwidth of the device of the same PCIe device is consistent with the bandwidth allocated by the basic input / output system. At this time, based on the matching of the information in the eighth column with the information in the first column of this row and the matching of the information in the eighth column with the information in the third column of this row, the test result corresponding to the same PCIe device can be obtained as a pass message.
[0157] It should be noted that the comparison order between the slot bandwidth, the maximum supported bandwidth of the device, and the second bandwidth information can be determined according to the actual situation, and this application does not make any limitations.
[0158] Continuing with the same PCIe device as Figure 3 the PCIe device in the first row of CPU0 PE0 in the example, where the first bandwidth information is the slot bandwidth and the maximum supported bandwidth of the device. If the information in the eighth column is X8 and the information in the first column is X4, at this time, the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, and the obtained test result is an abnormal message. The abnormal message can be that the BIOS configured bandwidth is greater than the slot bandwidth.
[0159] If the information in the eighth column is X8 and the information in the third column is X4, at this time, the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, and the obtained test result is an abnormal message. The abnormal message can be that the BIOS configured bandwidth is greater than the maximum bandwidth supported by the device.
[0160] For various bandwidth information included in the first bandwidth information, the comparison with the second bandwidth information can be performed based on the above method to obtain the test result. To avoid repetition, it will not be elaborated here.
[0161] It should be noted that in the case where the first bandwidth information includes multiple types of bandwidth information, various types of bandwidth information can be compared with the second bandwidth information based on a certain order, and the test results of various types of bandwidth information can be output.
[0162] Taking the first bandwidth information including: slot bandwidth device, maximum supported bandwidth of the device, and current operating bandwidth as an example, the obtained test result may be that the maximum supported bandwidth of the device and the current operating bandwidth are consistent with the BIOS allocated bandwidth, but the BIOS allocated bandwidth is less than the slot bandwidth.
[0163] According to the bandwidth testing method provided by the embodiments of the present application, the test result is obtained by comparing whether the first bandwidth information and the second bandwidth information corresponding to the same PCIe device match. When the first bandwidth information and the second bandwidth information corresponding to the same PCIe device match, the test result is a pass message. When the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, the test result is an abnormal message. The judgment method is simple and easy to operate.
[0164] In some embodiments, step 110 may further include:
[0165] Based on the identification information corresponding to each PCIe device, obtain the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device.
[0166] In this embodiment, the identification information is information identifying the PCIe device.
[0167] The identification information is used to determine the target PCIe device from multiple PCIe devices.
[0168] The identification information may include: the type of the PCIe device, the serial number, the BDF (Bus, Device, and Function) information, and the slot information, etc.
[0169] In PCIe, BDF is used to uniquely identify the addressing mechanism of each PCle device in the system.
[0170] Specifically, BDF may be composed of the following three parts:
[0171] BusNumber: an 8-bit field indicating the bus number where the device is located. PCIe can support up to 256 buses at most.
[0172] Device Number: a 5-bit field indicating the device number on a specific bus. Each bus can support up to 32 devices, numbered from 0 to 31 (0x1f).
[0173] Function Number: a 3-bit field indicating the function number of a specific device. Each device can support up to 8 functions, numbered from 0 to 7.
[0174] The target PCIe device is any one of the multiple PCIe devices.
[0175] In the actual execution process, based on the identification information corresponding to each PCIe device, the first bandwidth information and the second bandwidth information corresponding to each PCIe device can be obtained, and the first bandwidth information and the second bandwidth information corresponding to different PCIe devices are distinguished by the identification information.
[0176] According to the bandwidth testing method provided by the embodiments of the present application, by obtaining the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device based on the identification information corresponding to each PCIe device, the data quality of the obtained first bandwidth information and second bandwidth information is improved, and the subsequent testing efficiency is improved.
[0177] In some embodiments, the identification information may include: the corresponding relationships between the bus numbers corresponding to each PCIe device and the device numbers, function numbers, and slot numbers respectively.
[0178] In this embodiment, during the actual execution process, the corresponding relationships between the bus numbers and device numbers corresponding to each PCIe device, the corresponding relationships between the bus numbers and function numbers, and the corresponding relationships between the bus numbers and slot numbers can be obtained. Through the above corresponding relationships, it can be obtained which function number under which RootPort of which device number a device with a certain bus number is attached to.
[0179] For example, a device with a bus number of
[03] is attached to function 4 of a device with a rootport device number of 1c.
[0180] Based on which function number under which RootPort of which device number a PCIe device with a certain bus number is attached to, the slot number where the rootport function to which the PCIe device belongs is located can be obtained.
[0181] Based on the above corresponding relationships, different PCIe devices on the PCIe slot are distinguished.
[0182] According to the bandwidth testing method provided by the embodiments of the present application, by determining that the identification information includes the corresponding relationships between the bus numbers corresponding to each PCIe device and the device numbers, function numbers, and slot numbers respectively, different PCIe devices can be effectively distinguished based on the identification information, and the PCIe device corresponding to a certain identification information can be determined, improving the management quality of each PCIe device.
[0183] In some embodiments, after step 110, the method may further include:
[0184] Based on the identification information corresponding to each PCIe device, the first bandwidth information and the second bandwidth information corresponding to each PCIe device are stored in a database table.
[0185] In this embodiment, after obtaining the first bandwidth information and the second bandwidth information corresponding to each PCIe device, the first bandwidth information and the second bandwidth information corresponding to each PCIe device can be stored in a database table based on the situation of the PCIe device to which the first bandwidth information and the second bandwidth information belong.
[0186] For example, in the actual execution process, taking the identification information corresponding to each PCIe device as 1, 2, 3, 4, and 4 respectively, the first bandwidth information and the second bandwidth information corresponding to the 5 obtained PCIe devices are the first bandwidth information A of PCIe device 1, the first bandwidth information B of PCIe device 2, the first bandwidth information C of PCIe device 3, the first bandwidth information D of PCIe device 4, and the first bandwidth information E of PCIe device 5; the second bandwidth information A of PCIe device 1, the second bandwidth information B of PCIe device 2, the second bandwidth information C of PCIe device 3, the second bandwidth information D of PCIe device 4, and the second bandwidth information E of PCIe device 5.
[0187] At this time, based on the identification information corresponding to each PCIe device, the first bandwidth information A of PCIe device 1 and the second bandwidth information A of PCIe device 1 can be stored in the same row of the database table, and the first bandwidth information A of PCIe device 2 and the second bandwidth information A of PCIe device 2 can be stored in the same row of the database table, and so on, until the first bandwidth information and the second bandwidth information of all PCIe devices are stored in the database table.
[0188] It should be noted that the attribute columns in the database table may include the identification information corresponding to the PCIe device.
[0189] According to the bandwidth testing method provided by the present application, by storing the first bandwidth information and the second bandwidth information corresponding to each PCIe device in the database table based on the identification information corresponding to each PCIe device, the mapping relationship between the first bandwidth information and the second bandwidth information corresponding to each PCIe device is effectively established, a large number of first bandwidth information and second bandwidth information are efficiently managed, and the efficiency of extracting the first bandwidth information and the second bandwidth information corresponding to the same PCIe device subsequently is improved.
[0190] As Figure 4 shown, in some embodiments, when each PCIe device is set in the Linux operating system, step 110 may further include:
[0191] Based on at least one of the lspci - t command, the lspci - vvv command, and the dmidecode - type9, obtain the first bandwidth information corresponding to each PCIe device;
[0192] Based on the Redfish instruction, obtain the second bandwidth information allocated by the basic input / output system to each PCIe device.
[0193] In this embodiment, the lspci - t command is used to obtain the BDF information of all PCIe RootPorts and PCIe devices.
[0194] The lspci - vvv command is used to obtain the current operating bandwidth of the PCIe device, the maximum supported bandwidth of the device, and the slot number where the rootport function to which the PCIe device belongs is located.
[0195] The dmidecode - type9 is used to obtain the slot number, slot silk - screen, and the slot bandwidth supported by the slot corresponding to the slot number of the PCIe device.
[0196] The Redfish instruction is a management standard based on the HTTPS service, and it is an instruction that uses the RESTful interface to implement device management.
[0197] The Redfish instruction is used to obtain the bandwidth settings of each PCIe port of the CPU in the BIOS.
[0198] The following describes the specific process of obtaining the first bandwidth information and the second bandwidth information.
[0199] (1) Under the Linux OS, use the lspci - t command to obtain the BDF information of all PCIe RootPorts and devices as follows:
[0200] -[0000:00]-+-00.0
[0201] +-02.0
[0202] +-14.0
[0203] +-14.2
[0204] +-15.0
[0205] +-16.0
[0206] +-17.0
[0207] +-1c.0 -
[01] ----00.0
[0208] +-1c.2 -
[02] ----00.0
[0209] +-1c.4 -
[03] ----00.0
[0210] +-1f.0
[0211] +-1f.3
[0212] +-1f.4
[0213] \-1f.5
[0214] Among them, in 1c.0, 1c is the device number assigned by the BIOS to the Root port, and 0 is the function number in this RootPort;
[01]
[02]
[03] are the bus numbers assigned by the BIOS to the device.
[0215] Perform format parsing on the obtained information: The first line "-[0000:00]-+-00.0", that is, "[Segment:RootPortbus]-+-RootPortDevice.RootPort Function"; Other lines "1c.4-
[03] ----00.0", that is, "RootPortbus.RootPort device-[device bus]----device Device.device Function".
[0216] From the correspondence between the PCIe RootPort and the device, it can be obtained which function number of the RootPort with which device number the device with a certain bus number is attached to.
[0217] For example, the device with bus number
[03] is attached to function 4 of the device with rootport device number 1c.
[0218] (2) When the computer boots into the Linux OS and uses the lspci - vvv command, the SltCap information parsed from the RootPort configuration space of all devices and the LnkCap and LnkSta field information parsed from the PCIe device configuration space are obtained:
[0219] Specific implementation steps for parsing the RootPort configuration space:
[0220] 00:1c.4 PCI bridge: Intel Corporation Device 4dbc (rev 01) (prog-if 00[Normal decode])
[0221] Capabilities:
[40] Express (v2) Root Port (Slot+), MSI 00
[0222] SltCap: AttnBtn - PwrCtrl - MRL - AttnInd - PwrInd - HotPlug - Surprise -
[0223] Slot#3, Power Limit 25.000W; Interlock-NoCompl+
[0224] The device with 00:1c.4 is the BDF information of a certain PCIe root port of the CPU. Combining the information obtained in (1), the slot number where the root port function of the PCIe device is located can be obtained.
[0225] Specific implementation steps for parsing the PCIe device configuration space:
[0226] 03:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT710] (rev a1) (prog-if 00 [VGA controller])
[0227] LnkCap: Port#0, Speed 8GT / s, Width x8, ASPM not supported
[0228] ClockPM+Surprise-LLActRep-BwNot-ASPMOptComp+
[0229] LnkSta: Speed 8GT / s (ok), Width x8 (ok)
[0230] TrErr-Train-SlotClk+DLActive-BWMgmt-ABWMgmt-
[0231] Among them, the device with BDF 03:00.0 is the GK208B VGA graphics card produced by NVIDIA. Among them, Width x8 in the LnkCap field represents the maximum bandwidth supported by the device is x8, and Width x8 in the LnkSta field represents the current operating bandwidth of the device is x8.
[0232] (3) Use the dmidecode - type9 command under the Linux OS to obtain the slot number (ID: 3), slot silk screen (Designation: PCIe Slot 1), and slot bandwidth information (Type: x8 PCIExpress) of the device in the SMBIOS information.
[0233] The specific operation of the dmidecode - type9 command is as follows:
[0234] Handle 0x000E, DMI type 9, 13 bytes
[0235] System Slot Information
[0236] Designation: PCIe Slot 1
[0237] Type: x8 PCI Express
[0238] Current Usage: In Use
[0239] Length: Long
[0240] ID: 3
[0241] Characteristics:
[0242] 3.3V is provided
[0243] Opening is shared。
[0244] (4) Obtain the bandwidth setting for each PCIe port of the CPU in the BIOS using the redfish command under the Linux OS; the current BIOS settings of the server can be set using the Redfish API. Operate according to the following steps:
[0245] Prepare the request:
[0246] URL: https: / / <server-ip> / redfish / v1 / Systems / 1 / Bios / Settings
[0247] Method: PATCH
[0248] Request Headers:
[0249] Content-Type: application / json
[0250] X-Auth-Token: <your-auth-token>
[0251] After the request is sent, the BMC will return a JSON file of the BIOS configuration. The following example only shows some options for the CPU PCIe port bandwidth:
[0252]
[0253] The information obtained through (1)-(4) can be stored in the database table as shown in accordance with the corresponding relationship of the same PCIe device Figure 3 as shown below.
[0254] The specific type of the database table can be determined based on the actual situation. For example, the database table can be a MySQL database table or a Microsoft SQL Server, etc. This application does not make a limitation.
[0255] It should be noted that the character text information obtained by processing various instructions through python code can be used to extract the required information.
[0256] According to the bandwidth test method provided by the embodiments of the present application, the first bandwidth information corresponding to each PCIe device is obtained through the given lspci-t command, lspci-vvv command, and dmidecode - type9, and the second bandwidth information corresponding to each PCIe device is obtained through the redfish instruction. When it is clear that each PCIe device is set in the Linux operating system, the acquisition methods of the first bandwidth information and the second bandwidth information are simple and highly operable.
[0257] In some embodiments, when the first bandwidth information includes the maximum supported bandwidth of the device and the current operating bandwidth, the method may further include:
[0258] Compare the maximum supported bandwidth of the device and the current operating bandwidth corresponding to the same PCIe device to obtain a test result.
[0259] During the actual execution process, when it is necessary to test the consistency between the maximum supported bandwidth of each PCIe device and the current operating bandwidth, it is possible to compare whether the maximum supported bandwidth of the device and the current operating bandwidth corresponding to the same PCIe device match.
[0260] Continuing to refer to Figure 3 , it is possible to compare whether the information in the third column of the first row and the fourth column of the first row is consistent.
[0261] In the case where the information in the fourth column of the first row is less than the information in the third column of the first row, an exception message can be output, that is, the device operating bandwidth is less than the maximum bandwidth supported by the device.
[0262] According to the bandwidth testing method provided by the embodiments of the present application, by comparing the maximum supported bandwidth of a device corresponding to the same PCIe device and the currently operating bandwidth, a test result is obtained, which can understand the actual usage of the bandwidth and provide more information for the subsequent reasonable allocation and efficient utilization of resources.
[0263] 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.
[0264] For the bandwidth testing method provided by the embodiments of the present application, the execution subject can be a bandwidth testing device. In the embodiments of the present application, taking the bandwidth testing device executing the bandwidth testing method as an example, the bandwidth testing device provided by the embodiments of the present application is described.
[0265] The embodiments of the present application also provide a bandwidth testing device.
[0266] As Figure 5 shown, the bandwidth testing device includes: a first processing module 510 and a second processing module 520.
[0267] The first processing module 510 is configured to obtain the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each of the PCIe devices;
[0268] The second processing module 520 is configured to compare the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result; the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
[0269] According to the bandwidth testing device of the present application,
[0270] In some embodiments, the second processing module 520 may further be configured to:
[0271] In the case where the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, obtain that the test result corresponding to the same PCIe device is an abnormal information;
[0272] In the case where the first bandwidth information and the second bandwidth information corresponding to the same PCIe device match, obtain that the test result corresponding to the same PCIe device is a test passed information.
[0273] In some embodiments, when the first bandwidth information includes: the maximum supported bandwidth of the device and the currently operating bandwidth, the device may further include a third processing module, configured to:
[0274] Compare the maximum supported bandwidth and the current operating bandwidth of the device corresponding to the same PCIe device to obtain the test results.
[0275] In some embodiments, the first processing module 510 may further be configured to:
[0276] Based on the identification information corresponding to each PCIe device, obtain the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each PCIe device.
[0277] In some embodiments, when each PCIe device is set in the Linux operating system, the first processing module 510 may further be configured to:
[0278] Based on at least one of the lspci - t command, the lspci - vvv command, and the dmidecode - type9, obtain the first bandwidth information corresponding to each PCIe device;
[0279] Based on the redfish instruction, obtain the second bandwidth information allocated by the basic input / output system to each PCIe device.
[0280] For the description of the features in the corresponding embodiments of the bandwidth test device, reference may be made to the relevant description in the corresponding embodiments of the bandwidth test method, which will not be elaborated here one by one.
[0281] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above - mentioned embodiments of the bandwidth test method.
[0282] An embodiment of the present application further provides a computer - readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above - mentioned embodiments of the bandwidth test method when running.
[0283] In an exemplary embodiment, the above - mentioned computer - readable storage medium may include, but is not limited to: USB flash drive, read - only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk, or optical disc, and other various media that can store computer programs.
[0284] An embodiment of the present application further provides a computer program product. The above - mentioned computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above - mentioned embodiments of the bandwidth test method.
[0285] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium storing a computer program, and the computer program, when executed by a processor, implements the steps in any of the above bandwidth test method embodiments.
[0286] 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 both. 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. 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 to exceed the scope of the present application.
[0287] The above has introduced in detail a bandwidth test method provided by the present application. Specific examples are used herein 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 the technical field, without departing from the principle of the present application, several improvements and modifications can 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 bandwidth testing method, characterized in that including: obtaining first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices; comparing the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result; the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
2. The bandwidth testing method according to claim 1, wherein The comparing the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result includes: when the first bandwidth information and the second bandwidth information corresponding to the same PCIe device do not match, obtaining that the test result corresponding to the same PCIe device is abnormal information; when the first bandwidth information and the second bandwidth information corresponding to the same PCIe device match, obtaining that the test result corresponding to the same PCIe device is pass information.
3. The bandwidth testing method according to claim 1, wherein The first bandwidth information includes at least one of slot bandwidth, maximum supported bandwidth of the device, current operating bandwidth, and generated bandwidth.
4. The bandwidth test method according to any one of claims 1-3, characterized in that When the first bandwidth information includes the maximum supported bandwidth of the device and the current operating bandwidth, the method further includes: comparing the maximum supported bandwidth and the current operating bandwidth corresponding to the same PCIe device to obtain the test result.
5. The bandwidth testing method according to any one of claims 1 to 3, characterized in that The obtaining first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices includes: based on the identification information corresponding to each PCIe device, obtaining the first bandwidth information corresponding to each PCIe device and the second bandwidth information allocated by the basic input / output system to each of the PCIe devices.
6. The bandwidth testing method according to claim 5, characterized in that The identification information includes the corresponding relationships between the bus numbers corresponding to each of the PCIe devices and the device numbers, function numbers, and slot numbers respectively.
7. The bandwidth testing method according to any one of claims 1-3, characterized in that When each PCIe device is set in a Linux operating system, the obtaining first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices includes: based on at least one of the lspci - t command, the lspci - vvv command, and the dmidecode - type9, obtaining the first bandwidth information corresponding to each PCIe device; based on the redfish instruction, obtaining the second bandwidth information allocated by the basic input / output system to each of the PCIe devices.
8. A bandwidth testing device, characterized in that, including: a first processing module, configured to obtain first bandwidth information corresponding to each PCIe device and second bandwidth information allocated by the basic input / output system to each of the PCIe devices; a second processing module, configured to compare the first bandwidth information and the second bandwidth information corresponding to the same PCIe device to obtain a test result; the test result is used to characterize the correctness of the second bandwidth information allocated by the basic input / output system.
9. An electronic device, characterized in that, including: a memory, configured to store a computer program; A processor, configured to implement the steps of the bandwidth testing method according to any one of claims 1 to 7 when executing the computer program.
10. 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 bandwidth testing method according to any one of claims 1 to 7 when executed by a processor.