Flow table unloading method, computer device and medium for multi-source access
By using the queue cache and scheduling mode register to optimize scheduling in multi-source access scenarios, the problem of lock failure and unlocking caused by hash conflicts is solved, the efficiency of flow table unloading is improved, atomic operations are ensured, and table entries are avoided from being locked. Dead question.
Patent Information
- Application Number
- CN202411008239.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-26
AI Technical Summary
In multi-source access scenarios, locking failures and unlocking problems caused by hash conflicts in the existing technology lead to low access efficiency, and as the system scale increases, it may lead to higher locking failure probability, reduce flow table unloading efficiency, and The hash table entry may not be unlocked normally due to abnormal conditions and may be locked.
By providing multiple queue buffers between multiple access sources, using the queue cache and scheduling mode registers to achieve optimization at the scheduling level, the access conflict problem between multiple access sources is transformed into a problem of serial access to the hash table. A configurable scheduling algorithm is used to schedule the instructions cached in the queue, and the hardware completes the reading, judgment, selection, and write-back operations of table entries to avoid locking and unlocking operations.
It improves the efficiency of flow table unloading in multi-source access scenarios, ensures atomic operation of access, and avoids the problem of table items being unable to be unlocked. As the system scale and the number of access sources increase, it can still maintain good flow table unloading efficiency. .
Smart Images

Figure CN118573637B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a flow table unloading method, computer equipment and medium for multi-source access. Background Art
[0002] In the fields of data centers, cloud computing platforms, and high-performance computers, it is often necessary to apply multi-source access, such as hardware-accelerated virtualization technology such as Single Root I / O Virtualization (SRIOV), which allows multiple virtual machines to access physical devices at the same time, thereby improving the performance and reliability of virtual machines. When multiple access sources perform operations such as adding, deleting, or rewriting operations on the same flow table, flow table access conflicts or data inconsistency problems may occur. In the prior art, input data is converted into output data of fixed length by a hash algorithm, and the probability of table item access conflicts can be reduced by using a nonlinear mapping relationship. However, there is still the possibility of hash conflicts, that is, different input data are converted to obtain the same hash value. In order to deal with hash conflicts, the prior art solution resolves the access conflicts of different access sources operating the same hash table item through locking and unlocking operations. However, in the case of locking failure, it is necessary to repeatedly try to send instructions, which leads to low access efficiency, and as the system scale increases, it may lead to a higher probability of locking failure, thereby reducing the efficiency of flow table unloading, and the hash table item may be locked due to abnormal conditions such as equipment failure.
[0003] To this end, the present application provides a flow table unloading method, computer device and medium for multi-source access, which are used to address the technical difficulties in the prior art. Summary of the invention
[0004] In the first aspect, the present application provides a flow table unloading method for multi-source access. The flow table unloading method includes: multiple access sources each issue multiple instructions, wherein the multiple instructions each include a feature field, a flow table entry identification field, and a flow table entry operation field; multiple queue caches corresponding to the multiple access sources respectively receive the instructions issued by the corresponding access sources, and the multiple queue caches are respectively associated with a status register group, and the status register group includes a first status register and a second status register, the first status register is used to indicate whether the associated queue cache has instructions to be executed, and the second status register is used to indicate whether the instructions to be executed are read instructions or write instructions; the scheduling mode register is in a configurable scheduling mode, Based on the status register groups associated with each of the multiple queue caches, a dequeue order between the multiple queue caches is determined, and then the multiple instructions are scheduled one by one according to the dequeue order; the hardware for flow table unloading, for a current scheduled instruction among the multiple instructions, performs a hash calculation on a feature field included in the current scheduled instruction to obtain a corresponding hash value, selects a hash table item in the hash table for flow table unloading based on the hash value, and then uses the flow table item identification field included in the current scheduled instruction as a read-write address to write the feature field and flow table item operation field included in the current scheduled instruction into the selected hash table item.
[0005] Through the first aspect of the present application, multiple queue buffers are provided between multiple access sources and hardware, and instructions issued by corresponding access sources are received respectively through multiple queue buffers. The optimization at the scheduling level is realized by using queue buffers and scheduling mode registers, and the access conflict problem between multiple access sources is transformed into the problem of how to implement serial access to the hash table through scheduling; on the basis of absorbing the differences between the times when multiple access sources issue instructions respectively through multiple queue buffers, the scheduling mode register is used, combined with the customized characteristics of the configurable scheduling method and the reference basis provided by the status register groups associated with each of the multiple queue buffers, the multiple queue buffers can be conveniently determined. The dequeue order between them; through the combination of software and hardware, a queue cache is used to store the issued instructions, and a configurable scheduling algorithm is used to schedule the instructions in each queue cache, and then the hardware completes the reading, judgment, selection, and write-back operations of the table items, thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios; and, by scheduling the instructions, the hardware ensures the atomicity of the access operation, solves the problem of table item access conflicts, and avoids the problem of table items being unable to be unlocked when locking and unlocking operations are used; and, as the scale of the system increases, the number of access sources such as physical functions increases, and the unloading efficiency will not decrease with the increase in the number of access sources.
[0006] In a possible implementation manner of the first aspect of the present application, the configurable scheduling mode is polling scheduling, read instruction priority scheduling or weight-based scheduling.
[0007] In a possible implementation manner of the first aspect of the present application, the multiple queue buffers are multiple first-in-first-out buffers.
[0008] In a possible implementation manner of the first aspect of the present application, the multiple access sources are multiple physical functions, and the multiple physical functions are independent of each other.
[0009] In a possible implementation of the first aspect of the present application, the multiple instructions are scheduled one by one in the dequeue order and then issued to the hardware for execution, and the hardware serially accesses the hash table during the execution of the multiple instructions.
[0010] In a possible implementation manner of the first aspect of the present application, the hardware does not lock the hash table during the process of executing the multiple instructions.
[0011] In a possible implementation of the first aspect of the present application, the first status register stores a 1-bit first status flag, which is used to indicate whether the associated queue cache has instructions to be executed, and the second status register stores a 1-bit second status flag, which is used to indicate whether the instruction to be executed is a read instruction or a write instruction.
[0012] In a possible implementation of the first aspect of the present application, the first state identifier and the second state identifier of the state register group associated with each of the multiple queue caches are used to form a bit map, and the dequeue order is determined based on the configurable scheduling method and the bit map.
[0013] In a possible implementation manner of the first aspect of the present application, the hardware is a smart network card or a data processor.
[0014] In a possible implementation manner of the first aspect of the present application, the characteristic field is one or more of a source machine address, a destination machine address, a network protocol address, port information, and message packet information.
[0015] In a second aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.
[0016] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flow chart of a method for unloading a flow table for multi-source access provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of a scheduling mode register scheduling multiple queue buffers provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0023] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.
[0024] Figure 1 A flow chart of a method for unloading a flow table for multi-source access provided in an embodiment of the present application. Figure 1 As shown, the flow table unloading method includes the following steps.
[0025] Step S102: Multiple access sources each issue a plurality of instructions, wherein each of the plurality of instructions includes a feature field, a flow entry identification field, and a flow entry operation field.
[0026] Step S104: Multiple queue caches corresponding one-to-one to the multiple access sources respectively receive instructions issued by the corresponding access sources, and the multiple queue caches are respectively associated with a status register group, and the status register group includes a first status register and a second status register. The first status register is used to indicate whether the associated queue cache has instructions to be executed, and the second status register is used to indicate whether the instruction to be executed is a read instruction or a write instruction.
[0027] Step S106: the scheduling mode register determines the dequeue order between the multiple queue caches according to a configurable scheduling method based on the status register groups associated with the multiple queue caches respectively, and then schedules the multiple instructions one by one according to the dequeue order.
[0028] Step S108: The hardware for flow table unloading performs a hash calculation on the characteristic fields included in the currently scheduled instruction among the multiple instructions to obtain a corresponding hash value, selects a hash table item in the hash table for flow table unloading based on the hash value, and then uses the flow table item identification field included in the currently scheduled instruction as a read-write address to write the characteristic fields and flow table item operation fields included in the currently scheduled instruction into the selected hash table item.
[0029] See also Figure 1In the technical fields of data centers, cloud computing platforms, and high-performance computers, access conflicts between multiple access sources are often encountered. For example, hardware-accelerated virtualization technologies such as Single Root I / O Virtualization (SRIOV) allow multiple virtual machines to access physical devices simultaneously. The SRIOV feature is managed through multiple physical functions of the system, and each physical function is generally independent of each other. When multiple physical functions in the same system perform operations such as adding flow entries, deleting flow entries, or rewriting flow entries on the same flow table, two or more physical functions may perform flow entry operations on the same flow table, which may cause flow table access conflicts or data inconsistency problems. Flow tables are generally linear tables, and flow entry identifiers (Flow IDs) are used to distinguish a flow. By allocating and managing flow entry identifiers in flow tables, it helps to ensure the mutual exclusivity of each physical function using the same flow table, that is, to ensure that a flow entry is only used by one physical function at the same time. Hash algorithms, such as hash algorithms, convert input data of any length into output data of a fixed length (hash value, also called hash value), and there is no linear relationship between the input data and the output data. The probability of table entry access conflicts can be reduced by using nonlinear mapping relationships. Because the hash algorithm is a compression operation that maps the space of input data to the space of hash values, different input data may be mapped to the same hash value after hash calculation, which means that hash conflicts occur. Generally, a hash table includes a certain number of hash table entries, and each hash table entry has a certain number of hash buckets, such as four hash buckets. Each hash bucket stores a placeholder flag to indicate whether the hash bucket is occupied, the hash value field is used for hash matching, and the flow table entry identifier field is used for exact matching comparison. If locking and unlocking operations are used to resolve access conflicts between different access sources operating the same hash table entry, this means that after one access source locks a hash table entry and before unlocking it, other access sources fail to lock because the hash table entry is locked, and need to poll and wait for a certain period of time before trying to lock the hash table again. This method that relies on locking and unlocking operations requires multiple access sources to compete for locking on a first-come, first-served basis. If locking fails, repeated attempts to send instructions are required, which leads to low access efficiency. As the system scale increases, it may lead to a higher probability of locking failure, thereby reducing the efficiency of flow table unloading. In addition, the hash table entry may not be unlocked normally due to abnormal conditions such as equipment failure, and thus be locked. The following is a detailed description of the specific embodiments of this application. Figure 1The flow table unloading method for multi-source access shown in the figure can resolve the access conflict of different access sources operating the same hash table item without relying on locking and unlocking operations, and can still maintain good flow table unloading efficiency as the system scale increases and the number of access sources increases.
[0030] Continue reading Figure 1 In step S102, multiple access sources each issue multiple instructions. The multiple instructions each include a feature field, a flow entry identification field, and a flow entry operation field. Here, the feature field is used to characterize the characteristics of the flow, and can be, for example, a five-tuple of information, such as the source machine address, the destination machine address, etc., or it can be packet information such as packet length, encapsulation protocol, packet encapsulation format, etc. The feature field is used for subsequent hash calculations to convert into hash values, and the hash values are used for hash matching. The flow entry identification field records the flow entry identification of the corresponding flow, which is used to distinguish a flow, and the flow entry identification field is used for exact matching comparison. The flow entry operation field records the flow entry operation to be taken, such as forwarding a data packet to a specified port. Multiple access sources each issue multiple instructions, so each access source issues its own instructions, and the multiple instructions obtained in this way represent access requests from multiple access sources. Multiple instructions may be for the same accessed object, such as the same hash table. For example, multiple instructions may need to read the hash table item in the same hash table. Therefore, there may be two or more instructions that need to read the same hash table item in the same hash table. At this time, a hash conflict may occur, that is, an access conflict when different access sources operate on the same hash table item. As mentioned above, by relying on locking and unlocking operations, although it is possible to prevent other instructions from operating on the locked hash table item by locking a hash table item when executing a certain instruction, this leads to low access efficiency. For this reason, Figure 1 The flow table unloading method for multi-source access shown in the figure uses queue cache and scheduling mode register to achieve scheduling-level optimization without relying on locking and unlocking operations, and transforms the access conflict problem between multiple access sources into the problem of how to access the hash table in serial mode through scheduling.
[0031] Continue reading Figure 1, in step S104, the multiple queue caches corresponding one-to-one to the multiple access sources respectively receive the instructions issued by the corresponding access sources, and the multiple queue caches are respectively associated with a status register group, and the status register group includes a first status register and a second status register, the first status register is used to indicate whether the associated queue cache has instructions to be executed, and the second status register is used to indicate whether the instructions to be executed are read instructions or write instructions. Here, multiple queue caches correspond one-to-one to multiple access sources, so as the system scale increases and the number of access sources increases, it is necessary to provide the same number of queue caches for receiving instructions from multiple access sources. Here, multiple queue caches respectively receive instructions issued by corresponding access sources, so they can adapt to any order in which multiple access sources issue multiple instructions. In other words, multiple queue caches can absorb the differences between the times when multiple access sources issue instructions. For example, suppose two access sources send their own instructions one after another. There is a certain difference in the time when the two instructions sent by the two access sources are sent. Therefore, if the two instructions are sent directly to the hardware or used to access the same hash table directly, it is necessary to consider the possibility that the two instructions attempt to operate the same hash table item, and it is also necessary to consider that there is an unpredictable difference in the time when the two instructions are sent, that is, the time when they arrive at the hardware or hash table. This unpredictable difference in the time of being sent brings challenges to the control logic design. For example, the instructions sent by the two access sources may be separated by 5 nanoseconds or 100 nanoseconds or any possible time interval. Therefore, there is an unpredictable time interval when the two instructions with the possibility of hash conflict arrive at the hardware or hash table, and it may even be impossible to predict which instruction will arrive first and which instruction will arrive later. As described above, locking and unlocking operations are used to resolve access conflicts when different access sources operate the same hash table item, so that multiple access sources compete for locking on a first-come, first-served basis. Although this solves the unpredictable differences in the time when instructions are issued, it inevitably introduces the loss of repeated attempts to lock when locking fails, and inevitably leads to the need for multiple access sources to initiate access operations cyclically. As the number of access sources increases, it brings greater losses to the overall system operation and is not conducive to improving the efficiency of flow table unloading. In some embodiments, multiple queue caches can be, for example, a First Input First Output (FIFO) cache or a similar memory that uses a logic design that allows first-in data to be out of the queue first.
[0032] Continue reading Figure 1In step S104, multiple queue caches respectively receive instructions issued by corresponding access sources. In this way, the differences between the times when multiple access sources issue instructions can be absorbed by multiple queue caches. In addition, the multiple queue caches are respectively associated with status register groups. Here, each status register group includes a first status register and a second status register, the first status register is used to indicate whether the associated queue cache has instructions to be executed, and the second status register is used to indicate whether the instructions to be executed are read instructions or write instructions. In this way, the status register group can be used to conveniently determine whether there are instructions to be executed in the associated queue cache and whether the instructions to be executed are read instructions or write instructions, which provides a reference for the formulation of subsequent scheduling strategies. Step S106 is executed after step S104. In step S106, the scheduling mode register determines the dequeue order between the multiple queue caches according to the configurable scheduling method based on the status register groups associated with the multiple queue caches, and then schedules the multiple instructions one by one according to the dequeue order. Here, the scheduling mode register schedules the multiple instructions one by one according to the dequeue order, which means that the multiple instructions are scheduled one by one according to the dequeue order. Therefore, the order in which the multiple instructions are scheduled follows the dequeue order, and the multiple instructions can be issued to the hardware for execution after being scheduled one by one with reference to the dequeue order, which means that the hardware can access the hash table in a serial manner, that is, execute the scheduled instructions one by one. In this way, the optimization of the scheduling level is realized by using the queue cache and the scheduling mode register, and the access conflict problem between multiple access sources is converted into the problem of how to access the hash table in a serial manner through scheduling. Therefore, on the basis of the above-mentioned difference between the time when multiple access sources issue instructions respectively through multiple queue caches, the scheduling mode register is used, combined with the customized characteristics of the configurable scheduling method and the reference basis provided by the status register group associated with each of the multiple queue caches, the dequeue order between the multiple queue caches can be conveniently determined, and the application scenario requirements, user requirements, communication protocol requirements, etc. can be flexibly adapted. For example, the configurable scheduling mode may be a polling scheduling, such as polling multiple queue caches in a specific order and performing a queue dequeue operation on the queue cache with instructions to be executed. Therefore, the status register group can be used to conveniently determine whether there are instructions to be executed in the associated queue cache and whether the instructions to be executed are read instructions or write instructions. This means that the status register group can be used to conveniently determine which queue caches are suitable for queue dequeue operations when the configurable scheduling mode is polling scheduling.For another example, the configurable scheduling mode may be read instruction priority scheduling, that is, priority execution of read instructions. Therefore, the status register group can be used to conveniently determine whether there are instructions to be executed in the associated queue cache and whether the instructions to be executed are read instructions or write instructions. This means that the status register group can be used to conveniently determine which queue caches are suitable for queue dequeue operations when the configurable scheduling mode is read instruction priority scheduling. In this way, based on application scenario requirements, user requirements, communication protocol requirements, etc., the configurable scheduling mode can be set to select the optimal scheduling mode, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling modes. In addition, on the basis of receiving the instructions issued by the corresponding access source through multiple queue caches, status register groups associated with the multiple queue caches are provided. In this way, the status register group can be used to conveniently provide a reference basis for selecting a scheduling mode and formulating a scheduling strategy, thereby simplifying the overall control logic design.
[0033] Continue reading Figure 1, in step S108, the hardware for flow table unloading, for the currently scheduled instruction among the multiple instructions, performs hash calculation on the characteristic fields included in the currently scheduled instruction to obtain a corresponding hash value, selects a hash table item in the hash table for flow table unloading based on the hash value, and then uses the flow table item identification field included in the currently scheduled instruction as the read-write address to write the characteristic fields and flow table item operation fields included in the currently scheduled instruction into the selected hash table item. In this way, on the basis of absorbing the differences between the times when multiple access sources issue instructions through multiple queue caches, the scheduling mode register is used, combined with the customized characteristics of the configurable scheduling method and the reference basis provided by the status register groups associated with each of the multiple queue caches, to conveniently determine the dequeue order between the multiple queue caches; the queue cache and the scheduling mode register are used to achieve optimization at the scheduling level, and the access conflict problem between multiple access sources is converted into the problem of how to access the hash table in serial mode through scheduling. The scheduled instructions are sent to the subsequent module for execution. Here, the hardware used for flow table unloading, such as an intelligent network card or a data processor, is responsible for executing the instructions sent to the hardware after being scheduled, and for the currently scheduled instruction among the multiple instructions, the characteristic fields included in the currently scheduled instruction are hashed to obtain the corresponding hash value, and a hash table item is selected in the hash table used for flow table unloading based on the hash value, and then, the flow table item identification field included in the currently scheduled instruction is used as the read-write address to write the characteristic field and flow table item operation field included in the currently scheduled instruction into the selected hash table item. In this way, the probability of table item access conflict is reduced by hash calculation, and, without relying on locking and unlocking operations, the differences between the times when multiple access sources issue instructions are absorbed by multiple queue caches, and the scheduling level optimization is realized by using queue caches and scheduling mode registers, and the access conflict problem between multiple access sources is converted into the problem of how to access the hash table in serial mode through scheduling, thereby resolving the access conflict of different access sources operating the same hash table item. Furthermore, because multiple queue buffers are provided between multiple access sources and hardware, multiple access sources do not directly send instructions to the hardware, but first receive the instructions sent by the corresponding access sources through multiple queue buffers, and then determine the dequeue order between the multiple queue buffers through the scheduling mode register, and then schedule the multiple instructions one by one according to the dequeue order. In this way, multiple access sources do not need to wait for the previous instruction to be executed, but can send multiple instructions. The multiple queue buffers and the scheduling mode register together convert the access conflict problem between multiple access sources into the problem of how to access the hash table in serial mode through scheduling. In this way, there is no need to lock and unlock the hash table, which is conducive to improving the flow table unloading performance and avoiding the problem caused by the inability to unlock the hash table.In addition, in the process of hardware executing these instructions after scheduling, the operation of the hash table is in a serial access mode, thus ensuring atomic operation and effectively solving the access conflict problem. Further, through software-level optimization, for example, based on application scenario requirements, user requirements, communication protocol requirements, etc., the configurable scheduling mode can be set to select the optimal scheduling mode, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling modes, so that the software-level optimization can be combined with the hardware for flow table unloading, that is, through the combination of software and hardware, the queue cache is used to store the issued instructions, and the configurable scheduling algorithm is used to schedule the instructions of each queue cache, and then the hardware completes the reading, judgment, selection, and write-back operations of the table items, thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios. In addition, the hardware ensures the atomic operation of access by scheduling the instructions, solves the problem of table item access conflict, and avoids the problem of table items being unable to be unlocked when locking and unlocking operations are used. In addition, as the scale of the system increases, the number of access sources such as physical functions increases, and the unloading efficiency will not decrease with the increase in the number of access sources.
[0034] In conclusion, Figure 1 The flow table unloading method for multi-source access shown in the figure provides multiple queue buffers between multiple access sources and hardware, receives instructions issued by corresponding access sources through multiple queue buffers respectively, and realizes optimization at the scheduling level by using queue buffers and scheduling mode registers, transforming the access conflict problem between multiple access sources into the problem of how to realize serial access to hash tables through scheduling; on the basis of absorbing the differences between the time when multiple access sources issue instructions respectively through multiple queue buffers, using scheduling mode registers, combining the customized characteristics of configurable scheduling methods and the reference basis provided by the status register groups associated with each of the multiple queue buffers, the multiple queues can be conveniently determined. The dequeue order between column caches; through the combination of software and hardware, the queue cache is used to store the issued instructions, and a configurable scheduling algorithm is used to schedule the instructions of each queue cache, and then the hardware completes the reading, judgment, selection, and write-back operations of the table items, thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios; and, by scheduling the instructions, the hardware ensures the atomicity of the access operation, solves the problem of table item access conflicts, and avoids the problem of table items being unable to be unlocked when locking and unlocking operations are used; and, as the system scale increases, the number of access sources such as physical functions increases, and the unloading efficiency will not decrease with the increase in the number of access sources.
[0035] In a possible implementation, the configurable scheduling method is polling scheduling, read instruction priority scheduling or weight-based scheduling. In this way, based on application scenario requirements, user requirements, communication protocol requirements, etc., the configurable scheduling method can be set to select the optimal scheduling method, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling methods, so that the software-level optimization can be combined with the hardware for flow table unloading, that is, through the combination of software and hardware, a queue cache is used to store the issued instructions, and a configurable scheduling algorithm is used to schedule the instructions cached in each queue, and then the hardware completes the reading, judgment, selection, write-back operations of the table items, etc., thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios.
[0036] In a possible implementation, the multiple queue caches are multiple first-in-first-out caches. The multiple queue caches may be similar memories that use a logic design that allows first-in data to be first-out. In this way, any order in which multiple access sources issue multiple instructions can be adapted. In other words, the differences between the times when multiple access sources issue instructions can be absorbed by multiple queue caches.
[0037] In a possible implementation, the multiple access sources are multiple physical functions, and the multiple physical functions are independent of each other. In this way, it is achieved that the access conflict of different access sources operating the same hash table item is resolved without relying on locking and unlocking operations, and the flow table unloading efficiency can still be maintained at a good level as the system scale increases and the number of access sources increases.
[0038] In a possible implementation, the multiple instructions are scheduled one by one according to the dequeue order and then sent to the hardware for execution. The hardware serially accesses the hash table in the process of executing the multiple instructions. In this way, multiple access sources do not need to wait for the previous instruction to be executed, but can send multiple instructions. Multiple queue caches and scheduling mode registers together convert the access conflict problem between multiple access sources into the problem of how to access the hash table in serial mode through scheduling. In this way, there is no need to lock and unlock the hash table, which is beneficial to improving the flow table unloading performance and avoiding the problem caused by the inability to unlock the hash table. In addition, in the process of the hardware executing these scheduled instructions, the operation on the hash table is in the form of serial access, thereby ensuring atomic operation and effectively solving the access conflict problem. Furthermore, through software-level optimization, for example, based on application scenario requirements, user requirements, communication protocol requirements, etc., configurable scheduling methods can be set to select the optimal scheduling method, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling methods. In this way, software-level optimization can be combined with hardware for flow table unloading, that is, through a combination of software and hardware, queue cache is used to store the issued instructions, and a configurable scheduling algorithm is used to schedule the instructions of each queue cache, and then the hardware completes the reading, judgment, selection, and write-back operations of the table items, thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios. In addition, the hardware ensures the atomicity of access operations by scheduling instructions, solves the problem of table item access conflicts, and avoids the problem of table items being unable to be unlocked when locking and unlocking operations are used. In addition, as the scale of the system increases, the number of access sources such as physical functions increases, and the unloading efficiency will not decrease with the increase in the number of access sources.
[0039] In some embodiments, the hardware does not lock the hash table during the execution of the multiple instructions. In this way, the optimization at the scheduling level is achieved by using the queue cache and the scheduling mode register without relying on the locking operation and the unlocking operation, and the access conflict problem between multiple access sources is converted into the problem of how to access the hash table in a serial manner through scheduling, which solves the table entry access conflict problem and avoids the problem of the table entry being unable to be unlocked when the locking operation and the unlocking operation are used.
[0040] In a possible implementation, the first status register stores a 1-bit first status identifier, which is used to indicate whether the associated queue cache has instructions to be executed, and the second status register stores a 1-bit second status identifier, which is used to indicate whether the instructions to be executed are read instructions or write instructions. In this way, the status register group can be used to conveniently determine whether there are instructions to be executed in the associated queue cache and whether the instructions to be executed are read instructions or write instructions, which provides a reference for the formulation of subsequent scheduling strategies. Here, the first status register stores a 1-bit first status identifier, and the second status register stores a 1-bit second status identifier. Therefore, the status register group stores a 1-bit first status identifier and a 1-bit second status identifier. The status register groups associated with the multiple queue caches are equivalent to a two-dimensional matrix with multiple rows and two columns, and the elements in the matrix are 0 or 1, where the row elements are equivalent to a status register group, and the two column elements respectively indicate the first status identifier and the second status identifier of the multiple status register groups. Conversely, the status register groups associated with the multiple queue caches can also be equivalent to a two-dimensional matrix with two rows and multiple columns and a relative matrix analysis method can be adopted. Therefore, the scheduling strategy can be optimized by bitmap algorithms, binary calculations, etc. In this way, based on application scenario requirements, user requirements, communication protocol requirements, etc., the configurable scheduling method can be set to select the optimal scheduling method, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling methods. Furthermore, the scheduling strategy can be better formulated by reading the status register groups associated with each of the multiple queue caches. For example, by reading the first state identifier and the second state identifier of each of the status register groups associated with each of the multiple queue caches, a two-dimensional matrix of multiple rows and two columns or a corresponding bitmap can be constructed. By identifying the elements that are 1 or 0 and the locations of these elements, it can be conveniently determined whether there are instructions to be executed in the associated queue cache and whether the instructions to be executed are read instructions or write instructions. Statistical analysis can also be further provided as a reference. For example, the second state identifier is used to indicate whether the instruction to be executed is a read instruction or a write instruction. Assuming that the second state identifier is 1, it means a write instruction, and the second state identifier is 0, it means a read instruction. By reading the column elements corresponding to the second state register on the two-dimensional matrix, the array composed of the second state identifiers of multiple state register groups can be read. In this way, it is convenient to determine how many elements of 0 or 1 there are, and how many instructions there are that are read instructions or write instructions, thereby providing a better reference basis for scheduling strategies such as read instruction priority scheduling.
[0041] In some embodiments, the first state identifier and the second state identifier of the state register group associated with each of the multiple queue caches are used to form a bit map, and the dequeue order is determined based on the configurable scheduling method and the bit map. In this way, based on application scenario requirements, user requirements, communication protocol requirements, etc., the configurable scheduling method can be set to select the optimal scheduling method, and the most suitable scheduling strategy can be formulated through a combination of multiple scheduling methods. Further, the bit map can be used to provide a richer reference basis to better determine the dequeue order.
[0042] In a possible implementation, the hardware is a smart network card or a data processor, so that the flow table unloading efficiency of the hardware is improved.
[0043] In a possible implementation, the characteristic field is one or more of a source machine address, a destination machine address, a network protocol address, port information, and packet information, which is conducive to adapting various matching algorithms.
[0044] Figure 2 A schematic diagram of a scheduling mode register scheduling multiple queue buffers provided in an embodiment of the present application. Figure 2As shown, multiple access sources (access source A210, access source B212, access source C214, access source D216) each issue multiple instructions. Wherein, the multiple instructions each include a feature field, a flow entry identification field, and a flow entry operation field. Multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226) corresponding one-to-one to the multiple access sources (access source A210, access source B212, access source C214, access source D216) respectively receive the instructions issued by the corresponding access sources. The multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226) are respectively associated with a status register group, and the status register group includes a first status register and a second status register, the first status register is used to indicate whether the associated queue cache has instructions to be executed, and the second status register is used to indicate whether the instruction to be executed is a read instruction or a write instruction. The scheduling mode register 230 determines the dequeue order between the multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226) according to the configurable scheduling mode and based on the status register groups associated with each of the multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226), and then schedules the multiple instructions one by one according to the dequeue order. The hardware 240 for flow table unloading performs a hash calculation on the feature field included in the current scheduled instruction among the multiple instructions to obtain a corresponding hash value, selects a hash table item in the hash table for flow table unloading based on the hash value, and then uses the flow table item identification field included in the current scheduled instruction as the read-write address to write the feature field and flow table item operation field included in the current scheduled instruction into the selected hash table item.
[0045] See also Figure 2, multiple queue buffers (queue cache A220, queue cache B222, queue cache C224, queue cache D226) are provided between multiple access sources (access source A210, access source B212, access source C214, access source D216) and hardware 240, and instructions issued by corresponding access sources are received respectively through multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226). The scheduling level is optimized by using the queue cache and the scheduling mode register 230, and the access conflict problem between multiple access sources (access source A210, access source B212, access source C214, access source D216) is converted into the problem of how to access the hash table in serial mode through scheduling. On the basis of absorbing the differences between the times when multiple access sources (access source A210, access source B212, access source C214, access source D216) issue instructions through multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226), the scheduling mode register 230 is used, combined with the customized characteristics of the configurable scheduling method and the reference basis provided by the status register groups associated with the multiple queue caches (queue cache A220, queue cache B222, queue cache C224, queue cache D226), the dequeue order between the multiple queue caches can be conveniently determined; through the combination of software and hardware, the queue cache is used to store the issued instructions, and the configurable scheduling algorithm is used to schedule the instructions of each queue cache, and then the hardware 240 completes the reading, judgment, selection, write-back operations, etc. of the table items, thereby solving the problem of low efficiency of flow table unloading in multi-source access scenarios. In addition, the hardware 240 ensures the atomicity of access operations by scheduling instructions, solves the problem of table entry access conflicts, and avoids the problem of table entries being unable to be unlocked when locking and unlocking operations are used; and as the system scale increases, the number of access sources such as physical functions increases, and the unloading efficiency will not decrease as the number of access sources increases.
[0046] Figure 33 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 310 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 300 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.
[0047] It should be understood that Figure 3 The computing device 300 may include one or more processors 310, and the multiple processors 310 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3 The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.
[0048] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 320 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.
[0049] The memory 330 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 330 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 3 Show more or fewer components, or have different component configurations.
[0050] The bus 340 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0051] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.
[0052] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.
[0053] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.
[0054] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0055] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A flow table unloading method for multi-source access, characterized in that: The flow table unloading method comprises: Multiple access sources each issue multiple instructions, wherein each of the multiple instructions includes a feature field, a flow entry identification field, and a flow entry operation field; A plurality of queue caches corresponding one-to-one to the plurality of access sources respectively receive instructions issued by the corresponding access sources, the plurality of queue caches are respectively associated with a status register group, the status register group includes a first status register and a second status register, the first status register is used to indicate whether the associated queue cache has an instruction to be executed, and the second status register is used to indicate whether the instruction to be executed is a read instruction or a write instruction; The scheduling mode register determines the dequeue order between the multiple queue caches according to a configurable scheduling mode based on the status register groups associated with the multiple queue caches respectively, and then schedules the multiple instructions one by one according to the dequeue order; The hardware for flow table unloading performs a hash calculation on a characteristic field included in a currently scheduled instruction among the multiple instructions to obtain a corresponding hash value, selects a hash table item in the hash table for flow table unloading based on the hash value, and then uses the flow table item identification field included in the currently scheduled instruction as a read-write address to write the characteristic field and the flow table item operation field included in the currently scheduled instruction into the selected hash table item. The characteristic field is one or more of a source machine address, a destination machine address, a network protocol address, and port information.
2. The flow table unloading method according to claim 1, characterized in that: The configurable scheduling mode is polling scheduling, read instruction priority scheduling or weight-based scheduling.
3. The flow table unloading method according to claim 1, characterized in that: The multiple queue buffers are multiple first-in-first-out buffers.
4. The flow table unloading method according to claim 1, characterized in that: The multiple access sources are multiple physical functions, and the multiple physical functions are independent of each other.
5. The flow table unloading method according to claim 1, characterized in that: The multiple instructions are scheduled one by one according to the dequeuing order and then issued to the hardware for execution. The hardware serially accesses the hash table during the execution of the multiple instructions.
6. The flow table unloading method according to claim 5, characterized in that: The hardware does not lock the hash table during execution of the plurality of instructions.
7. The flow table unloading method according to claim 1, characterized in that: The first status register stores a 1-bit first status flag, which is used to indicate whether the associated queue cache has instructions to be executed. The second status register stores a 1-bit second status flag, which is used to indicate whether the instruction to be executed is a read instruction or a write instruction.
8. The flow table unloading method according to claim 7, characterized in that: The first state identifier and the second state identifier of the state register group associated with each of the multiple queue caches are used to form a bit map, and the dequeue order is determined based on the configurable scheduling mode and the bit map.
9. The flow table unloading method according to claim 1, characterized in that: The hardware is a smart network card or a data processor.
10. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 9.
