Method and device for determining target input equipment, storage medium and electronic equipment

By combining the lottery arbitration module and the timeout status judgment module in the arbiter, comparing the waiting time and the timeout threshold of each port, and calculating the third lottery value to determine the target input device, the problem of low arbitration efficiency in the existing technology is solved and improved System performance.

CN118733503APending Publication Date: 2024-10-01SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410706142.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When multiple input devices compete for the same bus, the existing arbiter has poor arbitration efficiency, resulting in reduced system performance and possible loop failure.

Method used

An arbiter including a lottery arbitration module and a timeout status judgment module is designed. By comparing the waiting time and the timeout threshold of each port, the target input device is determined, and the third lottery value is calculated based on the bandwidth ratio and the lottery value generated in real time to determine Target input device.

Benefits of technology

It improves the arbitration efficiency of multiple input devices, avoids the problem of loop failure, and ensures the improvement of system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733503A_ABST
    Figure CN118733503A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a target input equipment determination method and device, a storage medium and electronic equipment, and the method comprises the steps: comparing the waiting time of any port in a plurality of first ports with the timeout threshold of any port through a timeout state judgment module, and obtaining a comparison result; and under the condition that the comparison result indicates that the waiting time is less than the overtime threshold, determining a third lottery value of any port according to the first lottery value and the second lottery value through the lottery arbitration module, and determining a target input device in the plurality of input devices according to the third lottery value, the first lottery ticket value is a lottery ticket value allocated to any port in advance by the lottery ticket arbitration module through a bandwidth ratio corresponding to a plurality of input devices, and the second lottery ticket value is a lottery ticket value generated by the additional lottery ticket generation module for any port in real time; and under the condition that the comparison result indicates that the waiting time is greater than or equal to the overtime threshold, determining the input equipment corresponding to any port as target input equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of computer networks and communication technologies, and in particular, to a method and apparatus for determining a target input device, a storage medium, and an electronic device. Background Art

[0002] The arbitrator selects one of the competing modules (i.e., input devices, which refer to the modules connected to the bus and need to use the bus for data transmission, such as the central processing unit (CPU), memory, peripherals, etc.) according to a certain arbitration algorithm, and authorizes it to use the bus. In addition to ensuring less circuit consumption, the arbitrator should also follow the principles of fairness and bandwidth ratio in design, avoid the extreme situation of a single module "monopolizing" the bus or being "idle" for a long time, improve the utilization rate of the bus, and enable all modules to have the opportunity to use the bus and be authorized as much as possible according to the target bandwidth ratio. For complex system chips where competition is prevalent, the design of the arbitrator plays an important role in the allocation of on-chip resources and the improvement of system performance.

[0003] Classic arbiters include fixed priority arbitration (FP), round-robin arbitration (RR), and lottery arbitration, but a single application of a certain arbitration is often difficult to meet the usage requirements. There are also various improvement schemes in the relevant technology. For example, in one improvement scheme, the improved fixed priority (FP) and RR arbitration are used in turn in the case of no conflict and conflict, and the weight is set by the lottery item. After the weighted true value signal is successfully output, the lottery ticket of the corresponding competition module will be reduced by 1, indicating that the competition module has obtained a bus, until the lottery tickets of all competition modules are reduced to 0, completing a cycle.

[0004] The main problems with this improved solution are: 1) It is necessary to judge the requests issued by all competing modules one by one, and the arbitration process faces the problem of judgment order, which will complicate the priority of competing modules and affect the arbitration process; 2) In the arbitration process, in order to ensure that the number of times each port obtains authorization meets the bandwidth ratio, lottery tickets are used as conditions. If the number of lottery tickets of a certain port has not been reduced to 0 for a long time, the cycle may not be able to proceed, which will reduce the system performance. Therefore, it is obvious that the arbitration efficiency of this improved solution is poor.

[0005] In the related art, the problem of poor arbitration efficiency of the arbitration scheme used when multiple input devices compete for the same bus has not yet been effectively solved. Summary of the invention

[0006] The embodiments of the present application provide a method and apparatus for determining a target input device, a storage medium, and an electronic device, so as to at least solve the problem of poor arbitration efficiency of the arbitration scheme adopted by multiple input devices competing for the same bus in the related art.

[0007] According to an embodiment of the present application, a method for determining a target input device is provided, which is applied to an arbitrator, wherein the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate from the plurality of input devices a target input device that is allowed to transmit a data packet through the bus; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout status judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port; the method comprises: comparing, by the timeout status judgment module, the waiting time of any one of the plurality of first ports with the timeout status of any one of the ports; A comparison is performed between the first lottery value and the second lottery value to obtain a comparison result, wherein the waiting time is used to indicate a duration during which the input device corresponding to any one of the ports has not been determined as the target input device; if the comparison result indicates that the waiting time is less than the timeout threshold, a third lottery value of the any one of the ports is determined according to the first lottery value and the second lottery value by the lottery arbitration module, and a target input device among the multiple input devices is determined according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any one of the ports by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any one of the ports by the additional lottery generation module; if the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to the any one of the ports is determined as the target input device.

[0008] In an exemplary embodiment, determining the third lottery value of any port according to the first lottery value and the second lottery value by the lottery arbitration module includes: reading the first lottery value from a first table, wherein the first table records the first lottery values ​​pre-assigned to a plurality of the first ports respectively; and determining the second lottery value by the additional lottery generating module; and determining the sum of the first lottery value and the second lottery value as the third lottery value.

[0009] In an exemplary embodiment, determining the second lottery value by the additional lottery generating module includes: determining by the additional lottery generating module whether the total arbitration times of the multiple input devices determined as the target input devices reaches a preset window size, wherein a preset window corresponding to the preset window size is used to count the total arbitration times; when the total arbitration times does not reach the preset window size, determining the product of the bandwidth ratio and a preset scaling factor as the second lottery value; when the total arbitration times reaches the preset window size, determining the difference between an expected value and the authorized times of the input device corresponding to any one of the ports, and determining the product of the difference and the preset scaling factor as the second lottery value, wherein the expected value is determined by the preset window size and the number of the multiple first ports.

[0010] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the plurality of first ports, and the data cache module is used to cache the data packets transmitted through the plurality of first ports respectively; wherein, before the waiting time of any port among the plurality of first ports is compared with the timeout threshold of any port by the timeout status judgment module, and obtaining the comparison result, the method further comprises: determining a submodule in the data cache module for caching the data packets sent by any port; predicting the maximum number of data packets allowed to be transmitted by any port in the submodule, and obtaining the current number of data packets transmitted by any port accommodated in the submodule at the current moment; determining the difference between the maximum number and the current number; inputting the difference between the maximum number and the current number into a preset function to obtain the fluctuation value of the timeout threshold at the current moment; obtaining the minimum value preset for the timeout threshold; and calculating the timeout threshold corresponding to any port at the current moment by the sum of the minimum value and the fluctuation value.

[0011] In an exemplary embodiment, predicting the maximum number of data packets allowed to be accommodated in the submodule for transmission by any one port includes: determining the packet length of the data packets input into the submodule by any one port within a time interval from a previous moment to a current moment; calculating a second average packet length of the data packets in the submodule at the current moment based on the packet length and a first average packet length in the submodule at the previous moment; and determining the quotient of the cache depth of the submodule and the second average packet length as the maximum number.

[0012] In an exemplary embodiment, when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any one of the ports is determined as the target input device, including: calculating the quantitative relationship between the waiting time and the timeout threshold; determining the timeout level of any one of the ports according to the quantitative relationship; when there are multiple fourth ports at the same time, determining the input device corresponding to the fourth port with the highest timeout level as the target input device; wherein the fourth port is the first port whose waiting time is greater than or equal to the timeout threshold.

[0013] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the multiple first ports, and the data cache module is used to cache the data packets transmitted through the multiple first ports respectively; the data cache module is located in the first-level pipeline, and the arbitrator is located in the second-level pipeline; wherein, the method further comprises: receiving multiple requests through the first-level pipeline, and storing multiple requests to the second-level pipeline when the second-level pipeline allows receiving data packets, wherein the request carries the data packet; when any input device among the multiple input devices is determined as the target input device, the arbitration right obtained by the any input device and the request of the any input device are simultaneously sent to the exit of the second-level pipeline, wherein the arbitration right is used to indicate that the any input device is determined as the target input device.

[0014] According to another embodiment of the present application, a device for determining a target input device is provided, which is applied to an arbitrator, wherein the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate from the plurality of input devices a target input device that is allowed to transmit a data packet through the bus; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout status judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generating module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port; the device comprises: a comparison module, which is used to compare the waiting time of any of the plurality of first ports with the timeout threshold of any of the ports through the timeout status judgment module. A comparison is performed to obtain a comparison result, wherein the waiting time is used to indicate a duration during which the input device corresponding to any one of the ports has not been determined as the target input device; a first determination module is used to determine a third lottery value of any one of the ports according to the first lottery value and the second lottery value through the lottery arbitration module when the comparison result indicates that the waiting time is less than the timeout threshold, and determine the target input device among the multiple input devices according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any one of the ports by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any one of the ports by the additional lottery generation module; a second determination module is used to determine the input device corresponding to any one of the ports as the target input device when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold.

[0015] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0016] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0017] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0018] The present application provides an arbiter connected between a bus and first ports respectively included in a plurality of input devices, and used to arbitrate from the plurality of input devices a target input device that is allowed to transmit a data packet through the bus; the arbiter comprises: a lottery arbitration module connected in series between a second port and a third port of the arbiter, and a timeout status judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port; in the present application, the waiting time of any port among the plurality of the first ports is firstly compared with the timeout threshold of any port by the timeout status judgment module to obtain a comparison result, Wherein, the waiting time is used to indicate the duration of time that the input device corresponding to any port is not determined as the target input device; when the comparison result indicates that the waiting time is less than the timeout threshold, the third lottery value of any port is determined by the lottery arbitration module according to the first lottery value and the second lottery value, and the target input device among the multiple input devices is determined according to the third lottery value, wherein the first lottery value is the lottery value pre-assigned to any port by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is the lottery value generated in real time for any port by the additional lottery generation module; when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any port is determined as the target input device. Therefore, the problem of poor arbitration efficiency of the arbitration scheme adopted for multiple input devices competing for the same bus in the related art can be solved. Therefore, through the method for determining the target input device provided by the present application, multiple input devices can be efficiently arbitrated. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for determining a target input device according to an embodiment of the present application;

[0020] Figure 2 is a flow chart of a method for determining a target input device according to an embodiment of the present application;

[0021] Figure 3 is a structural schematic diagram of a routing module of a method for determining a target input device according to an embodiment of the present application;

[0022] Figure 4 is a structural schematic diagram of an adaptive arbitrator according to a method for determining a target input device according to an embodiment of the present application;

[0023] Figure 5is a statistical diagram of the number of authorizations according to the method for determining a target input device according to an embodiment of the present application;

[0024] Figure 6 is another flow chart of a method for determining a target input device according to an embodiment of the present application;

[0025] Figure 7 is a structural schematic diagram of a pipeline-based routing module according to a method for determining a target input device in an embodiment of the present application;

[0026] Figure 8 It is a structural block diagram of a device for determining a target input device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0029] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a method for determining a target input device according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for allocating load resources in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0032] The method for determining a target input device provided in an embodiment of the present application is applied to an arbitrator, wherein the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate a target input device that is allowed to transmit a data packet through the bus from the plurality of input devices; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout state judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port.

[0033] Figure 2 is a flow chart of a method for determining a target input device according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0034] Step S202, comparing the waiting time of any port among the plurality of the first ports with the timeout threshold of any port by the timeout state judgment module to obtain a comparison result, wherein the waiting time is used to indicate the duration of time that the input device corresponding to any port is not determined as the target input device;

[0035] Step S204, when the comparison result indicates that the waiting time is less than the timeout threshold, the lottery arbitration module determines a third lottery value of the any port according to the first lottery value and the second lottery value, and determines a target input device among the multiple input devices according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any port by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any port by the additional lottery generation module;

[0036] Step S206: When the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, determine the input device corresponding to any one of the ports as the target input device.

[0037] Through the above steps, firstly, the waiting time of any port among the plurality of the first ports is compared with the timeout threshold of any port by the timeout state judgment module to obtain a comparison result, wherein the waiting time is used to indicate the duration of time that the input device corresponding to any port is not determined as the target input device; when the comparison result indicates that the waiting time is less than the timeout threshold, the third lottery value of any port is determined according to the first lottery value and the second lottery value by the lottery arbitration module, and the target input device among the plurality of input devices is determined according to the third lottery value, wherein the first lottery value is the lottery value pre-assigned to any port by the lottery arbitration module according to the bandwidth ratio corresponding to the plurality of input devices, and the second lottery value is the lottery value generated in real time for any port by the additional lottery generation module; when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any port is determined as the target input device. Therefore, the problem of poor arbitration efficiency of the arbitration scheme adopted for multiple input devices competing for the same bus in the related art can be solved. Therefore, through the method for determining the target input device provided by the present application, multiple input devices can be efficiently arbitrated.

[0038] In an exemplary embodiment, determining the third lottery value of any port according to the first lottery value and the second lottery value by the lottery arbitration module includes: reading the first lottery value from a first table, wherein the first table records the first lottery values ​​pre-assigned to a plurality of the first ports respectively; and determining the second lottery value by the additional lottery generating module; and determining the sum of the first lottery value and the second lottery value as the third lottery value.

[0039] In the embodiment of the present application, the first lottery value is pre-allocated to each first port according to the bandwidth ratio between the first ports respectively included in the multiple input devices, and is stored in the first table. Each time multiple input devices (or multiple first ports) are arbitrated, the first lottery value of any port among the multiple first ports is read from the first table, and the third lottery value of any port is calculated in real time by the additional lottery generation module; thus, the sum of the first lottery value and the second lottery value is the third lottery value of any port. Finally, the lottery arbitrator in the lottery arbitration module determines the target input device among the multiple input devices according to the third lottery values ​​corresponding to the multiple first ports.

[0040] Therefore, the embodiment of the present application combines the first lottery value pre-allocated based on the bandwidth ratio with the second lottery value calculated in real time by the additional lottery generating module, so that the third lottery value finally obtained is the revised lottery value; avoiding the problem that the lottery value allocation to multiple input devices based only on the bandwidth ratio is easily affected by the request probability.

[0041] In an exemplary embodiment, determining the second lottery value by the additional lottery generating module includes: determining by the additional lottery generating module whether the total arbitration times of the multiple input devices determined as the target input devices reaches a preset window size, wherein a preset window corresponding to the preset window size is used to count the total arbitration times; when the total arbitration times does not reach the preset window size, determining the product of the bandwidth ratio and a preset scaling factor as the second lottery value; when the total arbitration times reaches the preset window size, determining the difference between an expected value and the authorized times of the input device corresponding to any one of the ports, and determining the product of the difference and the preset scaling factor as the second lottery value, wherein the expected value is determined by the preset window size and the number of the multiple first ports.

[0042] In the embodiment of the present application, the total number of arbitrations is counted through a preset window. The process of counting the total number of arbitrations includes two stages:

[0043] In stage one, the total number of arbitrations for multiple input devices to be determined as target input devices does not reach the preset window size of the preset window. In the initial state, the number of times each input device is determined as a target input device is 0; whenever an input device is determined as a target input device, the current arbitration authorization state is written into the authorization state cache, and at the same time, the number of authorizations for this input device is increased by 1, and the total number of arbitrations is also increased by 1. Among them, the current arbitration authorization state includes at least one input device determined as a target input device and the timestamp of the current time. Until the total number of arbitrations reaches the preset window size, enter stage two. It should be noted that in stage one, the scheme for calculating the second lottery value is: the product of the bandwidth ratio corresponding to multiple input devices and the preset scaling factor is determined as the second lottery value.

[0044] In stage two, the total number of arbitrations for multiple input devices that are determined as target input devices has reached the preset window size. In stage two, each time an input device is determined as a target input device, the number of authorizations for this input device is increased by 1; at the same time, the current arbitration authorization state with the oldest timestamp among the M current arbitration authorization states corresponding to the total number of arbitrations M is determined from the authorization state cache, and the number of authorizations for the input device corresponding to the current arbitration authorization state is reduced by 1. It should be noted that the input device that is determined as the target input device at the current moment may be the same input device as the input device whose number of authorizations is reduced by 1, or it may be a different input device.

[0045] For example, when M=5, the five current arbitration authorization states are: [input device 3, timestamp a], [input device 5, timestamp b], [input device 2, timestamp c], [input device 1, timestamp d], [input device 4, timestamp e], and the order of timestamps from old to new are b, c, a, d, e; therefore, [input device 5, timestamp b] is the current arbitration authorization state with the oldest timestamp, and the number of authorizations of input device 5 should be reduced by 1.

[0046] In the second stage, the scheme for calculating the second lottery value is: determining the quotient of the preset window size and the number of the first ports as the expected value, and determining the product of the difference between the expected value and the number of authorized times of any port and the preset scaling factor as the second lottery value.

[0047] Therefore, the embodiment of the present application counts the total number of arbitrations through a preset window, and adopts different schemes to calculate the second lottery value at different stages according to the different stages of the total number of arbitrations, so that the correction of the first lottery value by the second lottery value is more targeted, and the target input device determined based on the obtained third lottery value is more accurate and reasonable.

[0048] Optionally, in the embodiment of the present application, another calculation scheme for the second lottery value is provided, including:

[0049] Determine the number of times that an input device corresponding to any port is determined as a target input device because the waiting time is greater than or equal to a timeout threshold;

[0050] Determine whether the determined number of times is greater than a preset number of times,

[0051] The preset number is used to represent the maximum allowed number of times that the input device corresponding to any port is determined as the target input device because the waiting time is greater than or equal to the timeout threshold;

[0052] When it is determined that the determined number of times is greater than the preset number of times, calculating a proportional relationship between the determined number of times and the preset number of times;

[0053] Determining whether a total number of arbitration times of multiple input devices being determined as the target input devices reaches a preset window size;

[0054] When the total number of arbitration times does not reach the preset window size, the input device corresponding to any port is adjusted by the proportional relationship, and the corresponding preset scaling factor; and then the second lottery value corresponding to any port is calculated by the adjusted preset scaling factor;

[0055] When the total number of arbitration times reaches a preset window size, the difference between the expected value and the number of authorized times of the input device corresponding to any port is determined; the difference is adjusted according to the proportional relationship, and then the product of the adjusted difference and the preset scaling factor is determined as the second lottery value.

[0056] It should be noted that the adjusted preset scaling factor and the adjusted difference are only applicable to the process of determining the target input device in the current round (or current moment).

[0057] Therefore, the embodiment of the present application calculates the second lottery value more specifically by determining the number of times any input device is determined as a target input device because the waiting time exceeds or reaches the timeout threshold, thereby better adjusting the first lottery value and making the allocation of arbitration rights more reasonable.

[0058] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the plurality of first ports, and the data cache module is used to cache the data packets transmitted through the plurality of first ports respectively; wherein, before the waiting time of any port among the plurality of first ports is compared with the timeout threshold of any port by the timeout status judgment module, and obtaining the comparison result, the method further comprises: determining a submodule in the data cache module for caching the data packets sent by any port; predicting the maximum number of data packets allowed to be transmitted by any port in the submodule, and obtaining the current number of data packets transmitted by any port accommodated in the submodule at the current moment; determining the difference between the maximum number and the current number; inputting the difference between the maximum number and the current number into a preset function to obtain the fluctuation value of the timeout threshold at the current moment; obtaining the minimum value preset for the timeout threshold; and calculating the timeout threshold corresponding to any port at the current moment by the sum of the minimum value and the fluctuation value.

[0059] It is understandable that when the target input device is determined by the third lottery value, an extreme situation may occur where a certain input device is not determined as the target input device for a long time. To avoid this extreme situation, in the embodiment of the present application, a timeout judgment module is used to compare the waiting time of any port among the multiple first ports with the timeout threshold of any port to determine whether the above extreme situation occurs.

[0060] Before comparing the waiting time with the timeout threshold, it is necessary to calculate the timeout threshold of any port at the current moment. The calculation method of the timeout threshold Th(n) of any port is shown in formula (1):

[0061]

[0062] Where B is the bandwidth, which depends on the slot and device and needs to remain unchanged during operation; Th min is the preset minimum value of the timeout threshold, which is configured by the firmware during initialization; Sigmod(x) is the s-shaped function (equivalent to the preset function), which is implemented by table lookup; A is the amplitude of the s-shaped function, Th min and A together determine the maximum value of the timeout threshold; k is a proportional coefficient, which can be dynamically adjusted by the average packet length (average packet length of the data packets in the window) within a time window (i.e., a submodule in the data cache module used to cache the data packets of any port, and the submodule is expressed in the form of a window) so that the independent variable of the s-shaped function falls within a reasonable range; Max(n) is an estimated value of the maximum number of data packets that can be accommodated in the cache; num(n) is the current number of data packets in the current cache; bias is a bias, which is used to limit the minimum value of the s-shaped function and is set to 4 in the embodiment of the present application.

[0063] Therefore, in the embodiment of the present application, by calculating the timeout threshold of any port in real time, it is possible to combine the cache status of the data packet of any port by the data cache module to reasonably judge whether any port has timed out, thereby determining whether to give priority to the request of any port.

[0064] In an exemplary embodiment, predicting the maximum number of data packets allowed to be accommodated in the submodule for transmission by any one port includes: determining the packet length of the data packets input into the submodule by any one port within a time interval from a previous moment to a current moment; calculating a second average packet length of the data packets in the submodule at the current moment based on the packet length and a first average packet length in the submodule at the previous moment; and determining the quotient of the cache depth of the submodule and the second average packet length as the maximum number.

[0065] Optionally, first determine the sliding average value (i.e., the second average packet length) of the packet length of the data packets of any port in the window corresponding to the sub-module in the data cache module used to cache the data packets of any port; then divide the cache depth of the sub-module by the second average packet length to predict the maximum number.

[0066] Optionally, the second average packet length Avg(n) is calculated as shown in formula (2):

[0067]

[0068] Among them, Avg(n-1) is the first average packet length of the previous moment, Length(n) is the data packet length of the new input data cache (equivalent to the packet length of the data packet input to the sub-module at any port in the time interval from the previous moment to the current moment), and SLW is the window length index of the window corresponding to the sub-module.

[0069] Therefore, in the embodiment of the present application, the number of data packets (including the current number and the maximum number) is introduced in the calculation process of the timeout threshold, thereby avoiding the problem that the greater the number of data packets in the sub-module, the longer the waiting time for the data packets sorted later, thereby improving the service quality through real-time adjustment of the timeout threshold.

[0070] In an exemplary embodiment, when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any one of the ports is determined as the target input device, including: calculating the quantitative relationship between the waiting time and the timeout threshold; determining the timeout level of any one of the ports according to the quantitative relationship; when there are multiple fourth ports at the same time, determining the input device corresponding to the fourth port with the highest timeout level as the target input device; wherein the fourth port is the first port whose waiting time is greater than or equal to the timeout threshold.

[0071] Optionally, in the embodiment of the present application, a timeout level is established based on the quantitative relationship between the waiting time and the timeout threshold. If there are multiple fourth ports whose waiting time is greater than or equal to the timeout threshold, the input device corresponding to the fourth port with the highest timeout level is preferentially determined as the target input device.

[0072] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the multiple first ports, and the data cache module is used to cache the data packets transmitted through the multiple first ports respectively; the data cache module is located in the first-level pipeline, and the arbitrator is located in the second-level pipeline; wherein, the method further comprises: receiving multiple requests through the first-level pipeline, and storing multiple requests to the second-level pipeline when the second-level pipeline allows receiving data packets, wherein the request carries the data packet; when any input device among the multiple input devices is determined as the target input device, the arbitration right obtained by the any input device and the request of the any input device are simultaneously sent to the exit of the second-level pipeline, wherein the arbitration right is used to indicate that the any input device is determined as the target input device.

[0073] Optionally, the embodiment of the present application is based on a pipeline hierarchical design. When the secondary pipeline is allowed to receive data packets, requests carrying data packets are allowed to enter the secondary pipeline, so that after any input device obtains the arbitration right, the request located in the secondary pipeline can be given to the exit of the secondary pipeline together with the arbitration right, thereby avoiding the situation where the arbitration right obtained by any input device has been sent to the exit of the secondary pipeline, but the request of any input device still needs to be sent from the primary pipeline to the exit of the secondary pipeline, thereby causing the problem of empty shot.

[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0075] In order to better understand the process of the above-mentioned method for determining the target input device, the implementation process of the above-mentioned method for determining the target input device is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0076] The optional embodiment of the present application aims at the use scenario of the router, and proposes an adaptive arbitration and hardware implementation solution on the basis of satisfying the bandwidth ratio of the input port (equivalent to the first port) as much as possible, with the goal of balancing the input port cache pressure and reducing the waiting time.

[0077] Specifically, an optional embodiment of the present application provides a universal routing module, the structure of which is as follows: Figure 3 As shown, it includes four parts: request diversion, arbitration, data selection, and data output. Arbitration is the core of the routing module. The arbitration part includes an adaptive arbitrator. The measurement criteria mainly include: fairness, bus occupancy, and ease of reuse.

[0078] Furthermore, the structure of the adaptive arbitrator (equivalent to the arbitrator in the above embodiment) of the optional embodiment of the present application is as follows: Figure 4 As shown, it includes a lottery arbitrator, a polling arbitrator, and a timeout threshold generation module (i.e. Figure 4 Timeout threshold generation), timeout state judgment module (i.e. Figure 4 Timeout status judgment), authorization status statistics and additional lottery generation module.

[0079] The adaptive arbitrator is based on the cascade structure of lottery arbitration and polling arbitration. The lottery arbitration part corrects the lottery allocation by counting the arbitration authorization status and real-time cache status. Furthermore, in order to solve the problem of long waiting time for individual data packets, a statistical timeout mechanism is introduced. Once the timeout is triggered, the lottery arbitrator is bypassed and only polling arbitration is performed for the timed-out request to avoid extreme waiting time. Furthermore, based on the above adaptive arbitrator, a router design scheme is proposed to achieve no empty bubbles when switching arbitration rights, which can significantly improve transmission efficiency.

[0080] Among them, in the lottery arbitration part, the traditional lottery arbitrator often only distributes lottery tickets according to the bandwidth ratio of each port (equivalent to any port), but because the algorithm of the traditional lottery arbitrator is derived from probability statistics, the bandwidth allocation is often affected by the request probability in actual use. Therefore, the optional embodiment of the present application introduces a feedback loop, which is used to count the number of times each port obtains arbitration rights and the current cache status of each input port, and adjusts the weight of lottery allocation based on this (i.e., determining the third lottery value in the above embodiment). The lottery allocation is divided into two parts, namely the basic lottery value divided according to the bandwidth ratio (equivalent to the first lottery value) and the additional lottery based on the authorization number statistics (equivalent to the second lottery value). The basic lottery value can set a lookup table according to the request status of each port (equivalent to the first table in the above embodiment). The optional embodiment of the present application focuses on the generation of additional lottery values.

[0081] Specifically, in an optional embodiment of the present application, the authorization times are counted in a sliding window manner, such as Figure 5 As shown. The statistical process is divided into two stages. In the first stage (equivalent to stage one), the number of authorizations of each port in the initial state of the adaptive arbitrator is 0. When the adaptive arbitrator starts working, the current arbitration authorization state is written into the authorization state cache after each arbitration is completed, and the number of authorizations of the authorized port is increased by 1, until the total number of arbitrations reaches the preset window size and enters the second stage (equivalent to stage two). In this stage, in addition to increasing the number of authorizations of the current arbitrated port by 1, it is also necessary to read the oldest historical authorization state from the authorization state cache and reduce the number of authorizations of the corresponding port by 1. In this way, the number of authorizations of multiple ports in the specified sliding window (i.e., the preset window) can be dynamically monitored.

[0082] Since the authorization times are counted in two stages, in the first stage, only the bandwidth ratio multiplied by the scaling factor (equivalent to the preset scaling factor) is used as an additional lottery ticket. For the second stage, since the preset window size is determined, the expected value of the number of authorizations obtained by each port is a fixed value, so the expected value minus the actual number of authorizations can be used as a correction amount, and scaled proportionally as an additional lottery ticket.

[0083] The additional lottery generation process corresponding to the above content is as follows Figure 6 As shown, including:

[0084] Whether the data request (equivalent to the request in the above embodiment) obtains arbitration rights, if yes, the authorization times of the input device (or first port) corresponding to the data request are increased by 1, otherwise, it is determined whether the stage to which the statistical process belongs is stage two.

[0085] If it is stage 2, subtract the historical authorization status, count the actual number of authorizations, and calculate the second lottery value by (expected number of authorizations - actual number of authorizations) * scaling factor; wherein the expected number of authorizations is the expected value.

[0086] If it is not stage 2, the second lottery value is calculated using bandwidth ratio*scaling factor.

[0087] In addition, there are restrictions on transmission in some usage scenarios, so it is necessary to introduce a timeout mechanism to eliminate extreme waiting time. In the optional embodiment of the present application, the conventional fixed timeout threshold is not adopted. Instead, the timeout threshold is dynamically adjusted according to the port bandwidth and cache status, and the timeout situation is graded, giving priority to timed out requests to improve service quality.

[0088] Specifically, since lottery arbitration is a probability-based arbitration method, it can achieve allocation according to bandwidth ratio from a macro perspective. However, for a certain data packet, there may be a problem of not being able to obtain arbitration rights for a long time. Therefore, a timeout threshold generation module is added. When a port times out, lottery arbitration is skipped and polling arbitration is used to give priority to authorizing the timed-out port.

[0089] In general designs, the timeout threshold is often set to a fixed value, which has limitations when the length of the input data packet is uncertain. Therefore, in an optional embodiment of the present application, a threshold generation method based on the number of data packets in the cache is proposed. The specific calculation process is shown in the above formula (1), which will not be repeated here.

[0090] To calculate Max(n), we first need to calculate the sliding average of the length of the data packets at this port (i.e., any port). Then, we can obtain the maximum number of data packets that can be accommodated in the cache by dividing the cache depth by the average length. The division here can be implemented using a table lookup method. The sliding average calculation method is shown in the above formula (2) and will not be repeated here.

[0091] Therefore, the significance of introducing the number of data packets in the threshold calculation is that the more data packets there are in the cache, the longer the waiting time of the data packets behind will be. Therefore, appropriately lowering the timeout threshold is conducive to improving service quality.

[0092] Furthermore, the timeout status judgment module compares the data packet waiting time with the timeout threshold mentioned above. Since the polling arbitrator has no concept of priority, the timeout status is subdivided into four levels, as shown in Table 1. When any port has a timeout, that is, the timeout level code is not 0 (i.e., "000" in Table 1), the multiplexer selects the output of the timeout status judgment module as the input of the polling arbitrator. In the case of multiple ports having a timeout at the same time, the timeout levels of each port must be compared first, and the request with a lower timeout level must be masked.

[0093] Table 1 Timeout level classification

[0094] Timeout level coding <![CDATA[Relationship between waiting time (T wait ) and timeout threshold]]> 000 <![CDATA[T wait <Th(n)]]> 001 <![CDATA[Th(n)≤T wait <1.5Th(n)]]> 010 <h2 style=";text-align:left;direction:ltr"><![CDATA[1.5Th(n)≤T <h2 style=";text-align:left;direction:ltr"> wait <h2 style=";text-align:left;direction:ltr"> <2Th(n)]]><h2 style=";text-align:left;direction:ltr"> 100 <![CDATA[T wait ≥2Th(n)]]>

[0095] Furthermore, in traditional designs, data must obtain arbitration rights before it can flow forward. For example, port 1 and port 2 initiate data requests at the same time and wait for authorization at the first-level pipeline. Assuming that port 1 obtains arbitration rights first and feeds back the arbitration status to the first-level pipeline, the data of port 1 can enter the second-level pipeline at this time; port 2 needs to continue to wait for authorization at the first-level pipeline because it has not obtained authorization, until all the data of port 1 is output from the second-level pipeline, the arbitrator re-arbitrates, and the data of port 2 can enter the second-level pipeline and then be output to the next stage after obtaining arbitration rights. Therefore, from the perspective of the output port, there is a one-shot bubble in the arbitration rights switching process, that is, the port that newly obtains arbitration rights needs to enter the second-level pipeline before it can be output to the next stage, which affects the transmission efficiency.

[0096] To solve the cavitation problem, the optional embodiment of the present application combines the above-mentioned adaptive arbitrator to provide a pipeline-based routing module, the structure of which is as follows: Figure 7 shown.

[0097] This module is implemented in three stages, where the first stage receives data (equivalent to data packets), determines the data output direction, and calculates the waiting time through the timestamp difference between the data received into the cache and the data output from the cache, and counts the number of data packets in the current data cache. This process is performed independently for each input port. In the figure, #i represents the data and request of the i-th port; the second stage pipeline is mainly an adaptive arbitrator, and the request signal input by the arbitrator uses a multiplexer to select the first stage pipeline request or the first stage pipeline delay request; the third stage pipeline selects data and outputs it according to the arbitration right status. The focus of this structure is on the design of the second stage pipeline, which is described in detail below.

[0098] exist Figure 7 In the routing module shown, as long as the second-level pipeline can receive data, the data will be stored in the second-level pipeline regardless of whether the arbitration right is obtained, and the routing request will be synchronously tapped in the second-level pipeline. Therefore, the arbitrator has two input sources, namely the routing request output by the first-level pipeline and the routing request after tapping in the second-level pipeline. When data is back-pressed in the second-level pipeline, the routing request after tapping is used, otherwise the routing request output by the first-level pipeline is used.

[0099] When a port obtains arbitration rights, the data and arbitration rights arrive at the exit of the second-stage pipeline synchronously. When a port is back-pressed because it does not obtain arbitration rights, the data is back-pressed at the exit of the second-stage pipeline, waiting for the arbitration rights to switch. Therefore, the structure proposed in the optional embodiment of the present application can ensure that the data has arrived at the exit of the second-stage pipeline when any port obtains arbitration rights, and can be directly output to the third-stage pipeline, eliminating the problem of cavitation.

[0100] In summary, the optional embodiment of the present application utilizes the characteristics of lottery arbitration and polling arbitration to propose a hardware implementation scheme for a double-layer adaptive arbitrator, by adding a feedback loop, based on the historical authorization status statistics of the sliding window, and generating additional lottery tickets by the difference between the statistical results and the expectations to improve the degree of consistency between the proportion of arbitration rights obtained by each port and the target bandwidth ratio; and, by introducing a dynamic timeout threshold and a hierarchical timeout mechanism based on the cache state, using polling arbitration to respond quickly after a timeout occurs, avoiding the occurrence of extreme waiting time. On this basis, a routing module using a double-layer adaptive arbitration strategy is further proposed, which can realize arbitration rights switching without bubbles, effectively improve the working efficiency of the router, and effectively improve the system performance.

[0101] In this embodiment, a device for determining a target input device is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are omitted. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0102] The device for determining a target input device in an embodiment of the present application is applied to an arbitrator, the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate from the plurality of input devices a target input device that is allowed to transmit a data packet through the bus; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout state judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port.

[0103] Figure 8 is a structural block diagram of a device for determining a target input device according to an embodiment of the present application, such as Figure 8 As shown, the device comprises:

[0104] A comparison module 82, configured to compare the waiting time of any port among the plurality of the first ports with the timeout threshold of any port through the timeout state determination module to obtain a comparison result, wherein the waiting time is used to indicate a duration during which the input device corresponding to any port is not determined as the target input device;

[0105] A first determination module 84 is used to determine a third lottery value of any one of the ports according to the first lottery value and the second lottery value through the lottery arbitration module when the comparison result indicates that the waiting time is less than the timeout threshold, and determine a target input device among the multiple input devices according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any one of the ports by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any one of the ports by the additional lottery generation module;

[0106] The second determining module 86 is configured to determine the input device corresponding to any one of the ports as a target input device if the comparison result indicates that the waiting time is greater than or equal to the timeout threshold.

[0107] Through the above device, firstly, the waiting time of any port among the plurality of the first ports is compared with the timeout threshold of any port by the timeout state judgment module to obtain a comparison result, wherein the waiting time is used to indicate the duration of time that the input device corresponding to any port is not determined as the target input device; when the comparison result indicates that the waiting time is less than the timeout threshold, the third lottery value of any port is determined according to the first lottery value and the second lottery value by the lottery arbitration module, and the target input device among the plurality of input devices is determined according to the third lottery value, wherein the first lottery value is the lottery value pre-assigned to any port by the lottery arbitration module according to the bandwidth ratio corresponding to the plurality of input devices, and the second lottery value is the lottery value generated in real time for any port by the additional lottery generation module; when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any port is determined as the target input device. Therefore, the problem of poor arbitration efficiency of the arbitration scheme adopted for multiple input devices competing for the same bus in the related art can be solved. Therefore, through the method for determining the target input device provided by the present application, multiple input devices can be arbitrated efficiently.

[0108] In an exemplary embodiment, the first determination module 84 is further used to: read the first lottery value from a first table, wherein the first table records the first lottery values ​​pre-assigned to a plurality of the first ports; and determine the second lottery value through the additional lottery generating module; and determine the sum of the first lottery value and the second lottery value as the third lottery value.

[0109] In an exemplary embodiment, the first determination module 84 is further used to: determine, through the additional lottery generating module, whether the total number of arbitrations for the multiple input devices to be determined as the target input devices reaches a preset window size, wherein the preset window corresponding to the preset window size is used to count the total number of arbitrations; when the total number of arbitrations does not reach the preset window size, determine the product of the bandwidth ratio and the preset scaling factor as the second lottery value; when the total number of arbitrations reaches the preset window size, determine the difference between the expected value and the number of authorized times of the input device corresponding to any one of the ports, and determine the product of the difference and the preset scaling factor as the second lottery value, wherein the expected value is determined by the preset window size and the number of the multiple first ports.

[0110] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the multiple first ports, and the data cache module is used to cache the data packets transmitted through the multiple first ports respectively; wherein the device also includes a timeout threshold calculation module, which is used to: determine the submodule in the data cache module for caching the data packets sent by any of the ports; predict the maximum number of data packets allowed to be transmitted by any of the ports in the submodule, and obtain the current number of data packets transmitted by any of the ports accommodated in the submodule at the current moment; determine the difference between the maximum number and the current number; input the difference between the maximum number and the current number into a preset function to obtain the fluctuation value of the timeout threshold at the current moment; obtain the minimum value pre-set for the timeout threshold; and calculate the timeout threshold corresponding to any of the ports at the current moment by the sum of the minimum value and the fluctuation value.

[0111] In an exemplary embodiment, the timeout threshold calculation module is also used to: determine the packet length of the data packets input into the submodule at any port within the time interval from the previous moment to the current moment; calculate the second average packet length of the data packets in the submodule at the current moment based on the packet length and the first average packet length in the submodule at the previous moment; and determine the quotient of the cache depth of the submodule and the second average packet length as the maximum number.

[0112] In an exemplary embodiment, the second determination module 86 is also used to: calculate the quantitative relationship between the waiting time and the timeout threshold; determine the timeout level of any one of the ports based on the quantitative relationship; when there are multiple fourth ports at the same time, determine the input device corresponding to the fourth port with the highest timeout level as the target input device; wherein the fourth port is the first port whose waiting time is greater than or equal to the timeout threshold.

[0113] In an exemplary embodiment, a data cache module is also connected between the arbitrator and the multiple first ports, and the data cache module is used to cache the data packets transmitted through the multiple first ports respectively; the data cache module is located in the first-level pipeline, and the arbitrator is located in the second-level pipeline; wherein the device also includes a sending module, which is used to: receive the multiple requests through the first-level pipeline, and store the multiple requests to the second-level pipeline when the second-level pipeline allows receiving data packets, wherein the request carries the data packet; when any input device among the multiple input devices is determined as the target input device, the arbitration right obtained by the any input device and the request of the any input device are sent to the exit of the second-level pipeline at the same time, wherein the arbitration right is used to indicate that the any input device is determined as the target input device.

[0114] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0115] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0116] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein 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 method embodiments.

[0117] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0118] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0119] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0120] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.

[0121] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0122] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0123] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining a target input device, characterized in that: The invention is applied to an arbitrator, the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate a target input device that is allowed to transmit a data packet through the bus from the plurality of input devices; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout state judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port; the method comprises: The timeout state determination module compares the waiting time of any port among the plurality of the first ports with the timeout threshold of any port to obtain a comparison result, wherein the waiting time is used to indicate the duration during which the input device corresponding to any port is not determined as the target input device; In the case where the comparison result indicates that the waiting time is less than the timeout threshold, the lottery arbitration module determines a third lottery value of the any port according to the first lottery value and the second lottery value, and determines a target input device among the multiple input devices according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any port by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any port by the additional lottery generation module; When the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, the input device corresponding to any one of the ports is determined as the target input device.

2. The method according to claim 1, characterized in that Determining the third lottery value of any port according to the first lottery value and the second lottery value by the lottery arbitration module includes: Reading the first lottery ticket value from a first table, wherein the first table records the first lottery ticket values ​​pre-assigned to a plurality of the first ports; and determining the second lottery ticket value by the additional lottery ticket generation module; A sum of the first lottery value and the second lottery value is determined as the third lottery value.

3. The method according to claim 2, characterized in that Determining the second lottery ticket value by the additional lottery ticket generating module includes: Determining, by the additional lottery generating module, whether the total number of arbitrations of the plurality of input devices being determined as the target input devices reaches a preset window size, wherein a preset window corresponding to the preset window size is used to count the total number of arbitrations; In a case where the total number of arbitration times does not reach the preset window size, determining the product of the bandwidth ratio and a preset scaling factor as the second lottery value; When the total number of arbitration times reaches the preset window size, a difference between an expected value and the number of authorized times of the input device corresponding to any one of the ports is determined, and a product of the difference and the preset scaling factor is determined as the second lottery value, wherein the expected value is determined by the preset window size and the number of the first ports.

4. The method according to claim 1, characterized in that: A data cache module is also connected between the arbitrator and the plurality of first ports, and the data cache module is used to cache the data packets transmitted through the plurality of first ports respectively; Wherein, before comparing the waiting time of any port among the plurality of the first ports with the timeout threshold of any port by the timeout state judgment module and obtaining the comparison result, the method further comprises: Determine a submodule in the data cache module for caching data packets sent by any one of the ports; Predicting the maximum number of data packets that can be transmitted by any port in the submodule, and obtaining the current number of data packets that can be transmitted by any port in the submodule at the current moment; determining a difference between the maximum number and the current number; Inputting the difference between the maximum number and the current number into a preset function to obtain the fluctuation value of the timeout threshold at the current moment; Obtaining a minimum value preset for the timeout threshold; The timeout threshold corresponding to any port at the current moment is calculated by the sum of the minimum value and the fluctuation value.

5. The method according to claim 4, characterized in that Predicting the maximum number of data packets allowed to be transmitted by any port in the submodule includes: Determine the packet length of the data packet input into the submodule by any port within the time interval from the previous moment to the current moment; Calculate the second average packet length of the data packets in the submodule at the current moment according to the packet length and the first average packet length in the submodule at the previous moment; The quotient of the cache depth of the submodule and the second average packet length is determined as the maximum number.

6. The method according to claim 1, characterized in that When the comparison result indicates that the waiting time is greater than or equal to the timeout threshold, determining the input device corresponding to any one of the ports as the target input device includes: Calculating the quantitative relationship between the waiting time and the timeout threshold; Determining a timeout level of any one of the ports according to the quantitative relationship; In the case where there are multiple fourth ports at the same time, the input device corresponding to the fourth port with the highest timeout level is determined as the target input device; wherein the fourth port is the first port whose waiting time is greater than or equal to the timeout threshold.

7. The method according to claim 1, characterized in that A data cache module is also connected between the arbitrator and the plurality of first ports, and the data cache module is used to cache the data packets transmitted through the plurality of first ports respectively; The data cache module is located in the first-level pipeline, and the arbitrator is located in the second-level pipeline; Wherein, the method further comprises: Receiving a plurality of the requests through the primary pipeline, and storing the plurality of the requests in the secondary pipeline when the secondary pipeline allows receiving data packets, wherein the requests carry the data packets; When any one of the multiple input devices is determined as a target input device, the arbitration right obtained by the any one input device and the request of the any one input device are simultaneously sent to the exit of the secondary pipeline, wherein the arbitration right is used to indicate that the any one input device is determined as a target input device.

8. A device for determining a target input device, characterized in that: The invention is applied to an arbitrator, the arbitrator is connected between a bus and first ports respectively included in a plurality of input devices, and is used to arbitrate a target input device that is allowed to transmit a data packet through the bus from the plurality of input devices; the arbitrator comprises: a lottery arbitration module connected in series between a second port and a third port of the arbitrator, and a timeout state judgment module connected in parallel with the lottery arbitration module; the lottery arbitration module comprises: a lottery arbitrator connected in series with the second port, and an additional lottery generation module connected in series with the lottery arbitrator; the plurality of input devices send a request for requesting to transmit the data packet to the arbitrator through the second port; the device comprises: a comparison module, configured to compare the waiting time of any port among the plurality of the first ports with the timeout threshold of any port through the timeout state determination module to obtain a comparison result, wherein the waiting time is used to indicate a duration during which the input device corresponding to any port is not determined as the target input device; a first determination module, configured to determine, when the comparison result indicates that the waiting time is less than the timeout threshold, a third lottery value of the any port according to the first lottery value and the second lottery value through the lottery arbitration module, and determine a target input device among the multiple input devices according to the third lottery value, wherein the first lottery value is a lottery value pre-assigned to the any port by the lottery arbitration module according to the bandwidth ratio corresponding to the multiple input devices, and the second lottery value is a lottery value generated in real time for the any port by the additional lottery generation module; The second determining module is configured to determine the input device corresponding to any one of the ports as a target input device when the comparison result indicates that the waiting time is greater than or equal to the timeout threshold.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.

10. 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 computer program, the steps of the method described in any one of claims 1 to 7 are implemented.