Dynamic adjustment method, device, electronic device and storage medium for port arbitration

By obtaining and adjusting the port arbitration table of the PCIe Switch, the arbitration priority is dynamically adjusted based on the device connection status and transaction data of the downstream port, which solves the arbitration problem when the PCIe device is expanded and improves the PCIe bus utilization and server performance.

CN115941776BActive Publication Date: 2024-10-22INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202211364381.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-02
Publication Date
2024-10-22
Estimated Expiration
2042-11-02

AI Technical Summary

Technical Problem

In the existing technology, the PCIe Switch in the server design has a limited PCIe bus of the processor CPU, which leads to the need for arbitration when the PCIe device is expanded. How to adjust the arbitration priority of the port to improve the PCIe bus utilization is an urgent technical problem that needs to be solved. .

Method used

By obtaining the port arbitration table of the target chip, based on the device connection status and transaction data of the downstream port, the time slice proportion of the port arbitration table is adjusted in real time, and the arbitration priority of each port is dynamically adjusted to ensure efficient utilization of the PCIe bus.

Benefits of technology

It achieves dynamic adjustment of the arbitration priority of each port, improves PCIe bus utilization, and improves server performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115941776B_ABST
    Figure CN115941776B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, electronic device and storage medium for dynamically adjusting port arbitration, the method comprising: obtaining a port arbitration table of a target chip; initializing the port arbitration table based on the device connection status of the downstream port of the target chip; obtaining the transaction data of each downstream port in the working state of the target chip in real time, obtaining the total transaction data based on the transaction data of each downstream port, and obtaining a first target ratio of the transaction data to the total transaction data; adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio. The present invention can dynamically adjust the arbitration priority of each port and improve the utilization rate of the PCIe bus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer servers, and in particular to a method, device, electronic equipment and storage medium for dynamically adjusting port arbitration. Background Art

[0002] To meet the growing functional and business needs, servers need to be equipped with more and more PCIe devices, but the PCIe bus of the processor CPU is limited, and the number of expandable PCIe devices is limited. PCIe Switch chips implement the expansion of PCIe buses and are more widely used in current server designs.

[0003] In server design, PCIe Switch generally uses one port as an upstream port to connect to the CPU PCIe bus, and extends several downstream ports to connect to the PCIe terminal device (Endpoint EP) or the upstream port of the next-level PCIe Switch to achieve PCIe bus expansion.

[0004] A PCIe Switch has multiple downstream ports and one upstream port. When multiple downstream ports send packets to the upstream port at the same time, the PCIe Switch needs to solve the arbitration problem, that is, which downstream port has priority to pass.

[0005] Therefore, how to adjust the arbitration priority of each port and improve the utilization rate of the PCIe bus is a technical problem that needs to be solved urgently. Summary of the invention

[0006] The present invention provides a method, device, electronic device and storage medium for dynamically adjusting port arbitration, which are used to solve the above-mentioned defects in the prior art, realize dynamic adjustment of arbitration priority of each port, and improve PCIe bus utilization.

[0007] The present invention provides a method for dynamically adjusting port arbitration, comprising:

[0008] Get the port arbitration table of the target chip;

[0009] Initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0010] Acquire transaction data of each downstream port in the working state of the target chip in real time, obtain total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data;

[0011] The time slice proportion of the port arbitration table of the target downstream port is adjusted based on the first target ratio.

[0012] According to a dynamic adjustment method of port arbitration provided by the present invention, the port arbitration table is initialized based on the device connection status of the downstream port of the target chip, comprising:

[0013] Detecting whether a downstream port of the target chip is connected to a terminal device, and obtaining a detection result of the downstream port;

[0014] When the detection result is that the terminal device is not connected, changing the port number in the port arbitration table of the downstream port to a target reserved value;

[0015] During the arbitration process, the port arbitration table is initialized based on the target reservation value.

[0016] According to a dynamic adjustment method for port arbitration provided by the present invention, during the arbitration process, initializing the port arbitration table based on the target reserved value includes:

[0017] During the arbitration process, when the arbitration target is the first time slice in which the target reserved value is written, skipping the first time slice corresponding to the target reserved value;

[0018] Transferring the arbitration target to the second time slice until all the time slices are traversed to complete the initialization of the port arbitration table;

[0019] The second time slice is the next time slice of the first time slice in the port arbitration table.

[0020] According to a dynamic adjustment method for port arbitration provided by the present invention, the real-time acquisition of transaction data of each downstream port in the working state of the target chip includes:

[0021] Monitoring the data exchange between the terminal devices at each downstream port in the working state of the target chip;

[0022] The result of data exchange is obtained at fixed intervals to obtain the transaction data of each downstream port.

[0023] According to a dynamic adjustment method for port arbitration provided by the present invention, the method of adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio includes:

[0024] Confirming a balanced ratio of the time slices of the port arbitration table of the target downstream port to all the time slices of the port arbitration table of the target chip;

[0025] The balancing ratio is adjusted to the first target ratio to adjust the time slice ratio of the port arbitration table of the target downstream port.

[0026] According to a method for dynamically adjusting port arbitration provided by the present invention, before obtaining the port arbitration table of the target chip, the method further includes:

[0027] Connecting the upstream port of the target chip to a server bus, and connecting the downstream port of the target chip to a plurality of target devices;

[0028] The target device includes the terminal device and / or a target chip at a next level.

[0029] According to a method for dynamically adjusting port arbitration provided by the present invention, before confirming that the time slices of the port arbitration table of the target downstream port account for a balanced proportion of all the time slices of the port arbitration table of the target chip, the method further includes:

[0030] Confirm the maximum number of ports supported by the target chip, and make a one-to-one correspondence between each downstream port and the port number;

[0031] The balancing ratio of the time slices of each of the port numbers is obtained, and the balancing configuration of each of the port numbers is completed based on the balancing ratio.

[0032] The present invention also provides a dynamic adjustment device for port arbitration, comprising:

[0033] An acquisition module, used to acquire the port arbitration table of the target chip;

[0034] An initialization module, used for initializing the port arbitration table based on the device connection status of the downstream port of the target chip;

[0035] A real-time module, used for acquiring in real time the transaction data of each downstream port in the working state of the target chip, obtaining total transaction data based on the transaction data of each downstream port, and obtaining a first target ratio of the transaction data to the total transaction data;

[0036] An adjustment module is used to adjust the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio.

[0037] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the dynamic adjustment method for port arbitration as described above is implemented.

[0038] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the dynamic adjustment method of port arbitration as described in any one of the above is implemented.

[0039] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for dynamically adjusting port arbitration.

[0040] The method, device, electronic device and storage medium for dynamic adjustment of port arbitration provided by the present invention obtain the port arbitration table of the target chip, then initialize the port arbitration table based on the device connection status of the downstream port of the PCIe Switch, obtain the transaction data of each downstream port in the working state of the PCIe Switch in real time, obtain the total transaction data based on the transaction data of each downstream port, and obtain the first target ratio of the transaction data to the total transaction data, and adjust the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio. The present invention can adjust the time slice ratio of the port arbitration table by the first target ratio of the transaction data of the downstream port to the total transaction data, so as to dynamically adjust the arbitration priority of each port and improve the utilization rate of the PCIe bus. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 It is one of the flow charts of the dynamic adjustment method of port arbitration provided by the present invention;

[0043] Figure 2 It is a connection diagram of the uplink port and the downlink port of the PCIe Switch provided by the present invention;

[0044] Figure 3 This is the second flow chart of the dynamic adjustment method of port arbitration provided by the present invention;

[0045] Figure 4 It is a structural schematic diagram of a dynamic adjustment device for port arbitration provided by the present invention;

[0046] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

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

[0048] First of all, it should be noted that the execution subject of the dynamic adjustment method of port arbitration provided by the present invention can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), or a personal computer (PC), etc., which is not specifically limited by the present invention. The following describes in detail the steps of the present invention by using a computer to execute the dynamic adjustment method of port arbitration provided by the present invention.

[0049] Reference Figure 1 , Figure 1 It is a flow chart of the dynamic adjustment method of port arbitration provided by the present invention, including step 110, step 120, step 130, and step 140.

[0050] Step 110: Obtain the port arbitration table of the target chip;

[0051] Step 120: Initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0052] Step 130: acquiring transaction data of each downstream port in the working state of the target chip in real time, obtaining total transaction data based on the transaction data of each downstream port, and obtaining a first target ratio of the transaction data to the total transaction data;

[0053] Step 140: adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio.

[0054] Specifically, in the above step 110, the target chip is a PCIe Switch (Peripheral Component Interconnect express Switch, a high-speed serial computer expansion bus standard converter), that is, a chip that connects the upstream CPU PCIe bus and the downstream device. Figure 2 In the server design, PCIe Switch 210 generally uses one port as an upstream port to connect to CPU PCIe bus 220, and extends several downstream ports to connect to PCIe terminal devices (EndpointEP) or the upstream port of the next-level PCIe Switch to achieve PCIe bus expansion. Figure 2 As shown, the PCIe Switch expands one PCIe bus into four buses, each of which is connected to four PCIe devices 230 , and all four devices can communicate with the CPU.

[0055] There is a port arbitration table inside the PCIe Switch. The table is divided into 128 Phases (time slices). A port number is filled in each Phase. According to the order of Phase 0 to Phase 127, the Switch processes a PCIe transaction of the corresponding port in the current Phase and moves to the next Phase after a certain period of time.

[0056] For different PCIe Switch designs, designers need to set a port arbitration table based on the downstream port allocation and make specific configurations for the port arbitration of the PCIe Switch by burning firmware.

[0057] In this embodiment, the arbitration table of the PCIe Switch has an offline default value recorded in the Switch by means of an attachment burning method. The default value is set by the developer. Generally, the maximum number of ports supported by the PCIe Switch under the current design is configured in a balanced manner with the corresponding port numbers in the arbitration table.

[0058] Next, in step 120, the port arbitration table is initialized according to the device connection status of the downstream port of the PCIe Switch. The purpose of the initialization is to avoid wasting time for the port connected to the device.

[0059] The initialization process is as follows: first, it detects whether there is a PCIe device connected to the downstream port. When one or more downstream ports are not connected to a PCIe device, the Switch changes the corresponding port number in its port arbitration table to a reserved value (the reserved value does not conflict with the value of any port number. When the Switch moves to a Phase with a reserved value during the arbitration process, it will immediately skip the Phase and move to the next Phase), thereby avoiding the Switch consuming time on the non-working port.

[0060] In step 130, the transaction data of each downstream port in the working state of the PCIe Switch is acquired in real time, and then the total transaction data is obtained based on the transaction data of each downstream port to obtain a first target ratio of the transaction data to the total transaction data.

[0061] For example, the total transaction data of all ports is calculated to obtain the value M, and then the transaction data of each downstream port is obtained, such as port 1, port 2, port 3 and port 4 are respectively recorded as m 1 、m 2 、m 3 and m 4 . Where M = m 1 +m 2 +m 3 +m 4 Then calculate m 1 、m 2 、m 3 and m 4 A is the proportion of M 1 , A 2 , A 3 , A 4 .

[0062] Finally, through step 140, using A 1 , A 2 , A 3 , A 4 Adjust the time slice ratio of the port arbitration table of the target downstream port.

[0063] It should be noted that the first target ratio A 1 , A 2 , A 3 , A 4 It can be used as the ratio of the time slice Phase of port 1, port 2, port 3 and port 4 to all ports, that is, the entire port arbitration table.

[0064] It should be noted that the number of time slices in the PCIe Switch in this embodiment is 128, so the maximum number of supported ports in the working state is 1 , A 2 , A3 , A 4 The number of time slices in a balanced configuration is 32.

[0065] When the transaction data volume of downstream port 1 accounts for 50% of the total transaction data of the downstream port, that is, the first target ratio is 50%, the Switch will make corresponding dynamic adjustments and update the original balanced ratio of 25% of the arbitration table that evenly sets the port number to 50% of port 1 in all Phases, that is, adjust the 32 time slices of downstream port 1 to 64 time slices, and update other ports in the same way.

[0066] The dynamic adjustment method of port arbitration provided by the embodiment of the present invention obtains the port arbitration table of the target chip, and then initializes the port arbitration table based on the device connection status of the downstream port of the PCIe Switch, obtains the transaction data of each downstream port in the working state of the PCIeSwitch in real time, obtains the total transaction data based on the transaction data of each downstream port, obtains the first target ratio of the transaction data to the total transaction data, and adjusts the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio. The present invention can adjust the time slice ratio of the port arbitration table through the first target ratio of the transaction data of the downstream port to the total transaction data, so as to dynamically adjust the arbitration priority of each port and improve the utilization rate of the PCIe bus.

[0067] In some embodiments, the initializing the port arbitration table based on the device connection status of the downstream port of the target chip includes:

[0068] Detecting whether a downstream port of the target chip is connected to a terminal device, and obtaining a detection result of the downstream port;

[0069] When the detection result is that the terminal device is not connected, changing the port number in the port arbitration table of the downstream port to a target reserved value;

[0070] During the arbitration process, the port arbitration table is initialized based on the target reservation value.

[0071] This implementation provides an implementation method for initializing a port arbitration table.

[0072] First, it is necessary to detect whether the downstream port of the PCIe Switch is connected to a terminal device, and obtain a detection result of "yes" or "no".

[0073] When the detection result is "No", that is, it is detected that one or more downstream ports of the PCIe Switch are not connected to a terminal device, the PCIe Switch changes the corresponding port number in its port arbitration table to a reserved value. For example, when port 1 is not connected to a terminal device, the PCIe Switch will change port 1 to the target reserved value, which can be set to a value that does not conflict with any port.

[0074] When the switch moves to the Phase with the reserved value port during the arbitration process, it will immediately skip the Phase and move to the next Phase until the Phases of all ports are traversed to complete the initialization of the port arbitration table.

[0075] Optionally, during the arbitration process, initializing the port arbitration table based on the target reserved value includes:

[0076] During the arbitration process, when the arbitration target is the first time slice in which the target reserved value is written, skipping the first time slice corresponding to the target reserved value;

[0077] Transferring the arbitration target to the second time slice until all the time slices are traversed to complete the initialization of the port arbitration table;

[0078] The second time slice is the next time slice of the first time slice in the port arbitration table.

[0079] This embodiment further refines the initialization process of the port arbitration table. During the arbitration process, if the arbitration target is the first time slice of the port with the target reserved value written in it, the first time slice will be skipped and the arbitration target will be transferred to the next time slice, that is, the second time slice. If the second time slice still has the target reserved value written in it, the second time slice will continue to be skipped and the arbitration target will be transferred to the next time slice, that is, the third time slice, until all time slices are traversed and the initialization of the port arbitration table is completed.

[0080] The dynamic adjustment method of port arbitration provided by the embodiment of the present invention detects whether the downstream port of the PCIe Switch is connected to a terminal device, sets a target reserved value for the downstream port according to the detection result, and skips the time slice of the port with the target reserved value during the arbitration process, thereby avoiding time consumption on the port that is not connected to the terminal device, thereby improving the port arbitration efficiency and enhancing the server performance.

[0081] In some embodiments, the real-time acquisition of transaction data of each downstream port of the target chip in the working state includes:

[0082] Monitoring the data exchange between the terminal devices at each downstream port in the working state of the target chip;

[0083] The result of data exchange is obtained at fixed intervals to obtain the transaction data of each downstream port.

[0084] Specifically, this embodiment provides an implementation process for obtaining data of each port in the working state of a PCIe Switch in real time.

[0085] It can be understood that this embodiment can monitor the data exchange process between the terminal devices of each downstream port in the working state of the PCIe Switch in real time. The result of the data exchange is obtained every fixed time. The fixed time can be selected as one second, that is, the result of the data exchange is obtained every one second. The fixed time can be determined according to the actual situation and is not limited here. For example, the data exchange between port 1 and port 2, port 3, etc. is monitored, including data sending and data receiving, etc., and the monitoring results of the data exchange are summarized to obtain the transaction data of port 1 in the working state.

[0086] The dynamic adjustment method of port arbitration provided by the embodiment of the present invention obtains the result of a data exchange of each downstream port at fixed intervals to obtain the transaction data of each downstream port, thereby dynamically adjusting the time slice of the port according to the proportion of the transaction data of the port to the total transaction data, thereby updating the arbitration strategy according to the real-time transaction data of each port and improving the utilization rate of the PCIe bus.

[0087] In some embodiments, adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio includes:

[0088] Confirming a balanced ratio of the time slices of the port arbitration table of the target downstream port to all the time slices of the port arbitration table of the target chip;

[0089] The balancing ratio is adjusted to the first target ratio to adjust the time slice ratio of the port arbitration table of the target downstream port.

[0090] It can be understood that this embodiment provides an implementation process for dynamically adjusting downstream port arbitration.

[0091] This embodiment is described by taking the downstream port 2 as an example. First, it is confirmed that the maximum number of downstream ports supported by the PCIe Switch is 4, then the time slices evenly allocated to each port are 32, that is, the time slices of the downstream port 2 account for 25% of all the time slices.

[0092] According to the first target ratio obtained in the above embodiment, it represents the ratio of the transaction data of the downstream port 2 to the total transaction data of all the downstream ports, for example, 50%. Then the ratio of the time slices of the evenly distributed downstream port 2 to all the time slices is adjusted from 25 to 50%. In layman's terms, the time slice ratio and the transaction data ratio are unified, so that the time slice ratio can be dynamically adjusted according to the amount of transactions of the target port, which reasonably improves the time slice utilization rate, thereby further improving the bus utilization rate.

[0093] The dynamic adjustment method of port arbitration provided in the embodiment of the present invention unifies the proportion of port time slices in a balanced configuration with the proportion of transaction data, and dynamically adjusts the arbitration priority of the corresponding port according to the amount of real-time business volume of different terminal devices under the same Switch during the operation of the server, thereby improving the utilization rate of the PCIe bus and enhancing the server performance.

[0094] In some embodiments, before obtaining the port arbitration table of the target chip, the method further includes:

[0095] Connecting the upstream port of the target chip to a server bus, and connecting the downstream port of the target chip to a plurality of target devices;

[0096] The target device includes the terminal device and / or a target chip at a next level.

[0097] This embodiment is a connection configuration process of the upstream port and downstream port of the PCIe Switch. In the server design, the PCIe Switch generally uses one port as the upstream port to connect the CPU PCIe bus, and expands several downstream ports to connect the PCIe terminal device (Endpoint EP) or the upstream port of the next-level PCIe Switch to achieve the expansion of the PCIe bus. The PCIeSwitch expands one PCIe bus into four, each connected to four PCIe devices, and all four devices can communicate with the CPU.

[0098] In some embodiments, before confirming that the time slices of the port arbitration table of the target downstream port account for a balanced proportion of all the time slices of the port arbitration table of the target chip, the method further includes:

[0099] Confirm the maximum number of ports supported by the target chip, and make a one-to-one correspondence between each downstream port and the port number;

[0100] The balancing ratio of the time slices of each of the port numbers is obtained, and the balancing configuration of each of the port numbers is completed based on the balancing ratio.

[0101] It can be understood that this embodiment is a configuration process for each downstream port. First, it is necessary to confirm the maximum number of ports supported by the PCIe Switch, which usually supports 4 ports. Each downstream port is matched with the port number to facilitate the subsequent confirmation of the connection status of the terminal device. The port number is changed to the target reserved value according to the connection status, so that the port arbitration strategy is updated according to different configurations during the arbitration process to avoid time waste. After completing the balanced configuration of each downstream port, the arbitration strategy can be updated according to the real-time transaction volume of each downstream port to improve the utilization rate of the PCIe bus.

[0102] Reference Figure 3 , Figure 3 It is a flow chart of the dynamic adjustment method of port arbitration provided by the present invention, including step 310, step 320, step 330, step 340 and step 350.

[0103] Step 310: PCIe initialization after power-on or reset;

[0104] Step 320, PCle Switch obtains the status of the downstream port device;

[0105] Step 330, setting the initial value of the port arbitration table according to the device in place;

[0106] Step 340, the PCle Switch monitors the transaction volume of each downstream port in real time;

[0107] Step 350: The PCle Switch modifies the proportion of the Phase occupied by each port in the arbitration table according to the proportion of the transaction volume of each port.

[0108] The dynamic adjustment device for port arbitration provided by the present invention is described below. The dynamic adjustment device for port arbitration described below and the dynamic adjustment method for port arbitration described above can be referred to each other.

[0109] Reference Figure 4 , Figure 4 : is a schematic diagram of the structure of the dynamic adjustment device of port arbitration provided by the present invention, comprising the following modules:

[0110] An acquisition module 410 is used to acquire a port arbitration table of a target chip;

[0111] An initialization module 420, configured to initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0112] The real-time module 430 is used to obtain the transaction data of each downstream port in the working state of the target chip in real time, obtain the total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data;

[0113] The adjustment module 440 is configured to adjust the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio.

[0114] Specifically, in the above acquisition module 410, the target chip PCIe Switch is a chip that connects the upstream CPU PCIe bus and the downstream device. Figure 2 In server design, PCIe Switch generally uses one port as an upstream port to connect to the CPU PCIe bus, and extends several downstream ports to connect to the PCIe terminal device (Endpoint EP) or the upstream port of the next-level PCIe Switch to achieve PCIe bus expansion. Figure 2 As shown, the PCIe Switch expands one PCIe bus into four bus lines, each of which connects four PCIe devices. All four devices can communicate with the CPU.

[0115] There is a port arbitration table inside the PCIe Switch. The table is divided into 128 Phases (time slices). A port number is filled in each Phase. According to the order of Phase 0 to Phase 127, the Switch processes a PCIe transaction of the corresponding port in the current Phase and moves to the next Phase after a certain period of time.

[0116] For different PCIe Switch designs, designers need to set a port arbitration table based on the downstream port allocation and make specific configurations for the port arbitration of the PCIe Switch by burning firmware.

[0117] In this embodiment, the arbitration table of the PCIe Switch has an offline default value recorded in the Switch by means of an attachment burning method. The default value is set by the developer. Generally, the maximum number of ports supported by the PCIe Switch under the current design is configured in a balanced manner with the corresponding port numbers in the arbitration table.

[0118] Next, in the initialization module 420, the port arbitration table is initialized according to the device connection status of the downstream port of the PCIe Switch. The purpose of the initialization is to avoid wasting time for the port connected to the device.

[0119] The initialization process is as follows: first, it detects whether there is a PCIe device connected to the downstream port. When one or more downstream ports are not connected to a PCIe device, the Switch changes the corresponding port number in its port arbitration table to a reserved value (the reserved value does not conflict with the value of any port number. When the Switch moves to a Phase with a reserved value during the arbitration process, it will immediately skip the Phase and move to the next Phase), thereby avoiding the Switch consuming time on the non-working port.

[0120] In the real-time module 430, the transaction data of each downstream port in the working state of the PCIe Switch is obtained in real time, and then the total transaction data is obtained based on the transaction data of each downstream port to obtain a first target ratio of the transaction data to the total transaction data.

[0121] For example, the total transaction data of all ports is calculated to obtain the value M, and then the transaction data of each downstream port is obtained, such as port 1, port 2, port 3 and port 4 are respectively recorded as m 1 、m 2 、m 3 and m 4 . Where M = m 1 +m 2 +m 3 +m 4 Then calculate m 1 、m 2 、m 3 and m 4 A is the proportion of M 1 , A 2 , A 3 , A 4 .

[0122] Finally, by adjusting module 440, using A 1 , A 2 , A 3 , A 4 Adjust the time slice ratio of the port arbitration table of the target downstream port.

[0123] It should be noted that the first target ratio A 1 , A 2 , A 3 , A 4 It can be used as the ratio of the time slice Phase of port 1, port 2, port 3 and port 4 to all ports, that is, the entire port arbitration table.

[0124] It should be noted that the number of time slices in the PCIe Switch in this embodiment is 128, so the maximum number of supported ports in the working state is 1 , A 2 , A3 , A 4 The number of time slices in a balanced configuration is 32.

[0125] When the transaction data volume of downstream port 1 accounts for 50% of the total transaction data of the downstream port, that is, the first target ratio is 50%, the Switch will make corresponding dynamic adjustments and update the original balanced ratio of 25% of the arbitration table that evenly sets the port number to 50% of port 1 in all Phases, that is, adjust the 32 time slices of downstream port 1 to 64 time slices, and update other ports in the same way.

[0126] The dynamic adjustment device of port arbitration provided by the embodiment of the present invention obtains the port arbitration table of the target chip, and then initializes the port arbitration table based on the device connection status of the downstream port of the PCIe Switch, obtains the transaction data of each downstream port in the working state of the PCIeSwitch in real time, obtains the total transaction data based on the transaction data of each downstream port, and obtains the first target ratio of the transaction data to the total transaction data, and adjusts the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio. The present invention can adjust the time slice ratio of the port arbitration table through the first target ratio of the transaction data of the downstream port to the total transaction data, so as to dynamically adjust the arbitration priority of each port and improve the utilization rate of the PCIe bus.

[0127] In some embodiments, the initialization module is specifically used to:

[0128] Detecting whether a downstream port of the target chip is connected to a terminal device, and obtaining a detection result of the downstream port;

[0129] When the detection result is that the terminal device is not connected, changing the port number in the port arbitration table of the downstream port to a target reserved value;

[0130] During the arbitration process, the port arbitration table is initialized based on the target reservation value.

[0131] In some embodiments, the initialization module is further configured to:

[0132] During the arbitration process, when the arbitration target is the first time slice in which the target reserved value is written, skipping the first time slice corresponding to the target reserved value;

[0133] Transferring the arbitration target to the second time slice until all the time slices are traversed to complete the initialization of the port arbitration table;

[0134] The second time slice is the next time slice of the first time slice in the port arbitration table.

[0135] Specifically, the function of the initialization module is: first, it is necessary to detect whether the downstream port of the PCIe Switch is connected to a terminal device, and obtain a detection result of "yes" or "no".

[0136] When the detection result is "No", that is, it is detected that one or more downstream ports of the PCIe Switch are not connected to a terminal device, the PCIe Switch changes the corresponding port number in its port arbitration table to a reserved value. For example, when port 1 is not connected to a terminal device, the PCIe Switch will change port 1 to the target reserved value, which can be set to a value that does not conflict with any port.

[0137] When the switch moves to the Phase with the reserved value port during the arbitration process, it will immediately skip the Phase and move to the next Phase until the Phases of all ports are traversed to complete the initialization of the port arbitration table.

[0138] Furthermore, during the arbitration process, if the arbitration target is the first time slice of the port with the target reserved value written in it, the first time slice will be skipped and the arbitration target will be transferred to the next time slice, i.e., the second time slice. If the target reserved value is still written in the second time slice, the second time slice will continue to be skipped and the arbitration target will be transferred to the next time slice, i.e., the third time slice, until all time slices are traversed and the initialization of the port arbitration table is completed.

[0139] The dynamic adjustment device for port arbitration provided by the embodiment of the present invention detects whether a downstream port of a PCIe Switch is connected to a terminal device, sets a target reserved value for the downstream port according to the detection result, and skips the time slice of the port with the target reserved value during the arbitration process, thereby avoiding time consumption on the port to which the terminal device is not connected, thereby improving the port arbitration efficiency and enhancing the server performance.

[0140] In some embodiments, the real-time module is specifically used to:

[0141] Monitoring the data exchange between the terminal devices at each downstream port in the working state of the target chip;

[0142] The result of data exchange is obtained at fixed intervals to obtain the transaction data of each downstream port.

[0143] It can be understood that this embodiment can monitor the data exchange process between the terminal devices of each downstream port in the working state of the PCIe Switch in real time. The result of data exchange is obtained at a fixed time interval. For example, the data exchange between port 1 and port 2, port 3, etc. is monitored, including data sending and data receiving, etc., and the monitoring results of data exchange are summarized to obtain the transaction data of port 1 in the working state.

[0144] The dynamic adjustment device for port arbitration provided by the embodiment of the present invention obtains the result of a data exchange of each downstream port at fixed intervals to obtain the transaction data of each downstream port, thereby dynamically adjusting the time slice of the port according to the proportion of the transaction data of the port to the total transaction data, thereby updating the arbitration strategy according to the real-time transaction data of each port and improving the utilization rate of the PCIe bus.

[0145] In some embodiments, the adjustment module is specifically used to:

[0146] Confirming a balanced ratio of the time slices of the port arbitration table of the target downstream port to all the time slices of the port arbitration table of the target chip;

[0147] The balancing ratio is adjusted to the first target ratio to adjust the time slice ratio of the port arbitration table of the target downstream port.

[0148] It can be understood that this embodiment provides an implementation process for dynamically adjusting downstream port arbitration.

[0149] This embodiment is described by taking the downstream port 2 as an example. First, it is confirmed that the maximum number of downstream ports supported by the PCIe Switch is 4, then the time slices evenly allocated to each port are 32, that is, the time slices of the downstream port 2 account for 25% of all the time slices.

[0150] According to the first target ratio obtained in the above embodiment, it represents the ratio of the transaction data of the downstream port 2 to the total transaction data of all the downstream ports, for example, 50%. Then the ratio of the time slices of the evenly distributed downstream port 2 to all the time slices is adjusted from 25 to 50%. In layman's terms, the time slice ratio and the transaction data ratio are unified, so that the time slice ratio can be dynamically adjusted according to the amount of transactions of the target port, which reasonably improves the time slice utilization rate, thereby further improving the bus utilization rate.

[0151] The dynamic adjustment device for port arbitration provided in the embodiment of the present invention unifies the proportion of balanced configured port time slices and the proportion of transaction data, and dynamically adjusts the arbitration priority of the corresponding port according to the amount of real-time business volume of different terminal devices under the same Switch during the operation of the server, thereby improving the utilization rate of the PCIe bus and enhancing the server performance.

[0152] In some embodiments, the device further includes a connection module, wherein the connection module is specifically configured to:

[0153] Connecting the upstream port of the target chip to a server bus, and connecting the downstream port of the target chip to a plurality of target devices;

[0154] The target device includes the terminal device and / or a target chip at a next level.

[0155] This embodiment is a connection configuration process of the upstream port and downstream port of the PCIe Switch. In the server design, the PCIe Switch generally uses one port as the upstream port to connect the CPU PCIe bus, and expands several downstream ports to connect the PCIe terminal device (Endpoint EP) or the upstream port of the next-level PCIe Switch to achieve the expansion of the PCIe bus. The PCIeSwitch expands one PCIe bus into four, each connected to four PCIe devices, and all four devices can communicate with the CPU.

[0156] In some embodiments, the device further includes a configuration module, wherein the configuration module is specifically configured to:

[0157] Confirm the maximum number of ports supported by the target chip, and make a one-to-one correspondence between each downstream port and the port number;

[0158] The balancing ratio of the time slices of each of the port numbers is obtained, and the balancing configuration of each of the port numbers is completed based on the balancing ratio.

[0159] It can be understood that this embodiment is a configuration process for each downstream port. First, it is necessary to confirm the maximum number of ports supported by the PCIe Switch, which usually supports 4 ports. Each downstream port is matched with the port number to facilitate the subsequent confirmation of the connection status of the terminal device. The port number is changed to the target reserved value according to the connection status, so that the port arbitration strategy is updated according to different configurations during the arbitration process to avoid time waste. After completing the balanced configuration of each downstream port, the arbitration strategy can be updated according to the real-time transaction volume of each downstream port to improve the utilization rate of the PCIe bus.

[0160] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the dynamic adjustment method of the port arbitration, and the method includes:

[0161] Get the port arbitration table of the target chip;

[0162] Initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0163] Acquire transaction data of each downstream port in the working state of the target chip in real time, obtain total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data;

[0164] The time slice proportion of the port arbitration table of the target downstream port is adjusted based on the first target ratio.

[0165] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0166] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the dynamic adjustment method of port arbitration provided by the above methods, the method comprising:

[0167] Get the port arbitration table of the target chip;

[0168] Initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0169] Acquire transaction data of each downstream port in the working state of the target chip in real time, obtain total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data;

[0170] The time slice proportion of the port arbitration table of the target downstream port is adjusted based on the first target ratio.

[0171] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for dynamically adjusting port arbitration provided by the above methods is implemented, and the method comprises:

[0172] Get the port arbitration table of the target chip;

[0173] Initialize the port arbitration table based on the device connection status of the downstream port of the target chip;

[0174] Acquire transaction data of each downstream port in the working state of the target chip in real time, obtain total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data;

[0175] The time slice proportion of the port arbitration table of the target downstream port is adjusted based on the first target ratio.

[0176] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0177] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for dynamically adjusting port arbitration, characterized in that: include: Get the port arbitration table of the target chip; Initialize the port arbitration table based on the device connection status of the downstream port of the target chip; Acquire transaction data of each downstream port in the working state of the target chip in real time, obtain total transaction data based on the transaction data of each downstream port, and obtain a first target ratio of the transaction data to the total transaction data; Adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio; The initializing the port arbitration table based on the device connection status of the downstream port of the target chip includes: Detecting whether a downstream port of the target chip is connected to a terminal device, and obtaining a detection result of the downstream port; When the detection result is that the terminal device is not connected, changing the port number in the port arbitration table of the downstream port to a target reserved value; During arbitration, initializing the port arbitration table based on the target reserved value; Wherein, during the arbitration process, initializing the port arbitration table based on the target reserved value includes: During the arbitration process, when the arbitration target is the first time slice in which the target reserved value is written, skipping the first time slice corresponding to the target reserved value; Transferring the arbitration target to the second time slice until all the time slices are traversed to complete the initialization of the port arbitration table; The second time slice is the next time slice of the first time slice in the port arbitration table; The adjusting the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio includes: Confirming a balanced ratio of the time slices of the port arbitration table of the target downstream port to all the time slices of the port arbitration table of the target chip; The balancing ratio is adjusted to the first target ratio to adjust the time slice ratio of the port arbitration table of the target downstream port.

2. The method for dynamically adjusting port arbitration according to claim 1, characterized in that: The real-time acquisition of transaction data of each downstream port in the working state of the target chip includes: Monitoring the data exchange between the terminal devices at each downstream port in the working state of the target chip; The result of data exchange is obtained at fixed intervals to obtain the transaction data of each downstream port.

3. The method for dynamically adjusting port arbitration according to claim 1, characterized in that: Before obtaining the port arbitration table of the target chip, the method further includes: Connecting the upstream port of the target chip to a server bus, and connecting the downstream port of the target chip to a plurality of target devices; The target device includes the terminal device and / or a target chip at a next level.

4. The method for dynamically adjusting port arbitration according to claim 1, characterized in that: Before confirming that the time slices of the port arbitration table of the target downstream port account for a balanced proportion of all the time slices of the port arbitration table of the target chip, the method further includes: Confirm the maximum number of ports supported by the target chip, and make a one-to-one correspondence between each downstream port and the port number; The balancing ratio of the time slices of each of the port numbers is obtained, and the balancing configuration of each of the port numbers is completed based on the balancing ratio.

5. A dynamic adjustment device for port arbitration, characterized in that: include: An acquisition module, used to acquire the port arbitration table of the target chip; An initialization module, used for initializing the port arbitration table based on the device connection status of the downstream port of the target chip; A real-time module, used for acquiring in real time the transaction data of each downstream port in the working state of the target chip, obtaining total transaction data based on the transaction data of each downstream port, and obtaining a first target ratio of the transaction data to the total transaction data; An adjustment module, configured to adjust the time slice ratio of the port arbitration table of the target downstream port based on the first target ratio; Wherein, the device is also used for: Detecting whether a downstream port of the target chip is connected to a terminal device, and obtaining a detection result of the downstream port; When the detection result is that the terminal device is not connected, changing the port number in the port arbitration table of the downstream port to a target reserved value; During arbitration, initializing the port arbitration table based on the target reserved value; The device is also used for: During the arbitration process, when the arbitration target is the first time slice in which the target reserved value is written, skipping the first time slice corresponding to the target reserved value; Transferring the arbitration target to the second time slice until all the time slices are traversed to complete the initialization of the port arbitration table; The second time slice is the next time slice of the first time slice in the port arbitration table; The device is also used for: Confirming a balanced ratio of the time slices of the port arbitration table of the target downstream port to all the time slices of the port arbitration table of the target chip; The balancing ratio is adjusted to the first target ratio to adjust the time slice ratio of the port arbitration table of the target downstream port.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the dynamic adjustment method for port arbitration according to any one of claims 1 to 4 is implemented.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for dynamically adjusting port arbitration according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method and system for multi-channel data transmission

    CN101520714A

  • Access control method of synchronous dynamic memory

    CN102033832A

  • Arbitrating stream transactions based on information related to the stream transaction(s)

    CN103201728A

  • Storage apparatus data service quality management method and storage apparatus

    CN105867835A

  • Queuing arbitration method and device for procedures and terminal equipment

    CN111950879A