A flow table aging method, device, apparatus, and program product
By configuring binary bitmaps with hardware logic and using a timed polling mechanism, inactive entries can be identified and deleted in real time, solving the problem of low flow table space utilization and improving the efficiency and adaptability of flow table management, making it suitable for high-speed network environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUXI STARS MICRO SYSTEM TECHNOLOGIES CO LTD
- Filing Date
- 2025-06-30
- Publication Date
- 2026-06-05
AI Technical Summary
Existing flow table aging schemes result in low flow table space utilization and cannot effectively meet the table management needs in high-speed network environments.
The binary bitmap configured by the hardware logic represents the activation status of table entries in real time. Combined with a timed polling mechanism, inactive table entries are identified and deleted. Inactive table entry space is reused first, reducing the probability of table entries being discarded when hash collisions occur and improving the utilization rate of the flow table space.
It improves the utilization of flow table space, reduces computational overhead, enhances the flexibility and adaptability of flow table management, avoids the loss of critical flow table entries, and ensures the entry management needs in high-speed network environments.
Smart Images

Figure CN120750826B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network chip technology, specifically to a flow table aging method, apparatus, equipment, and program product. Background Technology
[0002] In network chip design, to meet the ever-increasing demand for network throughput, the pipeline-structured flow table engine is widely used to achieve efficient packet editing and forwarding.
[0003] In practical engineering, flow table engines typically use hash algorithms to look up table entry addresses and utilize SRAM granules to store table entry data, such as... Figure 1 As shown, the hash mapping of the input data packet's matching keyword `key` is processed by a hash algorithm to generate a unique entry address. The flow table structure is a collection of entries for store-and-forward rules, with each row containing the keyword `key` and an `ad` indicating the processing action. In this architecture, entry address management generally follows a "first-come, first-served" principle, which can lead to subsequent entries failing to be written to the same hash address due to hash collisions, thus affecting the efficient utilization of the flow table space. Therefore, identifying and removing inactive entries to free up space and allowing new entries to be added becomes a key requirement for flow table management.
[0004] However, current flow table aging solutions either rely on software for processing, leading to complex logic, or involve significant overhead due to the use of hardware statistical resources, or suffer from poor controllability of hardware logic, making flexible repair difficult. These technical bottlenecks result in low utilization of flow table space and an inability to effectively meet the table management needs of high-speed network environments. Summary of the Invention
[0005] In view of this, the present invention provides a flow table aging method, apparatus, equipment and program product to solve the problem that the current flow table aging scheme has low flow table space utilization and cannot effectively cope with the table entry management needs in high-speed network environments.
[0006] In a first aspect, the present invention provides a flow meter aging method, the method comprising:
[0007] The target flow table to be managed is obtained, and the activation status of each entry in the target flow table is represented by a binary bitmap; the binary bitmap is configured by hardware logic.
[0008] The binary bitmap is periodically polled to identify and delete inactive entries in the target flow table;
[0009] When a new entry exists in the target flow table, a decision is made on whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry.
[0010] The above scheme uses a binary bitmap to represent the activation status of entries in real time. The hardware logic configuration enables fast status queries, significantly reducing the computational overhead of flow table aging. The timed polling mechanism automatically identifies and deletes inactive entries, preventing invalid entries from occupying memory for a long time and improving the utilization of flow table space. Combining hash bucket occupancy and overwrite permission control bits, it prioritizes the reuse of inactive entry space, reduces the probability of entry discarding when hash collisions occur, improves the adaptability of flow tables to sudden traffic, avoids the loss of critical flow entries, and effectively addresses the entry management needs in high-speed network environments.
[0011] In one optional implementation, the binary bitmap consists of N binary bits; where N is equal to the product of the total number of entries in the target flow table and the number of binary bits M required for the activation state of a single entry.
[0012] Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of the M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
[0013] The above scheme stipulates that each entry corresponds to M binary bits, which can represent multiple levels of activation states. Compared with single-bit marking, it can more accurately reflect the actual usage frequency of the entry and avoid the accidental deletion of frequently hit entries.
[0014] In one optional implementation, the step of representing the activation state of each entry in the target flow table using a binary bitmap includes:
[0015] When a new entry is added to the target flow table, the values of the M binary bits corresponding to the new entry are initialized to 0;
[0016] When a target entry in the target flow table is matched in a lookup, the value of the M binary bits corresponding to the target entry is incremented based on the number of matches, until it reaches the maximum value of 2. M -1 remains unchanged;
[0017] The first timer scans the binary bitmap at a first time interval, and decrements the values of the M binary bits corresponding to the non-zero entries based on the number of scans until the minimum value of 0 is reached, at which point the values remain unchanged; the first timer is set by hardware logic.
[0018] The above scheme clarifies the operation process of the binary bitmap, including initialization, increment and decrement processing, and a timed scanning mechanism, to ensure accurate recording and timely updating of the active state of the entries, providing a reliable basis for the aging process of the flow table; the first timer is controlled by hardware logic to ensure the real-time and periodicity of the state decrement operation, avoiding state update delays caused by software scheduling delays.
[0019] In one optional implementation, the periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes:
[0020] The second timer scans the binary bitmap at a second time interval, and deletes the corresponding entry from the target flow table when an inactive entry is detected; the second timer is set by software logic.
[0021] The above solution uses a second timer set by software logic to periodically poll and delete inactive entries, enabling the software to flexibly adjust timing parameters according to system requirements and enhance the flexibility of flow table management.
[0022] In one optional implementation, the periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes:
[0023] When the deletion register is enabled, a third timer scans the binary bitmap at a third time interval. When an inactive entry is detected, the corresponding entry is deleted from the target flow table. Both the deletion register and the third timer are set by hardware logic.
[0024] The above scheme controls both the deletion register and the third timer with hardware logic. Compared with software processing, it significantly reduces the delay of flow table aging, which is especially suitable for high-speed network scenarios and avoids flow table overflow caused by aging lag.
[0025] In one optional implementation, the periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes:
[0026] When the interrupt register is enabled, the fourth timer scans the binary bitmap at a fourth time interval and reports the addresses of inactive entries to the software control program, so that the software control program deletes the corresponding entries after responding to the interrupt; both the interrupt register and the fourth timer are set by hardware logic.
[0027] The above scheme scans the binary bitmap using a hardware timer and reports an interrupt. After the software responds, it performs the deletion operation. This combines the advantages of high-speed hardware scanning and flexible software processing. The hardware is responsible for quickly locating inactive entries, while the software handles the complex deletion logic, thus improving the overall efficiency of the system.
[0028] In one optional implementation, the step of determining whether to overwrite an inactive entry in the target flow table with the same hash address as the new entry, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry, includes:
[0029] If the hash bucket corresponding to the hash address of the newly added entry is empty, then the newly added entry is written to the first entry position of the hash bucket;
[0030] If the hash bucket corresponding to the hash address of the newly added table entry is not empty, then compare the new key of the newly added table entry with the existing keys of all valid table entries in the hash bucket.
[0031] If an existing keyword that matches the newly added keyword exists, the entry data of the matching entry in the hash bucket is replaced with the entry data of the newly added entry.
[0032] If no existing keyword matches the newly added keyword, then based on the value of the overwrite permission control bit carried by the newly added entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry.
[0033] The above scheme first checks whether a matching keyword exists in the hash bucket when adding a new table entry. If it exists, it replaces the entry directly to avoid duplicate entries occupying space. If it does not exist, it prioritizes reusing inactive entries to reduce the probability of hash bucket overflow and improve the flow table lookup hit rate. By optimizing the use of flow table space through keyword matching, it improves the intelligence level of flow table management.
[0034] In one optional implementation, if the value of the overwrite permission control bit carried by the newly added entry is high, the step of determining whether to overwrite an inactive entry in the target flow table that has the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry includes:
[0035] If there are inactive valid entries in the hash bucket, then the entry data of the newly added entry will be written to the inactive valid entry with the smallest index in the hash bucket.
[0036] If there are no inactive valid entries in the hash bucket and the hash bucket is not full, then the entry data of the newly added entry will be written to the invalid entry with the smallest index in the hash bucket.
[0037] When the value of the overwrite permission control bit is high, the above scheme prioritizes overwriting inactive valid entries in the hash bucket to ensure that frequently used entries are preserved, while making reasonable use of the space of low-frequency entries. If the hash bucket is not full and there are no inactive entries, invalid entries are written to avoid the situation where the overall space is not fully utilized due to the activity of local entries.
[0038] In one optional implementation, if the value of the overwrite permission control bit carried by the newly added entry is low, the step of determining whether to overwrite an inactive entry in the target flow table that has the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry includes:
[0039] Write the data of the newly added table entry into the invalid table entry with the smallest index in the hash bucket.
[0040] When the overwrite permission control bit is low, the above scheme only allows writing invalid entries and prohibits overwriting valid entries, thus preventing critical business flow entries from being accidentally deleted. It eliminates the need to determine whether an entry is active and directly writes to the invalid entry location, reducing hardware logic complexity and chip design costs.
[0041] In an optional implementation, the method further includes:
[0042] If the hash bucket corresponding to the hash address of the newly added table entry is full, then report that the write of the newly added table entry failed.
[0043] The above scheme promptly reports failures in writing new entries when the hash bucket is full, enabling the software to take swift action to ensure the normal operation of the flow table and network performance.
[0044] In a second aspect, the present invention provides a flow meter aging device, the device comprising:
[0045] The activation state characterization module is used to obtain the target flow table to be managed and to characterize the activation state of each entry in the target flow table through a binary bitmap; the binary bitmap is configured by hardware logic.
[0046] An inactive entry identification module is used to periodically poll the binary bitmap to identify and delete inactive entries in the target flow table;
[0047] The new entry overwrite module is used to determine whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry when a new entry exists in the target flow table, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry.
[0048] In some alternative implementations, the binary bitmap consists of N bits; where N is equal to the product of the total number of entries in the target flow table and the number of bits M required for the activation state of a single entry.
[0049] Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of these M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
[0050] In some optional implementations, the activation state characterization module is further configured to:
[0051] When a new entry is added to the target flow table, the value of the M binary bits corresponding to the new entry is initialized to 0.
[0052] When a target entry in the target flow table is matched during a lookup, the value of the M binary bits corresponding to that target entry is incremented based on the number of matches, until it reaches the maximum value of 2. M -1 remains unchanged;
[0053] The first timer scans the binary bitmap at a first time interval, and decrements the values of the M binary bits corresponding to the non-zero entries based on the number of scans until the minimum value of 0 is reached, at which point the values remain unchanged; the first timer is set by hardware logic.
[0054] In some alternative implementations, the inactive entry identification module is also used for:
[0055] The second timer scans the binary bitmap at a second time interval, and deletes the corresponding entry from the target flow table when an inactive entry is detected; the second timer is set by software logic.
[0056] In some alternative implementations, the inactive entry identification module is also used for:
[0057] When the delete register is enabled, the third timer scans the binary bitmap at a third time interval. When an inactive entry is detected, the corresponding entry is deleted from the target flow table. Both the delete register and the third timer are set by hardware logic.
[0058] In some alternative implementations, the inactive entry identification module is also used for:
[0059] When the interrupt register is enabled, the fourth timer scans the binary bitmap at a fourth time interval and reports the addresses of inactive entries to the software control program, so that the software control program deletes the corresponding entries after responding to the interrupt; both the interrupt register and the fourth timer are set by hardware logic.
[0060] In some alternative implementations, the additional entry overriding module is also used for:
[0061] If the hash bucket corresponding to the hash address of the newly added entry is empty, then the newly added entry is written to the first entry position of the hash bucket;
[0062] If the hash bucket corresponding to the hash address of the newly added entry is not empty, then compare the new key of the newly added entry with the existing keys of all valid entries in the hash bucket.
[0063] If an existing keyword matches the newly added keyword, the entry data of the matching entry in the hash bucket will be replaced with the entry data of the newly added entry.
[0064] If no existing keyword matches the newly added keyword, then based on the value of the overwrite permission control bit carried by the newly added entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry.
[0065] In some optional implementations, if the value of the overlay permission control bit carried by the newly added entry is high, the newly added entry overlay module is further configured to:
[0066] If there are no active valid entries in the hash bucket, then the data of the newly added entry will be written to the active valid entry with the smallest index in the hash bucket.
[0067] If there are no inactive valid entries in the hash bucket and the hash bucket is not full, then the entry data of the newly added entry will be written to the invalid entry with the smallest index in the hash bucket.
[0068] In some optional implementations, if the value of the overwrite permission control bit carried by the newly added entry is low, the newly added entry overwrite module is further configured to:
[0069] Write the data of the newly added table entry to the invalid table entry with the smallest index in the hash bucket.
[0070] In some alternative implementations, the device is also used for:
[0071] If the hash bucket corresponding to the hash address of the newly added table entry is full, then report that the write to the newly added table entry failed.
[0072] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform a flow table aging method of the first aspect or any corresponding embodiment described above.
[0073] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform a flow table aging method according to the first aspect or any corresponding embodiment thereof.
[0074] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute a flow table aging method as described in the first aspect or any corresponding embodiment thereof.
[0075] The technical solution provided by this invention may include the following beneficial effects:
[0076] This invention, through a binary bitmap configured in hardware logic and a timed polling mechanism, is easy to implement and requires minimal additional logic resources, effectively solving the aging problem of flow tables. By periodically polling the binary bitmap and identifying inactive entries, these entries are deleted, freeing up cache space occupied by inactive entries and thus improving the utilization rate of the flow table cache. Furthermore, this invention supports multiple implementation methods. On one hand, software can delete inactive entries by setting a timer and scanning the binary bitmap, offering a simple and flexible approach. On the other hand, aging can be handled entirely by hardware logic. By setting deletion registers or interrupt registers, the hardware logic's timer and register configurations can independently complete the deletion or reporting operations, reducing software intervention, lowering the software burden and complexity, improving the overall system performance and response speed, and enabling flow table management to be optimized and adjusted according to actual needs and system resource conditions. Attached Figure Description
[0077] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0078] Figure 1 This diagram illustrates how the flow table engine uses a hash algorithm to look up and store table entry data.
[0079] Figure 2 This is a flowchart of a flow table aging method according to an embodiment of the present invention;
[0080] Figure 3 This is a flowchart of another flow table aging method according to an embodiment of the present invention;
[0081] Figure 4 This is a schematic diagram of the activation state of entries in a binary bitmap according to an embodiment of the present invention;
[0082] Figure 5 This is a structural block diagram of a flow meter aging device according to an embodiment of the present invention;
[0083] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0085] According to an embodiment of the present invention, a flow table aging method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0086] This embodiment provides a flow table aging method. Figure 2 This is a flowchart of a flow table aging method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0087] Step S201: Obtain the target flow table to be managed, and represent the activation state of each entry in the target flow table through a binary bitmap; the binary bitmap is configured by hardware logic.
[0088] Furthermore, this embodiment acquires the target flow table to be managed and records the activation status of each entry in the flow table through a binary bitmap configured by the hardware logic. Specifically, the hardware logic stores the entry activation status in newly added SRAM, using a binary bitmap (e.g., a 3-bit active value) to represent the activation level of each entry. For example, when an entry is added to the flow table, the hardware logic initializes the corresponding binary bit to 0 (indicating inactivity). As network traffic performs table lookups, if the entry is matched, the hardware logic updates the value of the corresponding binary bit (e.g., increments) to reflect the entry's activation status. This method of directly managing the binary bitmap by the hardware logic enables rapid recording and updating of entry activation status.
[0089] Step S202: Periodically poll the binary bitmap to identify and delete inactive entries in the target flow table.
[0090] Furthermore, this embodiment can periodically poll the binary bitmap using either software or hardware logic to identify and delete inactive entries. In the software implementation, the software logic sets a timer to scan the binary bitmap at regular intervals. If an inactive entry is found, the software logic deletes it from the flow table. In the hardware implementation, the hardware logic can perform this process independently. The hardware logic has a built-in timer that scans the binary bitmap at set intervals. When an inactive entry is detected, the hardware logic can directly delete the entry or report the entry address to the software for deletion. This periodic polling mechanism can promptly clean up inactive entries, free up flow table space, and improve resource utilization.
[0091] Step S203: When a new entry exists in the target flow table, determine whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry.
[0092] Furthermore, this embodiment can handle the overwrite operation of newly added entries through software logic, and determine whether to overwrite inactive entries based on the entry occupancy status of the hash bucket and the value of the overwrite permission control bit (such as the del_unact control field) carried by the newly added entry. Specifically, when a new entry is added, the software logic calculates its hash address and checks the corresponding hash bucket. If the hash bucket is empty, the software logic directly inserts the new entry into the first position of the hash bucket. If the hash bucket is not empty, the software logic checks whether there is an entry with the same key in the bucket. If there is an entry with the same key, the original entry is replaced. If there is no entry with the same key, the software logic determines whether to overwrite inactive entries based on the value of the overwrite permission control bit. For example, if the overwrite permission control bit is high (e.g., 1), the software logic will choose to replace the first inactive valid entry in the hash bucket; if the overwrite permission control bit is low (e.g., 0), it will not replace inactive valid entries, but will look for other invalid entries to insert into the new entry. This mechanism ensures that flow tables can efficiently manage new entries while avoiding unnecessary entry replacements, thus improving the flexibility and efficiency of flow table management.
[0093] In summary, this embodiment uses a binary bitmap to represent the activation status of entries in real time. The hardware logic configuration enables fast status queries, significantly reducing the computational overhead of flow table aging. The timed polling mechanism automatically identifies and deletes inactive entries, preventing invalid entries from occupying memory for extended periods and improving flow table space utilization. By combining hash bucket occupancy and overwrite permission control bits, inactive entry space is reused preferentially, reducing the probability of entry discarding during hash collisions, improving the flow table's adaptability to sudden traffic surges, preventing the loss of critical flow entries, and effectively addressing the entry management needs in high-speed network environments.
[0094] This embodiment provides a flow table aging method. Figure 3 This is a flowchart of another flow table aging method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:
[0095] Step S301: Obtain the target flow table to be managed, and represent the activation state of each entry in the target flow table through a binary bitmap; the binary bitmap is configured by hardware logic.
[0096] In one alternative implementation, the binary bitmap consists of N binary bits; where N is equal to the product of the total number of entries in the target flow table and the number of binary bits M required for the activation state of a single entry.
[0097] Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of these M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
[0098] In an optional implementation, step S201, "characterizing the activation state of each entry in the target flow table using a binary bitmap," includes:
[0099] When a new entry is added to the target flow table, the value of the M binary bits corresponding to the new entry is initialized to 0.
[0100] When a target entry in the target flow table is matched during a lookup, the value of the M binary bits corresponding to that target entry is incremented based on the number of matches, until it reaches the maximum value of 2. M -1 remains unchanged;
[0101] The first timer scans the binary bitmap at a first time interval, and decrements the values of the M binary bits corresponding to the non-zero entries based on the number of scans until the minimum value of 0 is reached, at which point the values remain unchanged; the first timer is set by hardware logic.
[0102] Furthermore, this binary bitmap (such as a Bitmap table, i.e., a storage structure that records the activation state of entries using binary bits) is configured by hardware logic and located in hardware storage units, such as SRAM. The total number of bits N in this binary bitmap is determined by the product of the total number of entries in the target flow table and the number of bits M for the state of a single entry (e.g., N = 1024 entries × 3 bits = 3072 bits). Each entry corresponds to M consecutive bits (M ≥ 2, taking 3 bits as an example) representing the activation level. When a new entry is added, the hardware logic initializes the corresponding M bits of the new entry to 0; when an entry is hit, the hardware logic automatically increments the value of the M bits (e.g., from 0 to 1) until it reaches the maximum value of 2. M The value remains unchanged after being -1 (7 for 3 bits); the hardware logic has a built-in first timer that periodically scans the bitmap, performing decrementing processing on the non-zero M-bit values (e.g., from 1 to 0), keeping the minimum value at 0. This process is completed automatically by the hardware logic without software intervention, reducing resource consumption with compact binary storage.
[0103] Please see Figure 4 The diagram illustrates the activation states of entries in a binary bitmap. Static Random Access Memory (SRAM) is used by the hardware logic to store the activation state of each entry in the flow table. SRAM provides fast read / write capabilities, making it suitable for frequently updated activation state data. The binary bitmap encodes the activation state of each entry in the flow table into a continuous binary bit field (e.g., ...). Figure 4 Taking 3 bits as an example (M=3), each entry in the flow table (including the key and processing action ad) is mapped one-to-one to a continuous 3-bit space of the Active Bitmap (i.e., binary bitmap) through hardware logic. When the software logic initiates a new entry write, the hardware logic automatically triggers the following operations: locates the physical address of the new entry in the flow table; forces 3 consecutive bits in the Active Bitmap corresponding to that address to 0 (e.g., 000), indicating that the entry is initially inactive (no traffic hit record). This process is completed by the hardware directly responding to the software write operation without additional instruction interaction, ensuring the efficiency of the new process. When network traffic triggers a table lookup hit (the hardware detects a key match), the hardware logic reads the 3-bit value of the Active Bitmap corresponding to the entry; if the current value is less than 7 (i.e., the maximum value of 3 bits), it is automatically incremented by 1 (e.g., 001→010); if it has reached 7 (111), it remains unchanged to avoid overflow. This mechanism is implemented through hardware logic to ensure low-latency response in high-speed traffic scenarios. The hardware has a built-in timer module (the timer interval can be configured to 1μs) that periodically traverses the ActiveBitmap according to the flow table address order, checking the 3-bit value bit by bit. This process is completely autonomously run by the hardware (without software interruption). For entries that have not been hit for a long time, the Active value will gradually decrease to 0, marking them as inactive, providing a basis for subsequent aging and deletion.
[0104] Step S302: Periodically poll the binary bitmap to identify and delete inactive entries in the target flow table.
[0105] In one optional implementation, step S302 includes:
[0106] The second timer scans the binary bitmap at a second time interval, and deletes the corresponding entry from the target flow table when an inactive entry is detected; the second timer is set by software logic.
[0107] In one optional implementation, step S302 includes:
[0108] When the delete register is enabled, the third timer scans the binary bitmap at a third time interval. When an inactive entry is detected, the corresponding entry is deleted from the target flow table. Both the delete register and the third timer are set by hardware logic.
[0109] In one optional implementation, step S302 includes:
[0110] When the interrupt register is enabled, the fourth timer scans the binary bitmap at a fourth time interval and reports the addresses of inactive entries to the software control program, so that the software control program deletes the corresponding entries after responding to the interrupt; both the interrupt register and the fourth timer are set by hardware logic.
[0111] Furthermore, this embodiment involves periodically polling the binary bitmap to identify and delete inactive entries, with three specific implementation methods. The first method is handled by software logic, which sets a second timer to scan the binary bitmap at a second time interval and delete inactive entries. The second method is handled by hardware logic, which enables the deletion register and then scans and directly deletes inactive entries at a third time interval. The third method is also handled by hardware logic, which enables the interrupt register, scans and reports the addresses of inactive entries, and the software control program responds to the interrupt to perform the deletion. These three methods provide flexible implementation options, allowing the appropriate execution entity to be selected according to system requirements, balancing the processing burden of hardware and software. For the first method, the software logic periodically scans the binary bitmap using a second timer (the interval can be configured to 1ms or longer). When it detects that the M-bit value of an entry is 0, the software logic writes 0 to the address of that entry to delete it. This mode allows administrators to dynamically adjust the polling interval based on network load, achieving a balance between flow table aging efficiency and CPU resource consumption, making it suitable for scenarios with high flexibility requirements. For the second approach, once the hardware's delete register is enabled by software, a third timer (e.g., at a fixed 1ms interval) starts scanning. If an entry with an M-bit value of 0 is found, the hardware directly writes 0 to the corresponding address to complete the deletion. In this mode, the hardware independently completes the entire scanning and deletion process without software intervention. For the third approach, once the hardware's interrupt register is enabled by software, a fourth timer (e.g., at a fixed 1ms interval) scans the bitmap. If an entry with an M-bit value of 0 is found, the hardware logic reports its address to the software. After responding to the interrupt, the software performs the deletion operation (e.g., writing 0 and reclaiming resources). This mode combines high-speed hardware scanning (hardware responsible for locating inactive entries) with flexible software processing (software responsible for logging), ensuring both efficiency and enhanced system reliability.
[0112] In other words, this embodiment can autonomously configure a second timer through software logic to periodically traverse the entire Active Bitmap. When the active value of a certain entry is read as 0, the software logic writes all zeros to the physical address of that entry (e.g., clearing the key and ad fields), completing the entry deletion. This mode flexibly adjusts the scanning frequency through software logic to adapt to different network loads. Secondly, this embodiment can also use a third timer with fixed intervals built into the hardware and add a del register (i.e., the deletion register). When the software sets the del register to valid, the third timer triggers a periodic scan. If an entry with an active value of 0 is detected, the hardware logic directly writes all zeros to its physical address, autonomously completing the deletion. This mode relies on hardware logic and does not require software intervention. In addition, this embodiment can also add an inten register (interrupt register) through hardware logic. When the inten register is valid, the fourth timer scans the Active Bitmap. After finding an entry with an active value of 0, it first reports the physical address of that entry to the software (triggers an interrupt). After the software responds to the interrupt, it performs a write-0 operation. This mechanism allows the hardware to handle efficient detection and address location, while the software handles decision-making and execution, thus avoiding the overhead of full scanning while preserving business flexibility.
[0113] Step S303: When a new entry exists in the target flow table, if the hash bucket corresponding to the hash address of the new entry is empty, the new entry is written to the first entry position of the hash bucket; if the hash bucket corresponding to the hash address of the new entry is not empty, the new key of the new entry is compared with the existing keys of all valid entries in the hash bucket.
[0114] Furthermore, this embodiment processes new entries in the target flow table through software logic. When a new entry is added, the software logic calculates its hash address and checks the corresponding hash bucket status. If the hash bucket is empty, the software logic directly writes the new entry into the first entry position of the hash bucket. If the hash bucket is not empty, the software logic compares the key of the new entry with the keys of all valid entries in the hash bucket to determine if an entry with the same key already exists. This step provides necessary information for subsequent decisions on whether to overwrite inactive entries. For example, when a new entry is added, the software logic calculates its hash address as bucket 5. If bucket 5 is empty, the software logic writes the new entry into the first position of bucket 5. If bucket 5 is not empty, the software logic checks each entry in bucket 5 to see if an entry with the same key exists.
[0115] Step S304: If there is an existing keyword that matches the new keyword, then the entry data of the matching entry in the hash bucket is replaced with the entry data of the new entry; if there is no existing keyword that matches the new keyword, then based on the value of the overwrite permission control bit carried by the new entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the new entry.
[0116] In an optional implementation, if the value of the overwrite permission control bit carried by the newly added entry is high, the step S304 of "determining whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry" includes:
[0117] If there are no active valid entries in the hash bucket, then the data of the newly added entry will be written to the active valid entry with the smallest index in the hash bucket.
[0118] If there are no inactive valid entries in the hash bucket and the hash bucket is not full, then the entry data of the newly added entry will be written to the invalid entry with the smallest index in the hash bucket.
[0119] In an optional implementation, if the value of the overwrite permission control bit carried by the newly added entry is low, the step S304 of "determining whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry" includes:
[0120] Write the data of the newly added table entry to the invalid table entry with the smallest index in the hash bucket.
[0121] Furthermore, in this embodiment, software logic determines whether to overwrite inactive entries based on the comparison result of step S303 and the value of the overwrite permission control bit carried by the newly added entry. If a matching keyword exists, the software logic replaces the data of the matching entry. If no matching keyword exists and the value of the overwrite permission control bit is high (e.g., the del_unact control field value is 1), the software logic selects the inactive or invalid entry with the smallest index in the hash bucket to write the data of the newly added entry. If the value of the overwrite permission control bit is low (e.g., the del_unact control field value is 0), the data of the newly added entry is only written to invalid entries. This ensures the flexibility and stability of flow table management. For example, if the overwrite permission control bit of the newly added entry is 1, and there are inactive entries in the hash bucket, the software logic will write the newly added entry to the position of the inactive entry with the smallest index. If the overwrite permission control bit is 0, the software logic will only write the newly added entry to the position of invalid entries. When adding a new table entry, the software logic can add an overwrite permission control bit (del_unact control field) to the entry data of the new entry. That is, the entry data of the new entry includes the key, the action ad, and the overwrite permission control bit. When the new entry is written to the hash bucket, the corresponding overwrite permission control bit is also written. That is, the entry data after writing also includes the key, the action ad, and the overwrite permission control bit.
[0122] In this context, a valid entry refers to an entry stored in the hash bucket that has not been deleted. In the flow table, a valid entry occupies the physical storage location of the hash bucket, and its entry data (such as the keyword `key` and processing action `ad`) is valid and not zeroed out. For example, when there are 6 entries in the hash bucket, all 6 entries are valid entries, regardless of whether they are active. Valid entries may be in an active or inactive state (determined by the `active` value), but have not yet been marked as deletable by the system.
[0123] An invalid entry refers to an unused or deleted entry location in the hash bucket. An invalid entry's storage location has been zeroed out (e.g., written with 0), or has never been written with valid data. For example, when software or hardware deletes an entry, it writes 0 to that entry's address, making it invalid. Unfilled spaces in the hash bucket (such as the last 3 locations when the bucket is 8 deep but only 5 entries are stored) are also considered invalid entries.
[0124] An active state refers to an entry in a binary bitmap where the `active` value is not 0 (i.e., bit M is not 0), indicating that the entry has been hit by network traffic within a certain period of time. The active state is maintained through hardware logic; each time an entry is hit, the `active` value increments by 1 (maximum value is 2). M-1 (e.g., 7 when M=3); When the timer scans periodically, the active value for non-zero entries is decremented. If the value is still greater than 0 after decrementing, the entry remains active. For example, entries with active values from 1 to 7 are all active, indicating that they have been used recently.
[0125] An inactive entry refers to an entry in the binary bitmap with an active value of 0 (i.e., bit M is 0), indicating that the entry has not been hit for a long time. An inactive entry may still be a valid entry (not deleted), but its active value has decayed to 0 due to prolonged inactivity. For example, an entry in a hash bucket may have an active value of 0 but has not yet been deleted; in this case, the entry is an inactive but valid entry and can be replaced by a new entry according to the overwrite policy.
[0126] In step S305, if the hash bucket corresponding to the hash address of the newly added table entry is full, then report that the write to the newly added table entry has failed.
[0127] Furthermore, if the hash bucket is completely full (e.g., all 8 entries are valid and active in a 3-bit scenario), this embodiment detects this state through hardware logic and reports a failure to write a new entry. Upon receiving this information, the software logic can take corresponding measures, such as adjusting the hash strategy or increasing the flow table size, to ensure the normal operation of the flow table and network performance. This step ensures that the system can respond and handle situations when flow table space is insufficient, avoiding potential performance issues.
[0128] In other words, when software logic adds a new entry to the flow table, the entry's data structure includes a bit named `del_unact` for overwriting permission control. This bit determines whether to overwrite an existing but inactive entry in the flow table when adding a new entry. If the bucket corresponding to the hash address of the new entry is empty (i.e., no entry is stored in the bucket), the new entry is directly stored in the first position of the bucket (index 0). In this case, no comparison or overwrite operation is required. If an entry already exists in the bucket, all valid entry data in the bucket needs to be read, and the key of the new entry needs to be checked to see if it matches the key of an existing entry in the bucket. If a matching key exists, the data of the existing entry is replaced with the data of the new entry. If no matching key exists, the handling depends on the value of the `del_unact` control bit. If the value of the `del_unact` control bit is 1, overwriting inactive entries is allowed, and the `active` value of all valid entries in the bucket is checked. If an entry with an active value of 0 (an inactive entry) exists, the first inactive entry is selected for replacement. If the active value of all valid entries is 1 (i.e., all entries are active), the position of the invalid entry in the bucket is selected to store the new entry. If the bucket is full (the active value of all 8 positions is 1), the software is reported that the new entry failed. If the del_unact control bit is 0, inactive entries are not allowed to be overwritten. In this case, the new entry can only be stored in an empty position in the bucket (the position of the invalid entry). If the bucket is full, the new entry is reported as failed. This embodiment, by combining entry deletion and refresh mechanisms, can flexibly decide whether to overwrite inactive entries based on the value of the del_unact control bit, thereby effectively managing the flow table space and improving the utilization rate of the entry space.
[0129] In summary, this embodiment, through a binary bitmap configured with hardware logic and a timed polling mechanism, is easy to implement and requires minimal additional logic resources, effectively addressing the aging problem of flow tables. By periodically polling the binary bitmap and identifying inactive entries, these entries are deleted, freeing up cache space occupied by inactive entries and improving the utilization rate of the flow table cache. Furthermore, this embodiment supports multiple implementation methods. On one hand, software can delete inactive entries by setting a timer and scanning the binary bitmap, offering a simple and flexible approach. On the other hand, aging can be handled entirely by hardware logic. By setting deletion registers or interrupt registers, the hardware logic's timer and register configurations can independently complete the deletion or reporting operations, reducing software intervention, lowering the software burden and complexity, improving overall system performance and response speed, and enabling flow table management to be optimized and adjusted according to actual needs and system resource conditions.
[0130] This embodiment also provides a flow table aging device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0131] This embodiment provides a flow meter aging device, such as Figure 5 As shown, it includes:
[0132] The activation state representation module 501 is used to obtain the target flow table to be managed and represent the activation state of each entry in the target flow table through a binary bitmap; the binary bitmap is configured by hardware logic.
[0133] The inactive entry identification module 502 is used to periodically poll the binary bitmap to identify and delete inactive entries in the target flow table;
[0134] The new entry overwrite module 503 is used to determine whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry when a new entry exists in the target flow table, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry.
[0135] In some alternative implementations, the binary bitmap consists of N bits; where N is equal to the product of the total number of entries in the target flow table and the number of bits M required for the activation state of a single entry.
[0136] Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of these M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
[0137] In some optional implementations, the activation state characterization module 501 is further configured to:
[0138] When a new entry is added to the target flow table, the value of the M binary bits corresponding to the new entry is initialized to 0.
[0139] When a target entry in the target flow table is matched during a lookup, the value of the M binary bits corresponding to that target entry is incremented based on the number of matches, until it reaches the maximum value of 2. M -1 remains unchanged;
[0140] The first timer scans the binary bitmap at a first time interval, and decrements the values of the M binary bits corresponding to the non-zero entries based on the number of scans until the minimum value of 0 is reached, at which point the values remain unchanged; the first timer is set by hardware logic.
[0141] In some alternative implementations, the inactive entry identification module 502 is further configured to:
[0142] The second timer scans the binary bitmap at a second time interval, and deletes the corresponding entry from the target flow table when an inactive entry is detected; the second timer is set by software logic.
[0143] In some alternative implementations, the inactive entry identification module 502 is further configured to:
[0144] When the delete register is enabled, the third timer scans the binary bitmap at a third time interval. When an inactive entry is detected, the corresponding entry is deleted from the target flow table. Both the delete register and the third timer are set by hardware logic.
[0145] In some alternative implementations, the inactive entry identification module 502 is further configured to:
[0146] When the interrupt register is enabled, the fourth timer scans the binary bitmap at a fourth time interval and reports the addresses of inactive entries to the software control program, so that the software control program deletes the corresponding entries after responding to the interrupt; both the interrupt register and the fourth timer are set by hardware logic.
[0147] In some alternative implementations, the additional entry overriding module 503 is further configured to:
[0148] If the hash bucket corresponding to the hash address of the newly added entry is empty, then the newly added entry is written to the first entry position of the hash bucket;
[0149] If the hash bucket corresponding to the hash address of the newly added entry is not empty, then compare the new key of the newly added entry with the existing keys of all valid entries in the hash bucket.
[0150] If an existing keyword matches the newly added keyword, the entry data of the matching entry in the hash bucket will be replaced with the entry data of the newly added entry.
[0151] If no existing keyword matches the newly added keyword, then based on the value of the overwrite permission control bit carried by the newly added entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry.
[0152] In some optional implementations, if the value of the overlay permission control bit carried by the newly added entry is high, the newly added entry overlay module 503 is further configured to:
[0153] If there are no active valid entries in the hash bucket, then the data of the newly added entry will be written to the active valid entry with the smallest index in the hash bucket.
[0154] If there are no inactive valid entries in the hash bucket and the hash bucket is not full, then the entry data of the newly added entry will be written to the invalid entry with the smallest index in the hash bucket.
[0155] In some optional implementations, if the value of the overlay permission control bit carried by the newly added entry is low, the newly added entry overlay module 503 is further configured to:
[0156] Write the data of the newly added table entry to the invalid table entry with the smallest index in the hash bucket.
[0157] In some alternative implementations, the device is also used for:
[0158] If the hash bucket corresponding to the hash address of the newly added table entry is full, then report that the write to the newly added table entry failed.
[0159] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0160] In summary, this embodiment, through a binary bitmap configured with hardware logic and a timed polling mechanism, is easy to implement and requires minimal additional logic resources, effectively addressing the aging problem of flow tables. By periodically polling the binary bitmap and identifying inactive entries, these entries are deleted, freeing up cache space occupied by inactive entries and improving the utilization rate of the flow table cache. Furthermore, this embodiment supports multiple implementation methods. On one hand, software can delete inactive entries by setting a timer and scanning the binary bitmap, offering a simple and flexible approach. On the other hand, aging can be handled entirely by hardware logic. By setting deletion registers or interrupt registers, the hardware logic's timer and register configurations can independently complete the deletion or reporting operations, reducing software intervention, lowering the software burden and complexity, improving overall system performance and response speed, and enabling flow table management to be optimized and adjusted according to actual needs and system resource conditions.
[0161] This invention also provides a computer device; please refer to [link / reference]. Figure 6 , Figure 6 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 6As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 6 Take a processor 10 as an example.
[0162] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0163] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0164] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0165] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0166] The computer device also includes a communication interface 30 for communicating with other devices or communication networks. The computer device also includes a timer, which can be implemented via software or configured via hardware. The computer device further includes a binary bitmap, a delete register, and an interrupt register, which can be configured via hardware.
[0167] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0168] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0169] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and all such modifications and variations fall within the defined scope.
Claims
1. A flow meter aging method, characterized in that, The method includes: The target flow table to be managed is obtained, and the activation status of each entry in the target flow table is represented by a binary bitmap; the binary bitmap is configured by hardware logic. The binary bitmap is periodically polled to identify and delete inactive entries in the target flow table; When a new entry exists in the target flow table, the system determines whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry. The step of determining whether to overwrite an inactive entry in the target flow table with the same hash address as the new entry, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry, includes: If the hash bucket corresponding to the hash address of the newly added entry is empty, then the newly added entry is written to the first entry position of the hash bucket; If the hash bucket corresponding to the hash address of the newly added table entry is not empty, then compare the new key of the newly added table entry with the existing keys of all valid table entries in the hash bucket; If an existing keyword that matches the newly added keyword exists, the entry data of the matching entry in the hash bucket is replaced with the entry data of the newly added entry. If no existing keyword matches the newly added keyword, then based on the value of the overwrite permission control bit carried by the newly added entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry.
2. The method according to claim 1, characterized in that, The binary bitmap consists of N binary bits; where N is equal to the product of the total number of entries in the target flow table and the number of binary bits M required for the activation state of a single entry. Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of the M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
3. The method according to claim 2, characterized in that, The method of representing the activation state of each entry in the target flow table using a binary bitmap includes: When a new entry is added to the target flow table, the values of the M binary bits corresponding to the new entry are initialized to 0; When a target entry in the target flow table is matched in a lookup, the value of the M binary bits corresponding to the target entry is incremented based on the number of matches, until it reaches the maximum value of 2. -1 remains unchanged; The first timer scans the binary bitmap at a first time interval, and decrements the values of the M binary bits corresponding to the non-zero entries based on the number of scans until the minimum value of 0 is reached, at which point the values remain unchanged; the first timer is set by hardware logic.
4. The method according to claim 1, characterized in that, The periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes: The second timer scans the binary bitmap at a second time interval, and deletes the corresponding entry from the target flow table when an inactive entry is detected; the second timer is set by software logic.
5. The method according to claim 1, characterized in that, The periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes: When the deletion register is enabled, a third timer scans the binary bitmap at a third time interval. When an inactive entry is detected, the corresponding entry is deleted from the target flow table. Both the deletion register and the third timer are set by hardware logic.
6. The method according to claim 1, characterized in that, The periodic polling of the binary bitmap to identify and delete inactive entries in the target flow table includes: When the interrupt register is enabled, the fourth timer scans the binary bitmap at a fourth time interval and reports the addresses of inactive entries to the software control program, so that the software control program deletes the corresponding entries after responding to the interrupt; both the interrupt register and the fourth timer are set by hardware logic.
7. The method according to claim 1, characterized in that, If the value of the overwrite permission control bit carried by the newly added entry is high, the step of determining whether to overwrite an inactive entry in the target flow table with the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry includes: If there are inactive valid entries in the hash bucket, then the entry data of the newly added entry will be written to the inactive valid entry with the smallest index in the hash bucket. If there are no inactive valid entries in the hash bucket and the hash bucket is not full, then the entry data of the newly added entry will be written to the invalid entry with the smallest index in the hash bucket.
8. The method according to claim 1, characterized in that, If the value of the overwrite permission control bit carried by the newly added entry is low, the step of determining whether to overwrite an inactive entry in the target flow table with the same hash address as the newly added entry based on the value of the overwrite permission control bit carried by the newly added entry includes: Write the data of the newly added table entry into the invalid table entry with the smallest index in the hash bucket.
9. The method according to claim 1, characterized in that, The method further includes: If the hash bucket corresponding to the hash address of the newly added table entry is full, then report that the write of the newly added table entry failed.
10. A flow meter aging device, characterized in that, The device includes: The activation state characterization module is used to obtain the target flow table to be managed and to characterize the activation state of each entry in the target flow table through a binary bitmap; the binary bitmap is configured by hardware logic. An inactive entry identification module is used to periodically poll the binary bitmap to identify and delete inactive entries in the target flow table; The new entry overwrite module is used to determine whether to overwrite an inactive entry in the target flow table that has the same hash address as the new entry when a new entry exists in the target flow table, based on the entry occupancy status of the hash bucket corresponding to the new entry and the value of the overwrite permission control bit carried by the new entry. The newly added table entry overriding module is also used for: If the hash bucket corresponding to the hash address of the newly added entry is empty, then the newly added entry is written to the first entry position of the hash bucket; If the hash bucket corresponding to the hash address of the newly added entry is not empty, then compare the new key of the newly added entry with the existing keys of all valid entries in the hash bucket. If an existing keyword matches the newly added keyword, the entry data of the matching entry in the hash bucket will be replaced with the entry data of the newly added entry. If no existing keyword matches the newly added keyword, then based on the value of the overwrite permission control bit carried by the newly added entry, it is determined whether to overwrite the inactive entry in the target flow table that has the same hash address as the newly added entry.
11. The apparatus according to claim 10, characterized in that, The binary bitmap consists of N binary bits; where N is equal to the product of the total number of entries in the target flow table and the number of binary bits M required for the activation state of a single entry. Each entry corresponds to M consecutive binary bits in the binary bitmap, and the value of these M binary bits represents the activation level of the corresponding entry; N and M are both positive integers, and M≥2.
12. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform a flow table aging method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform a flow table aging method according to any one of claims 1 to 9.
14. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform a flow table aging method according to any one of claims 1 to 9.