A flow table aging method, device, computer equipment and storage medium
By storing the flow identifier and its association relationship in the data link list, and deleting the flow identifier to be released in response to a preset threshold, the problem of low aging efficiency in the prior art is solved, and efficient flow table aging is achieved.
Patent Information
- Application Number
- CN202310445895.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-23
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2043-04-23
AI Technical Summary
The existing flow table aging methods have problems such as long aging cycle and low aging efficiency through time stamp comparison, which affects data access efficiency.
By storing the allocated flow identifier and its association relationship in the data link list, deleting the flow identifier and its association relationship to be released in response to a preset threshold, the flow table aging is achieved.
Without comparing the current timestamp with the timestamp of the flow table entry, the flow table aging is directly used to store the flow mark to be released at the header position of the data link list, which reduces the flow table aging time and improves the efficiency of flow table aging.
Smart Images

Figure CN116366530B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a flow table aging method, device, computer equipment and storage medium. Background Art
[0002] As a network communication protocol, OpenFlow can control the forwarding plane of online interactors or routers, thereby changing the network path taken by network data packets. In the OpenFlow system, data is often processed in units of flows. The flow table, as a collection of policy entries for specific flows, can be responsible for searching and forwarding data packets. However, due to the large flow of data flows, many entries will be generated, and since the cache used to store entries is limited and the data ports that can be allocated are also limited, if the entries are not aged in time, the efficiency of data access will be affected.
[0003] A common flow table aging method is to use the timestamp of each table entry. However, flow table aging based on timestamps requires comparing the current timestamp with the timestamp associated with each stored table entry, which usually has the problems of long aging cycle and low aging efficiency, affecting the efficiency of flow table aging. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a flow table aging method, apparatus, computer equipment and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a flow table aging method, including:
[0006] In response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold, the flow identifier to be released stored at the head position of the data linked list is determined; the data linked list is used to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and to store a first association relationship between the allocated flow identifier and the previous allocated flow identifier stored before the allocated flow identifier, and a second association relationship between the allocated flow identifier and the next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table related to the target port;
[0007] Deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and updating the linked list information of the data linked list;
[0008] The mapping relationship between the to-be-released flow identifier and the corresponding data address is deleted, and the number counted by the target port is initialized.
[0009] In a possible implementation, the data linked list includes a first linked list and a second linked list, the first linked list is used to store a first association relationship corresponding to each of the allocated flow identifiers, and the first association relationship is used to indicate a previous allocated flow identifier stored before the allocated flow identifier;
[0010] The deleting the to-be-released flow identifier and the corresponding first association relationship and the second association relationship in the data linked list, and updating the linked list information of the data linked list, includes:
[0011] For the first linked list, delete the to-be-released flow identifier and the first association relationship corresponding to the to-be-released flow identifier, and update the first association relationship corresponding to the allocated flow identifier corresponding to the head position of the first linked list and the next allocated flow identifier of the to-be-released flow identifier;
[0012] For the second linked list, the to-be-released flow identifier and the second association relationship corresponding to the to-be-released flow identifier are deleted, and the allocated flow identifier corresponding to the head position of the second linked list is updated.
[0013] In a possible implementation, the data linked list includes a bidirectional linked list, wherein each allocated flow identifier is stored in the bidirectional linked list, and each allocated flow identifier has a corresponding first pointer and a second pointer, wherein the first pointer is used to indicate a first association relationship corresponding to the allocated flow identifier, and the second pointer is used to indicate a second association relationship corresponding to the allocated flow identifier;
[0014] The deleting the to-be-released flow identifier and the corresponding first association relationship and the second association relationship in the data linked list, and updating the linked list information of the data linked list, includes:
[0015] Deleting the to-be-released flow identifier in the bidirectional linked list, and deleting the first association relationship indicated by the first pointer corresponding to the to-be-released flow identifier and the second association relationship indicated by the second pointer corresponding to the to-be-released flow identifier;
[0016] The first association relationship indicated by the first pointer corresponding to the allocated flow identifier corresponding to the head position of the bidirectional linked list and the next allocated flow identifier of the flow identifier to be released is updated.
[0017] In a possible implementation, the data linked list is established according to the following steps:
[0018] In response to a data stream access operation for a target data address, when there is no matching target allocated stream identifier for the target data address, assigning a corresponding target stream identifier to the target data address from unassigned stream identifiers in the preset stream identifiers;
[0019] Determine the target association relationship corresponding to the target flow identifier according to the allocated flow identifier stored in the data linked list;
[0020] Using the target flow identifier, updating the second association relationship of the allocated flow identifier at the tail position in the data linked list;
[0021] The tail information of the data linked list is updated by using the target flow identifier and the target association relationship.
[0022] In a possible implementation, the method further includes:
[0023] In the case where the target allocated flow identifier exists, determining a storage location of the target allocated flow identifier in the data linked list;
[0024] A linked list update operation is determined according to the storage location, and the data linked list is updated according to the linked list update operation.
[0025] In a possible implementation, determining a linked list update operation according to the storage location includes:
[0026] In the case where the storage position is located at the head position of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier at the head position and the corresponding first association relationship and second association relationship, updating the flow identifier at the head position of the data linked list to the next allocated flow identifier of the target allocated flow identifier, using the target allocated flow identifier to update the second association relationship of the allocated flow identifier at the tail position of the data linked list, and using the target allocated flow identifier and the corresponding newly created association relationship to update the tail information of the data linked list.
[0027] In a possible implementation, determining a linked list update operation according to the storage location includes:
[0028] In the case where the storage location is located at a preset location of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier and the corresponding first association relationship and second association relationship at the storage location, updating the established association relationship of the associated allocated flow identifier adjacent to the target allocated flow identifier, and updating the tail information of the data linked list using the target allocated flow identifier and the corresponding newly created association relationship;
[0029] The preset position is a position other than the chain head position and the chain tail position.
[0030] In a possible implementation manner, when there is a flow identifier that has been allocated to the target, the method further includes:
[0031] The number of data packets counted at the target port identified by the target allocated flow identifier is updated.
[0032] In a second aspect, the present disclosure also provides a flow meter aging device, including:
[0033] A determination module, configured to determine the flow identifier to be released stored at the head position of the data linked list in response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold; the data linked list is configured to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and to store a first association relationship between the allocated flow identifier and a previous allocated flow identifier stored before the allocated flow identifier, and a second association relationship between the allocated flow identifier and a next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table associated with the target port;
[0034] A first deleting module, used for deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and updating the linked list information of the data linked list;
[0035] The second deleting module is used to delete the mapping relationship between the to-be-released flow identifier and the corresponding data address, and to initialize the number counted by the target port.
[0036] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0037] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0038] For a description of the effects of the above-mentioned flow table aging device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned flow table aging method, which will not be repeated here.
[0039] The flow table aging method, device, computer equipment and storage medium provided by the embodiments of the present disclosure, a flow identifier corresponds to a flow table item, and is also associated with a target port. The allocated flow identifiers corresponding to each data address are stored in the data linked table according to the access sequence, so that the sequential storage of each data flow can be realized. By using the set preset threshold, the timing of deleting the allocated flow identifiers in the data linked table can be accurately determined. At the same time, since each allocated flow identifier in the data linked table is stored in a time sequence, when it is determined that the flow table needs to be aged, by deleting the flow identifier to be released stored at the head of the chain, the first association relationship and the second association relationship corresponding to the flow identifier to be released, and the mapping relationship between the data address corresponding to the flow identifier, the target port associated with the flow identifier to be released with the longest access time can be released in time, thereby completing the timely deletion of the flow table item associated with the above-mentioned data address and realizing flow table aging. During the entire flow table aging process, there is no need to compare the current timestamp with the timestamps corresponding to each flow table item. Only the to-be-released flow identifier stored at the head of the data linked list is needed to achieve timely aging of the flow table, effectively reducing the aging time of the flow table and improving the efficiency of flow table aging.
[0040] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0042] Figure 1 A flow chart of a flow table aging method provided by an embodiment of the present disclosure is shown;
[0043] Figure 2 A schematic diagram of a first linked list provided by an embodiment of the present disclosure is shown;
[0044] Figure 3 A schematic diagram of a second linked list provided by an embodiment of the present disclosure is shown;
[0045] Figure 4 A schematic diagram showing the interaction between a CAM module and an AGE module provided by an embodiment of the present disclosure is shown;
[0046] Figure 5 A schematic diagram of a bidirectional linked list provided by an embodiment of the present disclosure is shown;
[0047] Figure 6 A search method provided by the embodiment of the present disclosure is shown. Figure 5 Schematic diagram of updating the bidirectional linked list after the allocated flow identifier 1;
[0048] Figure 7 A search method provided by the embodiment of the present disclosure is shown. Figure 5 Schematic diagram of updating the bidirectional linked list after the allocated flow identifier 5 in;
[0049] Figure 8 A search method provided by the embodiment of the present disclosure is shown. Figure 5 After the allocated flow identifier 9 in the figure, the update diagram of the bidirectional linked list;
[0050] Fig. 9 A search method provided by the embodiment of the present disclosure is shown. Figure 5 After the allocated flow identifier 3 in , the update diagram of the bidirectional linked list;
[0051] Fig.10 A schematic diagram of a flow meter aging device provided by an embodiment of the present disclosure is shown;
[0052] Fig.11 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0054] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0055] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0056] It has been found through research that the flow table aging mechanism has a wide range of application scenarios. Common flow table aging can include mac address aging, address pointer aging, etc. However, the conventional flow table aging method is to use the timestamp mechanism to delete useless flow tables to improve the utilization efficiency of the flow table space. However, the problem with the above flow table aging method is that each time the flow table is aged, it is necessary to scan the entire table entry space, and then compare the timestamp of each table entry with the current timestamp of the timer to select the data flow that needs to be aged. The whole process takes a long time period, which affects the efficiency of flow table aging. For example, for the existing aging method, if it is necessary to select an aged flow table in 4 clock cycles, and the current aging module selects the flow table that needs to be aged from 32 flow tables, it takes exactly 4 clock cycles. Then, in the case of 1K queues (i.e., 1K flows), in order to select the flow that needs to be aged in 4 clock cycles, it is necessary to copy the flow table space into 1K / 32=32 copies, and at this time, 32 aging modules are required for aging processing. It can be seen that once the number of flow tables is large, in order to achieve flow table aging, the complexity of the aging system will increase, resulting in problems such as high resource consumption and low aging efficiency.
[0057] Based on the above research, the present disclosure provides a flow table aging method, device, computer equipment and storage medium, a flow identifier corresponds to a flow table item, and is also associated with a target port. The allocated flow identifiers corresponding to each data address are stored in the data linked table according to the access sequence, so that the sequential storage of each data flow can be realized. By using the set preset threshold, the timing of deleting the allocated flow identifiers in the data linked table can be accurately determined. At the same time, since each allocated flow identifier in the data linked table is stored in a time sequence, when it is determined that the flow table needs to be aged, by deleting the flow identifier to be released stored at the head of the chain, the first association relationship and the second association relationship corresponding to the flow identifier to be released, and the mapping relationship between the data address corresponding to the flow identifier, the target port associated with the flow identifier to be released with the longest access time can be released in time, thereby completing the timely deletion of the flow table item associated with the above data address and realizing flow table aging. During the entire flow table aging process, there is no need to compare the current timestamp with the timestamps corresponding to each flow table item. Only the to-be-released flow identifier stored at the head of the data linked list is needed to achieve timely aging of the flow table, effectively reducing the aging time of the flow table and improving the efficiency of flow table aging.
[0058] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0059] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0060] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0061] It should be noted that the specific terms mentioned in the embodiments of the present disclosure include:
[0062] CAM: Content-Addressable Memory, a memory that is addressed by content, has a cache mechanism that is completely opposite to that of Random Access Memory (RAM), and requires CAM index data to query whether a certain address exists; FPGA: Field Programmable Gate Array, a product that is further developed on the basis of programmable devices such as PAL (programmable array logic) and GAL (general array logic). It emerged as a semi-custom circuit in the field of application-specific integrated circuits, which not only solves the shortcomings of custom circuits, but also overcomes the shortcomings of the limited number of gate circuits of the original programmable devices.
[0063] To facilitate understanding of this embodiment, a flow table aging method disclosed in an embodiment of the present disclosure is first introduced in detail. The executor of the flow table aging method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with certain computing capabilities, wherein the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a personal digital assistant device (Personal Digital Assistant, PDA), a handheld device, a computer device, etc.; in some possible implementation methods, the flow table aging method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0064] The flow table aging method provided by the embodiment of the present disclosure is described below by taking a computer device as an example of an execution subject.
[0065] like Figure 1 As shown, it is a flow chart of a flow table aging method provided by an embodiment of the present disclosure, which may include the following steps:
[0066] S101: In response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold, determine the flow identifier to be released stored at the head position of the data linked list; the data linked list is used to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and store the first association relationship between the allocated flow identifier and the previous allocated flow identifier stored before the allocated flow identifier, and the second association relationship between the allocated flow identifier and the next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table related to the target port.
[0067] Here, the pre-established data linked list is used to store each allocated flow identifier according to the access timing of the data address corresponding to each allocated flow identifier, and the first association relationship and the second association relationship between each allocated flow identifier. The data address here can be a mac address, a pointer address, etc. located in the data message. The association relationship can be used to indicate the relationship between an allocated flow identifier and the allocated flow identifier accessed previously, and the relationship between the allocated flow identifier accessed later; wherein the latest access time of the data address corresponding to the allocated flow identifier accessed earlier is earlier than the latest access time of the data address corresponding to the allocated flow identifier. The latest access time of the data address corresponding to the allocated flow identifier accessed later is later than the latest access time of the data address corresponding to the allocated flow identifier. The first association relationship is used to indicate the association relationship between an allocated flow identifier and the previous allocated flow identifier stored before the allocated flow identifier, and the second association relationship is used to indicate the association relationship between an allocated flow identifier and the next allocated flow identifier stored after the allocated flow identifier.
[0068] The allocated flow identifier is the flow identifier (flow_id (Identity document, which is the ID number)) allocated to the data address in the preset flow identifier. A preset flow identifier may correspond to a data port, where the data port may be a logical port or a physical port. The preset flow identifier may be the identifier of each data port.
[0069] An allocated flow identifier corresponds to a flow table (flow_table). A flow table belongs to a flow table entry in the table entry space. The table entry space is used to store various flow table entries. Therefore, it can be known that the table entry space can be related to the data port assigned to the flow table entry. Among them, a data port can be assigned to a flow table entry, which can be used to count the information under any attribute related to the data address, for example, it can be used to count the number of data packets stored at the data address corresponding to the flow table entry, the number of times the statistical data address is accessed, etc. At the same time, a data port can correspond to an identifier, which can be used as the flow identifier corresponding to the allocated flow table entry when the data port is assigned to the flow table entry.
[0070] Exemplarily, the MAC address is 123456, and the identifier of data port1 is 1. After data port1 is assigned to address 123456, identifier 1 can be used as the allocated flow identifier of address 123456, and a mapping relationship between address 123456 and identifier 1 can be established. The mapping relationship is used to indicate that there is a flow table associated with address 123456 and data port1. In other words, the mapping relationship between the data address and the allocated flow identifier is used to indicate the flow table associated with the data address and the data port. Flow table aging is to release the data port corresponding to the flow identifier by deleting the mapping relationship between the data address and the flow identifier.
[0071] Optionally, a flow table may also be represented by a mapping relationship between a keyword with specific attributes in a data message and a data port, and keywords with different attributes may correspond to different data addresses.
[0072] In the data linked list, the latest access time (also referred to as the most recent access time) of the data address corresponding to the allocated flow identifier stored at different storage locations is different, wherein the latest access time of the data address corresponding to the allocated flow identifier stored at the head position of the chain has the longest difference from the current time, and the latest access time of the data address corresponding to the allocated flow identifier stored at the tail position of the chain has the shortest difference from the current time. The head position and the tail position of the chain can be a relative concept, which can be updated with the update of the data linked list. The head position of the chain can be the storage position corresponding to the first allocated flow identifier stored in the data linked list at the current moment, and the tail position of the chain can be the storage position corresponding to the last allocated flow identifier stored in the data linked list at the current moment.
[0073] The flow identifier to be released is the allocated flow identifier stored at the head position of the data linked list when the number of allocated flow identifiers in the data linked list reaches the preset threshold. The preset threshold can be set based on experience and the total number of preset flow identifiers, which is not specifically limited in the embodiment of the present disclosure. The total number of preset flow identifiers can be set based on the size of the cache space, which is not specifically limited in the embodiment of the present disclosure.
[0074] In specific implementation, the pre-set age AGE module can be used to query the flow ID queue (flow_id queue, represented by flow_idq) used to store each preset flow ID, and determine the number of unallocated preset flow IDs based on whether the preset flow ID indicated by the idle state indicator bit corresponding to each preset flow ID is valid. The number of allocated flow IDs is determined based on the number. When the number of allocated flow IDs reaches the preset threshold, it may be necessary to age the existing flow table to achieve the timely release of the allocated data port. Furthermore, the AGE module can be continued to be used to determine the allocated flow ID stored at the head position of the data chain table at this time, and the flow ID is used as the flow ID to be released, and the data port associated with the flow ID is used as the target port.
[0075] On the contrary, if the number of allocated flow identifiers does not reach the preset threshold, it means that the number of allocated target ports is still within a reasonable usage range and will not affect the system operation efficiency, so the flow table aging operation can be omitted. In this way, by setting a preset threshold, the flow table aging operation can be performed only when it is determined that the flow identifier has been used for more than a certain number, effectively avoiding the problem of performing the aging operation when the usage of the flow identifier is still within a reasonable range in the prior art, and effectively saving system resources.
[0076] Optionally, the flow table aging method provided in the embodiment of the present disclosure may be applied in the field of FPGA.
[0077] S102: Delete the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and update the linked list information of the data linked list.
[0078] S103: Delete the mapping relationship between the to-be-released flow identifier and the corresponding data address, and initialize the number of target port statistics.
[0079] Here, the linked list information of the data linked list may include link head information and / or link tail information. The mapping relationship between the flow identifier to be released and the corresponding data address may be stored in a CAM module. The CAM module may be used for flow table learning, flow table lookup, and flow table deletion. Exemplarily, when the mapping relationship between flow_id and the data address is deleted, it may be indicated that the target port corresponding to the flow_id is released, and the flow table associated with the flow_id will also be successfully aged. Before the number of target port statistics is initialized, the number of statistics may be the number of data packets stored at the data address having a mapping relationship with the target port. After the number is initialized, the number of data packets counted by the target port will be reset, so that the number of data packets corresponding to other data addresses can be accurately counted after the target port is assigned to other data addresses next time. For example, the number of data packets counted by the target port is initialized to 0.
[0080] In the specific implementation, since it is necessary to age the flow table in order to release the allocated data ports in time and improve the utilization efficiency of the flow table, when the number of allocated flow identifiers reaches a preset threshold, the CAM module can be used to delete the flow identifier to be released in the data linked list and the first association relationship and the second association relationship corresponding to the flow identifier to be released, and update the linked list information of the data linked list.
[0081] At the same time, the cam module can also be used to delete the mapping relationship between the flow identifier to be released and the corresponding data address, and initialize the number of target port statistics, so as to achieve timely release of the target port. After the target port is released, the idle state indicator corresponding to the preset flow identifier corresponding to the target port can be reset to invalid to indicate that the preset flow table is in an idle state, which is convenient for the subsequent reallocation of the target port. At the same time, after the target port is released, it can be said that the flow table represented by the mapping relationship between the flow identifier to be released and the corresponding data address has been successfully aged, thereby achieving timely aging of the flow table.
[0082] In this way, the allocated flow identifiers corresponding to each data address are stored in the data linked table according to the access sequence, so that the sequential storage of each data flow can be realized. By using the preset threshold, the timing of deleting the allocated flow identifiers in the data linked table can be accurately determined. At the same time, since each allocated flow identifier in the data linked table is stored in a time sequence, when it is determined that the flow table needs to be aged, by deleting the flow identifier to be released stored at the head position of the chain, the first association relationship and the second association relationship corresponding to the flow identifier to be released, and the mapping relationship between the data address corresponding to the flow identifier, the target port associated with the flow identifier to be released with the longest access time can be released in time, thereby completing the timely deletion of the flow table items associated with the above data addresses and realizing flow table aging. The entire flow table aging process does not need to compare the current timestamp with the timestamp corresponding to each flow table item. It only needs to use the flow identifier to be released stored at the head position of the data linked table to achieve timely aging of the flow table, effectively reducing the time of flow table aging and improving the efficiency of flow table aging.
[0083] In one embodiment, the data linked list may include a first linked list and a second linked list, the first linked list can be used to store a first association relationship corresponding to each allocated flow identifier, the first association relationship can be used to indicate a previous allocated flow identifier stored before the allocated flow identifier, and the second linked list can be used to store a second association relationship corresponding to each allocated flow identifier, the second association relationship can be used to indicate a next allocated flow identifier stored after the allocated flow identifier.
[0084] like Figure 2 As shown, it is a schematic diagram of a first linked list provided by an embodiment of the present disclosure, wherein the first association relationships corresponding to the allocated flow identifiers 1, 3, 5, 7 and 9 are stored, link_head represents the link head, corresponding to the allocated flow identifier 1; next_link_head represents the next link head, corresponding to the allocated flow identifier 3; link_tail represents the link tail, corresponding to the allocated flow identifier 9; pre_link_tail represents the previous link tail, corresponding to the allocated flow identifier 7; x can represent any flow identifier or be empty. Figure 2 The link_head in indicates that the allocated flow identifier at the head of the link is 1, so it can be understood that the allocated flow identifier 1 is the first stored flow identifier, and there is no previously stored flow identifier before this flow identifier. Therefore, the content x pointed to by the allocated flow identifier 1 represents the first association relationship between the allocated flow identifier 1 and x, where x is empty. For example, in Figure 2 In the figure, the content pointed to by the allocated flow identifier 5 is the allocated flow identifier 3, indicating the first association relationship between the allocated flow identifier 5 and the allocated flow identifier 3, that is, indicating that the allocated flow identifier stored before the allocated flow identifier 5 is the allocated flow identifier 3.
[0085] like Figure 3 As shown, it is a schematic diagram of a second linked list provided by an embodiment of the present disclosure, wherein second association relationships corresponding to allocated flow identifiers 1, 3, 5, 7 and 9 are stored respectively, link_head represents the chain head, corresponding to the allocated flow identifier 1; next_link_head represents the next chain head, corresponding to the allocated flow identifier 3; link_tail represents the chain tail, corresponding to the allocated flow identifier 9; pre_link_tail represents the previous chain tail, corresponding to the allocated flow identifier 7; allocated flow identifier 1 is the first stored flow identifier, and the content pointed to by allocated flow identifier 1 is allocated flow identifier 3, indicating the second association relationship between allocated flow identifier 1 and allocated flow identifier 3, that is, indicating that the next allocated flow identifier stored after allocated flow identifier 1 is allocated flow identifier 3. For another example, in Figure 3 , the content pointed to by the allocated flow identifier 3 is the allocated flow identifier 5, indicating a second association relationship between the allocated flow identifier 3 and the allocated flow identifier 5, that is, indicating that the allocated flow identifier stored after the allocated flow identifier 3 is the allocated flow identifier 5, Figure 3 The y in can represent any stream identifier or can be empty.
[0086] Further, in the case where the data linked list includes the first linked list and the second linked list, the step S102 may be a step related to both the first linked list and the second linked list. Specifically, the step S102 may be implemented according to the following steps:
[0087] For the first linked list, the to-be-released flow identifier and the first association relationship corresponding to the to-be-released flow identifier may be deleted, and the first association relationship corresponding to the allocated flow identifier corresponding to the head position of the first linked list and the next allocated flow identifier of the to-be-released flow identifier may be updated.
[0088] by Figure 2 Taking the first linked list shown as an example, the flow identifier to be released can be the allocated flow identifier 1. When it is determined that the table entry needs to be aged, the allocated flow identifier 1 stored in the first linked list and the first association relationship corresponding to the allocated flow identifier 1 can be deleted. At the same time, for the head position of the first linked list, the allocated flow identifier corresponding to the head position can be modified from the allocated flow identifier 1 to the allocated flow identifier 3, that is, the allocated flow identifier corresponding to link_head can be modified from the allocated flow identifier 1 to the allocated flow identifier 3; at the same time, the allocated flow identifier corresponding to next_link_head can be modified from the allocated flow identifier 3 to the allocated flow identifier 5. And, in Figure 2In the example, the next allocated flow identifier of the flow identifier to be released is the allocated flow identifier 3. Since the flow identifier to be released is deleted, the first association relationship corresponding to the allocated flow identifier 3 needs to be changed, and the first association relationship between the allocated flow identifier 3 and the allocated flow identifier 1 is updated to the first association relationship between the allocated flow identifier 3 and x (that is, the content pointed to by the allocated flow identifier 3 is changed from the allocated flow identifier 1 to x). Optionally, since the allocated flow identifier corresponding to the link_head has been changed to the allocated flow identifier 3, the first association relationship corresponding to the allocated flow identifier 3 may not be modified.
[0089] In addition, for the tail position of the first linked list, since only the to-be-released flow identifier is deleted and no new to-be-released flow identifier is stored in the first linked list, the allocated flow identifier at the tail position and other allocated flow identifiers except the next allocated flow identifier of the to-be-released flow identifier will not be affected, because they do not need to be updated. Figure 2 There is no need to modify the first association relationship corresponding to the allocated flow identifiers 5, 7 and 9.
[0090] For the second linked list, the to-be-released flow identifier and the second association relationship corresponding to the to-be-released flow identifier may be deleted, and the allocated flow identifier corresponding to the head position of the second linked list may be updated.
[0091] by Figure 3 Taking the second linked list shown as an example, the flow identifier to be released can be the allocated flow identifier 1. When it is determined that the table item needs to be aged, the allocated flow identifier 1 and the second association relationship corresponding to the allocated flow identifier 1 stored in the second linked list can be deleted. At the same time, for the head position of the second linked list, the allocated flow identifier corresponding to the head position can be modified from the allocated flow identifier 1 to the allocated flow identifier 3, that is, the allocated flow identifier corresponding to link_head is modified from the allocated flow identifier 1 to the allocated flow identifier 3; at the same time, the allocated flow identifier corresponding to next_link_head can be modified from the allocated flow identifier 3 to the allocated flow identifier 5. Since the association relationship stored in the second linked list is used to indicate the next allocated flow identifier stored after the allocated flow identifier, deleting the flow identifier to be released at the head position will not affect the second association relationships of other allocated flow identifiers stored in the second linked list, so there is no need to modify the second association relationships of other allocated flow identifiers.
[0092] like Figure 4As shown, it is a schematic diagram of the interaction between a CAM module and an AGE module provided in an embodiment of the present disclosure, wherein, in a specific implementation, after receiving the flow table access information, the CAM module can determine the current flow table access information based on the various flows that have been learned, whether there is a matching allocated flow identifier in the flow identifier queue. If so, the allocated flow identifier is sent to the AGE module, and the AGE module can determine the linked list update operations respectively related to the first linked list and the second linked list based on the allocated flow identifier, and generate an aging request carrying the linked list update operation and feed it back to the CAM module. Afterwards, the CAM module can execute the determined linked list update operation in response to the aging request, thereby realizing the update of the first linked list and the second linked list.
[0093] In another embodiment, the data linked list may also include a bidirectional linked list, in which each allocated flow identifier is stored, and each allocated flow identifier has a corresponding first pointer and a second pointer, the first pointer is used to indicate the first association relationship corresponding to the allocated flow identifier, and the second pointer is used to indicate the second association relationship corresponding to the allocated flow identifier. That is, the data linked list may be a bidirectional linked list, in which the allocated flow identifiers corresponding to the data addresses may be stored according to the access timing of the data addresses. At the same time, each stored allocated flow identifier has two pointers, namely a first pointer and a second pointer, the first pointer may point to the previous allocated flow identifier, for indicating the first association relationship corresponding to the allocated flow identifier and the previous allocated flow identifier; the second pointer may point to the next allocated flow identifier, for indicating the second association relationship corresponding to the allocated flow identifier and the next allocated flow identifier.
[0094] In the case where the data linked list is a bidirectional linked list, the above S102 can be implemented according to the following steps:
[0095] Delete the to-be-released flow identifier in the bidirectional linked list, as well as delete the first association relationship indicated by the first pointer corresponding to the to-be-released flow identifier and the second association relationship indicated by the second pointer corresponding to the to-be-released flow identifier; update the first association relationship indicated by the first pointer corresponding to the allocated flow identifier corresponding to the head position of the bidirectional linked list and the next allocated flow identifier of the to-be-released flow identifier.
[0096] like Figure 5 As shown, it is a schematic diagram of a bidirectional linked list provided by an embodiment of the present disclosure, in Figure 5It includes 5 allocated flow identifiers (i.e., allocated flow identifier 1, allocated flow identifier 3, allocated flow identifier 5, allocated flow identifier 7 and allocated flow identifier 9), each allocated flow identifier includes a first pointer indicating a first association relationship and a second pointer indicating a second association relationship. For example, for allocated flow identifier 1, the first association relationship indicated by the corresponding first pointer is the association relationship between allocated flow identifier 1 and allocated flow identifier x, and the second association relationship indicated by the corresponding second pointer is the association relationship between allocated flow identifier 1 and allocated flow identifier 3.
[0097] by Figure 5 Taking the bidirectional linked list in as an example, the flow identifier to be released can be the allocated flow identifier 1. When it is determined that the table entry needs to be aged, the allocated flow identifier 1 stored in the bidirectional linked list can be deleted, the first association indicated by the first pointer of the allocated flow identifier 1 can be deleted (that is, the first pointer and the x it points to are deleted), and the second association indicated by the second pointer of the allocated flow identifier 1 can be deleted (that is, the second pointer and the 3 it points to are deleted). At the same time, the allocated flow identifier corresponding to the head position of the link can be modified from the allocated flow identifier 1 to the allocated flow identifier 3, that is, the allocated flow identifier corresponding to link_head can be modified from the allocated flow identifier 1 to the allocated flow identifier 3; and the allocated flow identifier corresponding to next_link_head can be modified from the allocated flow identifier 3 to the allocated flow identifier 5. And, in Figure 5 In the example, the next allocated flow identifier of the flow identifier to be released is the allocated flow identifier 3. Since the flow identifier to be released is deleted, the first association relationship corresponding to the allocated flow identifier 3 needs to be changed, and the first association relationship between the allocated flow identifier 3 and the allocated flow identifier 1 is updated to the first association relationship between the allocated flow identifier 3 and x (that is, the content pointed to by the first pointer of the allocated flow identifier 3 is changed from the allocated flow identifier 1 to x). Optionally, since the allocated flow identifier corresponding to link_head has been changed to the allocated flow identifier 3, the first association relationship corresponding to the allocated flow identifier 3 may not be modified. Since the second association relationship indicated by the second pointer is used to indicate the next allocated flow identifier stored after the allocated flow identifier, deleting the flow identifier to be released at the head of the chain will not affect the second association relationships of other allocated flow identifiers stored in the second linked list, so there is no need to modify the content pointed to by the second pointers of other allocated flow identifiers, that is, there is no need to modify the second association relationships of other allocated flow identifiers.
[0098] At the same time, when a new data stream is received, a stream identifier can be assigned to the new data stream and the data linked list can be updated based on the interaction between the CAM module and the AGE module.
[0099] Specifically, the data linked list can be created and updated according to the following steps:
[0100] Step 1: In response to a data stream access operation for a target data address, when there is no matching target allocated stream identifier for the target data address, a corresponding target stream identifier is allocated to the target data address from unallocated stream identifiers in the preset stream identifiers.
[0101] Here, the data flow access operation is the flow table access operation. When there is no matching target assigned flow identifier for the target data address, it can be said that the current data flow is a new data flow, and a flow identifier needs to be assigned to the data flow to realize the statistics of the number of data packets associated with the target data address.
[0102] In specific implementation, the unallocated flow identifier in the idle state can be determined according to the idle state indication bits of each preset flow identifier stored in the flow identifier queue, and then the target flow identifier assigned to the new data flow can be assigned from the unallocated flow identifier, that is, the corresponding target flow identifier is assigned to the target data address, and the idle state indication bit of the target flow identifier is set to a valid state. Among them, regarding the operation of selecting the target flow identifier, any flow identifier can be randomly selected from the unallocated flow identifiers as the target flow identifier, or the unallocated flow identifier with the smallest identification number can be selected as the target flow identifier according to the size of the identification numbers corresponding to each unallocated flow identifier. After the target flow identifier is assigned to the target data address, a mapping relationship between the target data address and the target flow identifier can be established, thereby establishing a flow table related to the target flow identifier and the target data address.
[0103] Step 2: Determine the target association relationship corresponding to the target flow identifier according to the allocated flow identifier stored in the data linked list.
[0104] Step 3: Use the target flow identifier to update the second association relationship of the allocated flow identifier at the tail position in the data linked list.
[0105] Step 4: Use the target flow identifier and target association relationship to update the tail information of the data linked list.
[0106] Here, the target association relationship may include at least one of a first association relationship and a second association relationship corresponding to the target flow identifier. Exemplarily, in the case where the data linked list includes a first linked list and a second linked list, when the target flow identifier is stored in the above Figure 3 Before the second linked list shown in FIG. 1 , the second association relationship corresponding to the allocated flow identifier at the end of the chain may be the second association relationship corresponding to the allocated flow identifier 9. In the case where the data linked list includes a bidirectional linked list, the target flow identifier is stored in the above Figure 5 Before the bidirectional linked list shown, the second association relationship corresponding to the allocated flow identifier at the tail position of the chain can be the second association relationship pointed to by the second pointer corresponding to the allocated flow identifier 9.
[0107] In specific implementation, since the target flow identifier is the latest allocated flow identifier, the latest access time of the corresponding target data address must be later than each allocated flow identifier in the data linked list. Therefore, when the target flow identifier is stored in the data linked list, it must be stored before each stored allocated flow identifier in the data linked list, that is, the tail information of the data linked list will be modified to ensure that the target flow identifier becomes the flow identifier at the new tail position. Therefore, in the case where the data linked list includes a first linked list and a second linked list, the storage of the target flow identifier will only affect the second association relationship corresponding to the allocated flow identifier at the original tail position of the second linked list, so it is necessary to update the second association relationship using the target flow identifier. However, since the first association relationship corresponding to the target flow identifier needs to be established when the target flow identifier is stored in the first linked list. Therefore, before the target flow identifier is stored in the first linked list, the first association relationship between the target flow identifier and the allocated flow identifier can be established based on the allocated flow identifier at the tail position of the first linked list. Meanwhile, when the target flow identifier is positioned at the tail position of the first linked list and the second linked list, the link_tail corresponding to the first linked list and the second linked list may be modified to the target flow identifier.
[0108] Exemplarily, the target flow identifier is flow identifier 11, according to Figure 2 The allocated flow identifier 9 at the tail position of the first linked list in the first chain can establish a first association relationship between the flow identifier 11 and the allocated flow identifier 9, and use the flow identifier 11 to update the tail information of the first linked list to store the flow identifier 11 (at this time, the allocated flow identifier 9 will no longer correspond to the tail position), and at the same time modify the link_tail of the first linked list to the flow identifier 11, and modify the pre_link_tail to the allocated flow identifier 9. And, for Figure 3 The tail position of the second linked list shown in the figure has been allocated with flow ID 9, and a second association relationship between the allocated flow ID 9 and flow ID 11 can be established, and the tail information of the second linked list is updated with flow ID 111, so as to store flow ID 11 in the second linked list. The link_tail of the second linked list is modified to flow ID 11, and the pre_link_tail is modified to the allocated flow ID 9.
[0109] At the same time, a second association relationship of the flow identifier 11 may be established, wherein the second association relationship may indicate that the allocated flow identifier is stored after the flow identifier 11 as an unknown value, that is, indicating that the flow identifier 11 is the flow identifier at the tail position of the chain in the second linked list. Optionally, since the flow identifier 11 has been identified as being at the tail position of the chain by link_tail, the second association relationship corresponding to the flow identifier 11 may not be established first, and only the tail information of the second linked list may be updated by using the flow identifier 11 to store the flow identifier 11 in the second linked list until the tail information is updated again, and then a second association relationship between the flow identifier 11 and the newly stored flow identifier is established.
[0110] Furthermore, a mapping relationship between the flow identifier 11 and the target data address may be established and stored in the CAM module.
[0111] Alternatively, in the case where the data linked list is a doubly linked list, the storage of the target flow identifier will only affect the second association relationship indicated by the second pointer of the allocated flow identifier at the original tail position of the doubly linked list, so it is necessary to use the target flow identifier to update the content pointed to by the second pointer, that is, to modify the content pointed to by the second pointer to the target flow identifier, thereby realizing the update of the second association relationship of the allocated flow identifier at the original tail position. However, since it is also necessary to establish the first association relationship corresponding to the target flow identifier when storing the target flow identifier at the tail position of the doubly linked list, it is possible to establish the first association relationship between the target flow identifier and the allocated flow identifier based on the allocated flow identifier at the tail position of the doubly linked list before storing the target flow identifier in the doubly linked list. At the same time, when the target flow identifier is at the tail position of the doubly linked list, the link_tail corresponding to the doubly linked list can also be modified to the target flow identifier.
[0112] For example, in Figure 5 The first association relationship and the second association relationship corresponding to the allocated flow identifiers 1, 3, 5, 7, 9, and 11 are shown in FIG. For example, the content pointed to by the allocated flow identifier 5 is (3, 7), where 3 is the content pointed to by the first pointer of the allocated flow identifier 5, which is used to indicate that the flow identifier stored before the allocated flow identifier 5 is the allocated flow identifier 3, and 7 is the content pointed to by the second pointer of the allocated flow identifier 5, which indicates that the flow identifier stored after the allocated flow identifier 5 is the allocated flow identifier 7. Figure 5In the example, since the flow identifier at the tail position of the chain is the allocated flow identifier 11, the contents pointed to by the first pointer and the second pointer corresponding to the allocated flow identifier 11 are not shown, that is, the first association relationship and the second association relationship corresponding to the allocated flow identifier 11 are not shown, but the first association relationship corresponding to the allocated flow identifier 11 can also be known according to the allocated flow identifier 9 corresponding to pre_link_tail. At this time, if a new flow identifier 13 needs to be stored, the chain tail information of the bidirectional linked list can be updated using the flow identifier 13, link_tail can be modified to correspond to the flow identifier 13, and pre_link_tail can be modified to correspond to the allocated flow identifier 11. At the same time, the first pointer corresponding to the flow identifier 11 can also be pointed to the flow identifier 9 to establish the first association relationship between the flow identifier 9 and the flow identifier 11, and the second pointer corresponding to the flow identifier 11 can be pointed to the flow identifier 13 to establish the second association relationship between the allocated flow identifier 11 and the flow identifier 13, that is, the contents pointed to by the allocated flow identifier 11 can be modified to (9, 13). At the same time, a target association relationship corresponding to the flow identifier 13 can also be established, and the target association relationship can be empty or at least one of the first association relationship and the second association relationship. For example, the first pointer corresponding to flow identifier 13 may be pointed to flow identifier 11 to establish a first association relationship between flow identifier 11 and flow identifier 13, and the second pointer corresponding to flow identifier 13 may be pointed to flow identifier y (y is empty) to indicate that the second association relationship corresponding to flow identifier 13 is empty. Alternatively, only the first pointer corresponding to flow identifier 13 may be pointed to flow identifier 11 to only establish the first association relationship between flow identifier 11 and flow identifier 13. Alternatively, the target association relationship corresponding to flow identifier 13 may not be established, and the contents pointed to by the first pointer and the second pointer corresponding to the allocated flow identifier 11 may not be shown, that is, the first association relationship and the second association relationship corresponding to the allocated flow identifier 13 may not be shown, until the chain tail information is updated again, and then the first association relationship and the second association relationship corresponding to flow identifier 13 are established.
[0113] In one embodiment, a data address that has been assigned a flow identifier may be re-accessed, that is, a target flow identifier may already be assigned. In this case, the data linked list may be updated to ensure that the assigned flow identifiers stored in the data linked list can be stored strictly according to the access timing of the data address. Specifically, when a target flow identifier has already been assigned, the storage position of the target flow identifier in the data linked list may be determined first.
[0114] Then, the linked list update operation can be determined according to the storage location, and the data linked list can be updated according to the linked list update operation.
[0115] Here, when updating and storing the allocated flow identifiers at different storage locations, it may be necessary to update the association relationships of different numbers of other allocated flow identifiers, and it may also be necessary to update one or more of the chain head information and the chain tail information. Therefore, the target allocated flow identifiers at different storage locations will have different corresponding linked list update operations.
[0116] Exemplarily, the storage positions can be specifically divided into a chain head position, a chain tail position and a preset position, and the preset position is a position other than the chain head position and the chain tail position.
[0117] It should be noted that, in the case where there is a target allocated flow identifier, the number of data packets counted at the target port identified by the target allocated flow identifier may also be updated.
[0118] Exemplarily, when the data port identified by the target allocated flow identifier is port1, the number of data packets related to the target data address counted by port1 can be updated, for example, by adding 1 or N, where N can be determined based on the number of data packets carried by the target allocated flow identifier searched here.
[0119] In specific implementation, when the storage position is located at the head position of the data linked list, it can be determined that the linked list update operation includes: deleting the target allocated flow identifier at the head position and the corresponding first association relationship and second association relationship, updating the flow identifier at the head position of the data linked list to the next allocated flow identifier of the target allocated flow identifier, using the target allocated flow identifier to update the second association relationship of the allocated flow identifier at the tail position of the data linked list, and using the target allocated flow identifier and the corresponding newly created association relationship to update the tail information of the data linked list.
[0120] Here, the newly created association relationship may include a newly created first association relationship and a newly created second association relationship corresponding to the target allocated flow identifier, both of which may be empty. The chain tail information may include a chain tail pointer and its corresponding second association relationship, the chain tail pointer may be represented by link_tail, and the chain tail pointer is used to indicate the flow identifier at the chain tail position.
[0121] With the above Figure 5 Taking the bidirectional linked list shown as an example, when it is determined that there is a target allocated flow identifier (i.e., allocated flow identifier 1) at the head position of the message search chain, the operations performed at this time may include:
[0122] Delete the allocated flow identifier 1 stored at the link head position, delete the first association relationship and the second association relationship corresponding to the allocated flow identifier 1 (that is, delete the first pointer and the second pointer corresponding to the allocated flow identifier 1), update the link_head of the data link list to the allocated flow identifier 3, update the next_link_head to the allocated flow identifier 5, modify the second association relationship corresponding to the allocated flow identifier 11 to the association relationship between the allocated flow identifier 11 and the allocated flow identifier 1 (for example, Figure 5 The content pointed to by the allocated stream identifier 11 in is changed from (9, y) to (9, 1), where y can be a null value, that is, Figure 5 The content pointed to by the second pointer of the allocated flow identifier 11 is changed to 1), link_tail is updated to the allocated flow identifier 1, pre_link_tail is updated to the allocated flow identifier 11, and the content pointed to by the allocated flow identifier 1 is changed to (11, y), that is, the content pointed to by the first pointer of the allocated flow identifier 1 is set to 11, so as to establish a new first association relationship between the allocated flow identifier 1 and the allocated flow identifier 11; at the same time, the content pointed to by the second pointer of the allocated flow identifier 1 is set to y, so as to establish a new second association relationship between the allocated flow identifier 1 and the empty identifier.
[0123] like Figure 6 As shown, a search method provided by the embodiment of the present disclosure is Figure 5 Schematic diagram of the update of the bidirectional linked list after the assigned flow identifier 1 in . Figure 6 The doubly linked list before the update (i.e. Figure 5 The doubly linked list shown in the figure) and the updated doubly linked list, the contents pointed to by the first pointer and the second pointer of the allocated flow identifier 1 are modified to (11, y) which are not shown in the updated doubly linked list.
[0124] It can be understood that, in the case where the data linked list includes a first linked list and a second linked list, the target allocated flow identifier at the head position of the first linked list and the second linked list and the corresponding first association relationship and second association relationship can be deleted, the flow identifier at the head position of the first linked list and the second linked list can be updated to the next allocated flow identifier of the target allocated flow identifier, the target allocated flow identifier can be used to update the second association relationship of the allocated flow identifier at the tail position of the second linked list, the target allocated flow identifier can be stored at the head position of the first linked list and the second linked list, and a new first association relationship between the target allocated flow identifier and the allocated flow identifier at the original tail position of the first linked list can be established in the first linked list. At the same time, a new second association relationship between the target allocated flow identifier and a null value can be established in the second linked list.
[0125] In one embodiment, if the storage location is the end of the chain, the data linked list may not be updated. Figure 5 When the target in the data chain has been assigned flow identifier 11, since the target assigned flow identifier 11 itself is already at the end of the chain, there is no need to update the data chain list.
[0126] In another embodiment, when the storage location is located at a preset position of the data linked list, it can be determined that the linked list update operation includes: deleting the target allocated flow identifier and the corresponding first association relationship and second association relationship at the storage location, updating the established association relationship of the associated allocated flow identifier adjacent to the target allocated flow identifier, and using the target allocated flow identifier and the corresponding newly created association relationship to update the tail information of the data linked list.
[0127] Here, the associated allocated flow identifier may be the allocated flow identifier indicated by the first association relationship corresponding to the target allocated flow identifier (i.e., the previous allocated flow identifier), and the allocated flow identifier indicated by the second association relationship corresponding to the target allocated flow identifier (i.e., the next allocated flow identifier). Figure 5 When the allocated flow identifier in the data link list is 3, the associated allocated flow identifiers may be allocated flow identifier 1 and allocated flow identifier 5. The established association relationship may be associated with the first association relationship and the second association relationship corresponding to the allocated flow identifier before the target allocated flow identifier is stored in the data link list, wherein the established association relationship may be empty.
[0128] In a specific implementation, the associated allocated flow identifier adjacent to the target allocated flow identifier may include the previous allocated flow identifier and the next allocated flow identifier of the target allocated flow identifier. For the step of "updating the established association relationship of the associated allocated flow identifier adjacent to the target allocated flow identifier", in the case where the next allocated flow identifier in the associated allocated flow identifier is the allocated flow identifier at the end of the chain, the first association relationship and the second association relationship corresponding to the allocated flow identifier at the end of the chain may be updated, and the second association relationship of the previous allocated flow identifier in the associated allocated flow identifier may be updated. In the case where the next allocated flow identifier in the associated allocated flow identifier does not belong to the allocated flow identifier at the end of the chain, the first association relationship of the next allocated flow identifier and the second association relationship of the previous allocated flow identifier in the associated allocated flow identifier may be updated.
[0129] Exemplarily, in the case where the data linked list includes a first linked list and a second linked list, the target allocated flow identifier and the corresponding first association relationship and second association relationship at the preset positions of the first linked list and the second linked list can be deleted, the first association relationship of the next allocated flow identifier adjacent to the target allocated flow identifier in the first linked list is updated using the previous allocated flow identifier of the target allocated flow identifier, the second association relationship of the previous allocated flow identifier adjacent to the target allocated flow identifier in the second linked list is updated using the next allocated flow identifier of the target allocated flow identifier, the target allocated flow identifier is stored at the tail position of the first linked list and the second linked list, and in the first linked list, a new first association relationship is established between the target allocated flow identifier and the allocated flow identifier at the original tail position, and at the same time, a new second association relationship between the target allocated flow identifier and a null value can be established in the second linked list.
[0130] For example, Figure 5 Taking the bidirectional linked list shown in the figure as an example, when the message searches for the assigned flow ID 5, the following operations can be performed:
[0131] Delete the allocated flow identifier 5 at the preset position, delete the first association relationship and the second association relationship corresponding to the allocated flow identifier 5 (that is, delete the first pointer and the second pointer of the allocated flow identifier 5 and the content pointed to by the two pointers), update the second association relationship corresponding to the allocated flow identifier 3 (that is, modify the content pointed to by the second pointer of the allocated flow identifier 3 to 7, so as to realize the modification of the next allocated flow identifier of the allocated flow identifier 3 to the allocated flow identifier 7), update the first association relationship corresponding to the allocated flow identifier 7 (that is, modify the content pointed to by the first pointer of the allocated flow identifier 7 to 3, so as to realize the modification of the previous allocated flow identifier of the allocated flow identifier 7 to the allocated flow identifier 3), modify the second association relationship corresponding to the allocated flow identifier 11 to the second association relationship between the allocated flow identifier 11 and the allocated flow identifier 5 (for example, modify Figure 5 The content pointed to by the allocated flow identifier 11 in is modified from (9, y) to (9, 5), that is, the content pointed to by the second pointer of the allocated flow identifier 11 is modified to 5), link_tail is updated to the allocated flow identifier 5, pre_link_tail is updated to the allocated flow identifier 11, the allocated flow identifier 5 is stored at the end of the chain, and the content pointed to by the allocated flow identifier 5 is modified to (11, y), that is, the content pointed to by the first pointer of the allocated flow identifier 5 is set to 11, so as to establish a new first association relationship between the allocated flow identifier 5 and the allocated flow identifier 11; at the same time, the content pointed to by the second pointer of the allocated flow identifier 5 is set to y, so as to establish a new second association relationship between the allocated flow identifier 5 and the empty identifier.
[0132] like Figure 7 As shown, a search method provided by the embodiment of the present disclosure is Figure 5 Schematic diagram of the update of the bidirectional linked list after the allocated flow identifier 5 in . Figure 7 The doubly linked list before the update (i.e. Figure 5 In the updated two-way linked list, the content pointed to by the first pointer and the second pointer of the allocated flow identifier 5 is modified to (11, y) which is not shown in the updated two-way linked list. In the updated two-way linked list, the association relationship of the associated allocated flow identifiers adjacent to the target allocated flow identifier is updated, which can be reflected in that the content pointed to by the first pointer and the second pointer of the allocated flow identifier 3 is modified to (1, 7) and the content pointed to by the first pointer and the second pointer of the allocated flow identifier 7 is modified to (3, 9).
[0133] Still Figure 5 Taking the data linked list shown in the figure as an example, when the message searches for the assigned flow ID 9, the following operations can be performed:
[0134] Still Figure 5 Taking the bidirectional linked list shown in the figure as an example, when the message searches for the assigned flow ID 9, the following operations can be performed:
[0135] Delete the allocated flow identifier 9 at the preset position, delete the first association relationship and the second association relationship corresponding to the allocated flow identifier 9 (that is, delete the first pointer and the second pointer of the allocated flow identifier 9 and the content pointed to by the two pointers), update the second association relationship corresponding to the allocated flow identifier 7 (that is, modify the content pointed to by the second pointer of the allocated flow identifier 7 to 11, so as to change the next allocated flow identifier of the allocated flow identifier 7 to the allocated flow identifier 11), update the first association relationship of the allocated flow identifier 11 (that is, modify the content pointed to by the first pointer of the allocated flow identifier 11 to 7, so as to change the previous allocated flow identifier of the allocated flow identifier 11 to the allocated flow identifier 7), update the second association relationship of the allocated flow identifier 11 (that is, modify the content pointed to by the second pointer of the allocated flow identifier 11 to 9, so as to change the next allocated flow identifier of the allocated flow identifier 11 to the allocated flow identifier 9), that is, Figure 5 The content pointed to by the allocated flow identifier 11 in is changed from (9, y) to (7, 9), link_tail is updated to the allocated flow identifier 9, pre_link_tail is updated to the allocated flow identifier 11, the allocated flow identifier 9 is stored at the end of the chain, and the content pointed to by the allocated flow identifier 9 is changed to (11, y), that is, the content pointed to by the first pointer of the allocated flow identifier 9 is set to 11, so as to establish a new first association relationship between the allocated flow identifier 9 and the allocated flow identifier 11; at the same time, the content pointed to by the second pointer of the allocated flow identifier 9 is set to y, so as to establish a new second association relationship between the allocated flow identifier 9 and the empty identifier.
[0136] like Figure 8 As shown, a search method provided by the embodiment of the present disclosure is Figure 5 Schematic diagram of the update of the bidirectional linked list after the allocated flow identifier 9 in . Figure 8 The doubly linked list before the update (i.e. Figure 5 In the updated two-way linked list, the content pointed to by the first pointer and the second pointer of the allocated flow identifier 9 is modified to (11, y), which is not shown in the updated two-way linked list. In the updated two-way linked list, the association relationship of the associated allocated flow identifiers adjacent to the target allocated flow identifier is updated, which can be reflected in that the content pointed to by the first pointer and the second pointer of the allocated flow identifier 7 is modified to (5, 11) and the content pointed to by the first pointer and the second pointer of the allocated flow identifier 11 is modified to (7, 9).
[0137] Still Figure 5 Taking the data linked list shown in the figure as an example, when the message searches for the assigned flow identifier 3, the following operations can be performed:
[0138] Delete the allocated flow identifier 3 at the preset position, delete the first association relationship and the second association relationship corresponding to the allocated flow identifier 3 (that is, delete the first pointer and the second pointer of the allocated flow identifier 3 and the content pointed to by the two pointers), update the second association relationship corresponding to the allocated flow identifier 1 (that is, modify the content pointed to by the second pointer of the allocated flow identifier 1 to 5, so as to modify the next allocated flow identifier of the allocated flow identifier 1 to the allocated flow identifier 5), update the first association relationship corresponding to the allocated flow identifier 5 (that is, modify the content pointed to by the first pointer of the allocated flow identifier 5 to 1, so as to modify the previous allocated flow identifier of the allocated flow identifier 5 to the allocated flow identifier 1), update next_link_head to the allocated flow identifier 5, modify the second association relationship corresponding to the allocated flow identifier 11 to the second association relationship between the allocated flow identifier 11 and the allocated flow identifier 3 (for example, modify Figure 5 The content pointed to by the allocated stream identifier 11 in is changed from (9, y) to (9, 3), which is to Figure 5 The content pointed to by the second pointer of the allocated flow identifier 11 is changed to 3), link_tail is updated to the allocated flow identifier 3, pre_link_tail is updated to the allocated flow identifier 11, and the content pointed to by the allocated flow identifier 3 is changed to (11, y), that is, the content pointed to by the first pointer of the allocated flow identifier 3 is set to 11, so as to establish a new first association relationship between the allocated flow identifier 3 and the allocated flow identifier 11; at the same time, the content pointed to by the second pointer of the allocated flow identifier 3 is set to y, so as to establish a new second association relationship between the allocated flow identifier 3 and the empty identifier.
[0139] like Fig. 9As shown, a search method provided by the embodiment of the present disclosure is Figure 5 Schematic diagram of the update of the bidirectional linked list after the assigned flow identifier 3 in . Fig. 9 The doubly linked list before the update (i.e. Figure 5 In the updated two-way linked list, the contents pointed to by the first pointer and the second pointer of the allocated flow identifier 3 are modified to (11, y) which is not shown in the updated two-way linked list. In the updated two-way linked list, the association relationship of the associated allocated flow identifiers adjacent to the target allocated flow identifier is updated, which can be reflected in that the contents pointed to by the first pointer and the second pointer of the allocated flow identifier 1 are modified to (x, 5) and the contents pointed to by the first pointer and the second pointer of the allocated flow identifier 5 are modified to (1, 7).
[0140] It should be noted that the above Figures 6 to 9 The process of updating the storage location of the target allocated flow identifier is shown only in the bidirectional linked list. When the data linked list is divided into a first linked list and a second linked list, the above-mentioned process of updating the bidirectional linked list can be referred to and will not be repeated here. By timely updating the first linked list and the second linked list, the data accuracy of the first linked list and the second linked list can be guaranteed.
[0141] In this way, the data linked list is updated and created according to the storage position of the target allocated flow identifier in the data linked list, which can not only ensure that the allocated flow table identification in the data linked list can be stored strictly according to the access timing of the data address, but also when it is determined that table item aging needs to be performed, the table item with the longest access time can be aged first, so as to realize the timely release of the target port.
[0142] In one implementation, before initializing the number of target port statistics, the number of target port statistics currently counted may also be stored in a preset storage medium.
[0143] Here, the preset storage medium may specifically be a double data rate synchronous dynamic random access memory (Double Data Rate Synchronous Dynamic Random Access Memory, DDR SDRAM for short).
[0144] In the specific implementation, in order to ensure that the number information of the statistical number packets is not lost, before initializing the number of target port statistics, the communication connection between FPGA and DDR SDRAM can be used to store the current number of target port statistics in DDR SDRAM to achieve long-term storage of quantity information.
[0145] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0146] Based on the same inventive concept, a flow table aging device corresponding to the flow table aging method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned flow table aging method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0147] like Fig.10 FIG. 1 is a schematic diagram of a flow meter aging device provided in an embodiment of the present disclosure, comprising:
[0148] Determination module 1001, for determining the flow identifier to be released stored at the head position of the data linked list in response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold; the data linked list is used to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and to store a first association relationship between the allocated flow identifier and the previous allocated flow identifier stored before the allocated flow identifier, and a second association relationship between the allocated flow identifier and the next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table related to the target port;
[0149] A first deleting module 1002, configured to delete the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and update the linked list information of the data linked list;
[0150] The second deleting module 1003 is used to delete the mapping relationship between the to-be-released flow identifier and the corresponding data address, and initialize the number of target port statistics.
[0151] In a possible implementation, the data linked list includes a first linked list and a second linked list, the first linked list is used to store a first association relationship corresponding to each of the allocated flow identifiers, and the first association relationship is used to indicate a previous allocated flow identifier stored before the allocated flow identifier;
[0152] The first deleting module 1002 is used, when deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list and updating the linked list information of the data linked list:
[0153] For the first linked list, delete the to-be-released flow identifier and the first association relationship corresponding to the to-be-released flow identifier, and update the first association relationship corresponding to the allocated flow identifier corresponding to the head position of the first linked list and the next allocated flow identifier of the to-be-released flow identifier;
[0154] For the second linked list, the to-be-released flow identifier and the second association relationship corresponding to the to-be-released flow identifier are deleted, and the allocated flow identifier corresponding to the head position of the second linked list is updated.
[0155] In a possible implementation, the data linked list includes a bidirectional linked list, wherein each allocated flow identifier is stored in the bidirectional linked list, and each allocated flow identifier has a corresponding first pointer and a second pointer, wherein the first pointer is used to indicate a first association relationship corresponding to the allocated flow identifier, and the second pointer is used to indicate a second association relationship corresponding to the allocated flow identifier;
[0156] The first deleting module 1002 is used, when deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list and updating the linked list information of the data linked list:
[0157] Deleting the to-be-released flow identifier in the bidirectional linked list, and deleting the first association relationship indicated by the first pointer corresponding to the to-be-released flow identifier and the second association relationship indicated by the second pointer corresponding to the to-be-released flow identifier;
[0158] The first association relationship indicated by the first pointer corresponding to the allocated flow identifier corresponding to the head position of the bidirectional linked list and the next allocated flow identifier of the flow identifier to be released is updated.
[0159] In a possible implementation, the device further includes:
[0160] The establishing module 1004 is used to establish the data linked list according to the following steps:
[0161] In response to a data stream access operation for a target data address, when there is no matching target allocated stream identifier for the target data address, assigning a corresponding target stream identifier to the target data address from unassigned stream identifiers in the preset stream identifiers;
[0162] Determine the target association relationship corresponding to the target flow identifier according to the allocated flow identifier stored in the data linked list;
[0163] Using the target flow identifier, updating the second association relationship of the allocated flow identifier at the tail position in the data linked list;
[0164] The tail information of the data linked list is updated by using the target flow identifier and the target association relationship.
[0165] In a possible implementation manner, the establishing module 1004 is further configured to:
[0166] In the case where the target allocated flow identifier exists, determining a storage location of the target allocated flow identifier in the data linked list;
[0167] A linked list update operation is determined according to the storage location, and the data linked list is updated according to the linked list update operation.
[0168] In a possible implementation, the establishing module 1004, when determining the linked list update operation according to the storage location, is configured to:
[0169] In the case where the storage position is located at the head position of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier at the head position and the corresponding first association relationship and second association relationship, updating the flow identifier at the head position of the data linked list to the next allocated flow identifier of the target allocated flow identifier, using the target allocated flow identifier to update the second association relationship of the allocated flow identifier at the tail position of the data linked list, and using the target allocated flow identifier and the corresponding newly created association relationship to update the tail information of the data linked list.
[0170] In a possible implementation, the establishing module 1004, when determining the linked list update operation according to the storage location, is configured to:
[0171] In the case where the storage location is located at a preset location of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier and the corresponding first association relationship and second association relationship at the storage location, updating the established association relationship of the associated allocated flow identifier adjacent to the target allocated flow identifier, and updating the tail information of the data linked list using the target allocated flow identifier and the corresponding newly created association relationship;
[0172] The preset position is a position other than the chain head position and the chain tail position.
[0173] In a possible implementation, the device further includes:
[0174] The updating module 1005 is used, when the target has an assigned flow identifier, to:
[0175] The number of data packets counted at the target port identified by the target allocated flow identifier is updated.
[0176] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0177] Based on the same technical concept, the embodiment of the present application also provides a computer device. Fig.11 FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:
[0178] Processor 1101, memory 1102 and bus 1103. The memory 1102 stores machine-readable instructions executable by the processor 1101, and the processor 1101 is used to execute the machine-readable instructions stored in the memory 1102. When the machine-readable instructions are executed by the processor 1101, the processor 1101 performs the following steps: S101: In response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold, determine the flow identifier to be released stored at the head position of the data linked list; the data linked list is used to store the allocated flow identifier corresponding to the data address according to the access timing of the data address, and store the allocated flow identifier and the previous allocated flow identifier stored before the allocated flow identifier. A first association relationship between allocated flow identifiers, and a second association relationship with the next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table related to the target port; S102: delete the flow identifier to be released and the corresponding first association relationship and second association relationship in the data linked list, and update the linked list information of the data linked list; and S103: delete the mapping relationship between the flow identifier to be released and the corresponding data address, and initialize the number of target port statistics.
[0179] The above-mentioned memory 1102 includes internal memory 1121 and external memory 1122; the memory 1121 here is also called internal memory, which is used to temporarily store the calculation data in the processor 1101, as well as the data exchanged with the external memory 1122 such as the hard disk. The processor 1101 exchanges data with the external memory 1122 through the internal memory 1121. When the computer device is running, the processor 1101 and the memory 1102 communicate through the bus 1103, so that the processor 1101 executes the execution instructions mentioned in the above-mentioned method embodiment.
[0180] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the flow table aging method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0181] The computer program product of the flow table aging method provided in the embodiment of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the flow table aging method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0182] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0183] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0184] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0185] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0186] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0187] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0188] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A flow table aging method, characterized in that: include: In response to the number of allocated flow identifiers in the pre-established data linked list reaching a preset threshold, determining a flow identifier to be released stored at a head position of the data linked list; The data linked list is used to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and to store a first association relationship between the allocated flow identifier and a previous allocated flow identifier stored before the allocated flow identifier, and a second association relationship between the allocated flow identifier and a next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical data address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table related to the target port; The difference between the latest access time of the data address corresponding to the allocated flow identifier stored at the chain head position and the current time is the longest; Deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and updating the linked list information of the data linked list; The mapping relationship between the to-be-released flow identifier and the corresponding data address is deleted, and the number counted by the target port is initialized.
2. The method according to claim 1, characterized in that: The data linked list includes a first linked list and a second linked list, the first linked list is used to store a first association relationship corresponding to each of the allocated flow identifiers, the first association relationship is used to indicate a previous allocated flow identifier stored before the allocated flow identifier; The deleting the to-be-released flow identifier and the corresponding first association relationship and the second association relationship in the data linked list, and updating the linked list information of the data linked list, includes: For the first linked list, delete the to-be-released flow identifier and the first association relationship corresponding to the to-be-released flow identifier, and update the first association relationship corresponding to the allocated flow identifier corresponding to the head position of the first linked list and the next allocated flow identifier of the to-be-released flow identifier; For the second linked list, the to-be-released flow identifier and the second association relationship corresponding to the to-be-released flow identifier are deleted, and the allocated flow identifier corresponding to the head position of the second linked list is updated.
3. The method according to claim 1, characterized in that The data linked list comprises a bidirectional linked list, wherein each allocated flow identifier is stored in the bidirectional linked list, and each allocated flow identifier has a corresponding first pointer and a second pointer, wherein the first pointer is used to indicate a first association relationship corresponding to the allocated flow identifier, and the second pointer is used to indicate a second association relationship corresponding to the allocated flow identifier; The deleting the to-be-released flow identifier and the corresponding first association relationship and the second association relationship in the data linked list, and updating the linked list information of the data linked list, includes: Deleting the to-be-released flow identifier in the bidirectional linked list, and deleting the first association relationship indicated by the first pointer corresponding to the to-be-released flow identifier and the second association relationship indicated by the second pointer corresponding to the to-be-released flow identifier; The first association relationship indicated by the first pointer corresponding to the allocated flow identifier corresponding to the head position of the bidirectional linked list and the next allocated flow identifier of the flow identifier to be released is updated.
4. The method according to claim 2, characterized in that: The data linked list is established according to the following steps: In response to a data stream access operation for a target data address, when there is no matching target allocated stream identifier for the target data address, assigning a corresponding target stream identifier to the target data address from unassigned stream identifiers in the preset stream identifiers; Determine the target association relationship corresponding to the target flow identifier according to the allocated flow identifier stored in the data linked list; Using the target flow identifier, updating the second association relationship of the allocated flow identifier at the tail position in the data linked list; The tail information of the data linked list is updated by using the target flow identifier and the target association relationship.
5. The method according to claim 4, characterized in that The method further comprises: In the case where the target allocated flow identifier exists, determining a storage location of the target allocated flow identifier in the data linked list; A linked list update operation is determined according to the storage location, and the data linked list is updated according to the linked list update operation.
6. The method according to claim 5, characterized in that The step of determining a linked list update operation according to the storage location comprises: In the case where the storage position is located at the head position of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier at the head position and the corresponding first association relationship and second association relationship, updating the flow identifier at the head position of the data linked list to the next allocated flow identifier of the target allocated flow identifier, using the target allocated flow identifier to update the second association relationship of the allocated flow identifier at the tail position of the data linked list, and using the target allocated flow identifier and the corresponding newly created association relationship to update the tail information of the data linked list.
7. The method according to claim 5, characterized in that The step of determining a linked list update operation according to the storage location comprises: In the case where the storage location is located at a preset location of the data linked list, determining the linked list update operation includes: deleting the target allocated flow identifier and the corresponding first association relationship and second association relationship at the storage location, updating the established association relationship of the associated allocated flow identifier adjacent to the target allocated flow identifier, and updating the tail information of the data linked list using the target allocated flow identifier and the corresponding newly created association relationship; The preset position is a position other than the chain head position and the chain tail position.
8. The method according to claim 5, characterized in that In the case where the target has an assigned flow identifier, the method further includes: The number of data packets counted at the target port identified by the target allocated flow identifier is updated.
9. A flow meter aging device, characterized in that: include: A determination module, configured to determine the flow identifier to be released stored at the head position of the data linked list in response to the number of allocated flow identifiers in a pre-established data linked list reaching a preset threshold; the data linked list is configured to store the allocated flow identifiers corresponding to the data addresses according to the access timing of the data addresses, and to store a first association relationship between the allocated flow identifier and a previous allocated flow identifier stored before the allocated flow identifier, and a second association relationship between the allocated flow identifier and a next allocated flow identifier stored after the allocated flow identifier; the target port identified by the allocated flow identifier is used to count the number of data packets stored at the statistical address; the mapping relationship between the data address and the allocated flow identifier is used to characterize the flow table associated with the target port; The difference between the latest access time of the data address corresponding to the allocated flow identifier stored at the chain head position and the current time is the longest; A first deleting module, used for deleting the to-be-released flow identifier and the corresponding first association relationship and second association relationship in the data linked list, and updating the linked list information of the data linked list; The second deleting module is used to delete the mapping relationship between the to-be-released flow identifier and the corresponding data address, and to initialize the number counted by the target port.
10. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the flow table aging method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the flow table aging method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data packet management method, system and device
CN113595822A
Data message storage method and device and computer equipment
CN114489505A
Cited By
Flow table aging method and device, computer apparatus and storage medium
US12549490B2