A multicast table processing method, device and electronic equipment
By combining the destination address and source address of IP multicast forwarding entries, the common prefix and change information are determined, stored in TCAM and SRAM, and index relationships are established, which solves the problems of high storage costs and small specifications in the prior art, and improves the router IP multicast performance and storage efficiency of the device.
Patent Information
- Application Number
- CN202211627103.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-12-16
AI Technical Summary
In the prior art, the storage method of multiple IP multicast forwarding entries leads to high cost of TCAM and SRAM, and the storage specifications are small, making it difficult to effectively improve the IP multicast performance of router devices.
By combining the destination address and source address of the IP multicast forwarding entry as the destination address, the public prefix and change information are determined, stored in TCAM and SRAM respectively, and the index relationship between the public prefix and SRAM table entry in TCAM is established to increase the TCAM Storage capacity to reduce the use of TCAM.
It improves the IP multicast performance of router devices, reduces storage costs, saves IP multicast resources, and increases the table entry storage specifications.
Smart Images

Figure CN115955435B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communications, and in particular to a multicast table processing method, device and electronic device. Background Art
[0002] With the rapid development of the Internet, many multimedia applications with high bandwidth requirements have emerged on the network, such as e-commerce, online conferencing, video on demand, etc. The various data, voice and video information exchanged in the network are increasing, which has brought about the rapid consumption of bandwidth and network congestion. In order to alleviate such problems, people have found that most of these services conform to the point-to-multipoint model, and IP multicast technology can ensure that the backbone bandwidth load will not increase significantly when the number of users continues to increase, and at the same time can effectively ensure information security. IP multicast technology has been widely used due to its unique advantages.
[0003] At present, a storage method for multiple IP multicast forwarding entries is: the complete source address and destination address of each IP multicast forwarding table are stored in TCAM (ternary content addressable memor). This storage method needs to consume a large amount of TCAM to store multiple IP multicast forwarding entries, the storage cost is high, and the storage specification is small. Another storage method is: through HASH cascade storage, when multiple IP multicast forwarding entries only have destination addresses, the hash value is calculated using the destination addresses of multiple IP multicast forwarding entries to calculate the next hop, and the source addresses of multiple IP multicast forwarding entries are stored in SRAM1 (Static Random-Access Memory). When multiple IP multicast forwarding entries contain source addresses and destination addresses, the destination address is stored in SRAM1, and the next hop is calculated based on the HASH value calculated based on the source address, and the source address is stored in SRAM2. This method needs to consume more SRAM and has a high storage cost. Summary of the invention
[0004] The purpose of the present application is to provide a multicast table processing method, device and electronic device, which can improve the performance of IP multicast of router equipment and reduce storage costs.
[0005] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for processing a multicast table, the method comprising:
[0007] Determine the destination address and source address corresponding to the multiple IP multicast forwarding entries to be stored;
[0008] Combining the destination address and source address of each of the IP multicast forwarding entries as the target address of the IP multicast 5 forwarding entry;
[0009] Determine at least one common prefix contained in each of the target addresses and first change information of each of the target addresses, wherein the first change information is information in the target address other than the common prefix, and the common prefix is the prefix with the most matching items with the target address;
[0010] Storing each of the common prefixes in a TCAM;
[0011] 0. Storing each of the first change information in SRAM, wherein each of the first change information corresponding to a different common prefix constitutes a first SRAM table entry;
[0012] An index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry is established.
[0013] In an optional implementation manner, the step of determining at least one common 5 prefix included in each of the target addresses and the first change information of each of the target addresses includes:
[0014] Determine at least one first-level common prefix included in each of the target addresses, wherein the number of matching items between the first-level common prefix and the target address is less than the number of matching items between the common prefix and the target address;
[0015] Determine each first address information of each target address except the first common prefix; 0 Determine at least one secondary common prefix contained in each first address information and second change information of each first address information, wherein the second change information is the information in the first address information except the secondary common prefix.
[0016] In an optional implementation manner, the step of storing each of the common prefixes in the TCAM includes:
[0017] 5. Store the first-level common prefix in TCAM.
[0018] In an optional implementation manner, the step of storing each of the first change information in the SRAM includes:
[0019] storing each of the secondary common prefixes in a first SRAM, wherein each of the secondary common prefixes corresponding to different first-level common prefixes constitutes a second SRAM table entry;
[0020] Each of the second change information is stored in a second SRAM, wherein each of the second change information corresponding to a different secondary common prefix constitutes a third SRAM table entry.
[0021] In an optional implementation manner, the step of establishing an index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry includes:
[0022] An index relationship between each of the first-level common prefixes in the TCAM and the corresponding second SRAM table entry and the corresponding third SRAM table entry is established.
[0023] In an optional implementation, the step of determining at least one common prefix included in each of the target addresses and the first change information of each of the target addresses includes:
[0024] Construct at least one dictionary tree based on each of the target addresses;
[0025] The root nodes corresponding to different dictionary trees are used as the common prefixes;
[0026] For each dictionary tree, a child node in the dictionary tree is determined as the first change information of the dictionary tree.
[0027] In a second aspect, an embodiment of the present application provides a multicast table processing method, the method comprising:
[0028] Determine the IP multicast message information to be forwarded;
[0029] The destination address and source address corresponding to the IP multicast message information to be forwarded are used as target indexes;
[0030] Searching for a target prefix having the most matches with the target index from a TCAM, wherein the TCAM stores a plurality of common prefixes;
[0031] Determine a target SRAM table entry corresponding to the target prefix from the SRAM, wherein the SRAM stores first SRAM table entries having an index relationship with each common prefix in the TCAM, and the target SRAM table entry is composed of a plurality of first change information corresponding to the target prefix;
[0032] In the case where the target SRAM table entry is valid, determining first data of the target index excluding the target prefix, wherein the target SRAM table entry is valid indicating that the target prefix does not completely include all information of the target index;
[0033] Using the first data as an index of the target SRAM table entry, determining first change information with the most matching items from the target SRAM table entry;
[0034] The IP multicast message information to be forwarded is forwarded based on the next hop of the first change information with the most matching items.
[0035] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the multicast table processing method when executing the computer program.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the multicast table processing method when executed by a processor.
[0037] This application has the following beneficial effects:
[0038] The present application obtains the target address of each IP multicast forwarding entry by taking the destination address and source address of each IP multicast forwarding entry as a whole, determines at least one common prefix contained in each target address and the first change information of each target address, stores each common prefix in a TCAM, stores the first change information in an SRAM, and establishes an index relationship between the common prefix in the TCAM and the corresponding first SRAM table entry in the SRAM. Through the above-mentioned multicast table processing method, the multiple IP multicast forwarding entry data that can be stored behind the TCAM is greatly increased, and the use of the TCAM can be reduced, thereby saving IP multicast resources and improving the table storage specifications, reducing storage costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application;
[0041] Figure 2 One of the flowcharts of a multicast table processing method provided in an embodiment of the present application;
[0042] Figure 3 One of the storage relationship tables of TCAM and SRAM provided in the embodiment of the present application;
[0043] Figure 4 The second storage relationship table of TCAM and SRAM provided in the embodiment of the present application;
[0044] Figure 5 The third storage relationship table of TCAM and SRAM provided in the embodiment of the present application;
[0045] Figure 6 The fourth storage relationship table of TCAM and SRAM provided in the embodiment of the present application;
[0046] Figure 7 A second flowchart of a multicast table processing method provided in an embodiment of the present application;
[0047] Figure 8 Table 5 of the storage relationship between TCAM and SRAM provided in the embodiment of the present application;
[0048] Fig. 9 A third flowchart of a multicast table processing method provided in an embodiment of the present application;
[0049] Fig.10 A structural block diagram of a multicast table processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0051] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0052] 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.
[0053] In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, it is based on the orientation or position relationship shown in the drawings, or is the orientation or position relationship in which the product of the invention is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.
[0054] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0055] In the description of this application, it should also be noted that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0056] After a lot of research by the inventor, it is found that in the commonly used storage methods for multiple IP multicast forwarding entries in the prior art, the first one stores the complete source address and destination address of each IP multicast forwarding table in TCAM (ternary content addressable memory), and this storage method needs to consume a large amount of TCAM to store multiple IP multicast forwarding entries, the storage cost is high, and the storage specification is small. Another storage method is: by HASH cascade storage, when multiple IP multicast forwarding entries only have destination addresses, the destination addresses of multiple IP multicast forwarding entries are used to calculate the hash value to calculate the next hop, and the source addresses of multiple IP multicast forwarding entries are stored in SRAM1 (Static Random-Access Memory), when multiple IP multicast forwarding entries contain source addresses and destination addresses, the destination addresses are stored in SRAM1, and the next hop is calculated based on the source address. The source address is stored in SRAM2. This method needs to consume more SRAM, and the storage cost is high.
[0057] In view of the discovery of the above problems, the present embodiment provides a multicast table processing method, device and electronic device, which can obtain the target address of each IP multicast forwarding entry by taking the destination address and source address of each IP multicast forwarding entry as a whole, determine at least one common prefix contained in each target address and the first change information of each target address, store each common prefix in TCAM, store the first change information in SRAM, and establish an index relationship between the common prefix in TCAM and the corresponding first SRAM table entry in SRAM. Through the above multicast table processing method, the multiple IP multicast forwarding entry data that can be stored behind TCAM is greatly increased, and the use of TCAM can be reduced, thereby saving IP multicast resources and improving the table storage specifications, reducing storage costs. The solution provided by this embodiment is elaborated in detail below.
[0058] This embodiment provides an electronic device that can process a multicast table. In a possible implementation, the electronic device can be a user terminal, for example, the electronic device can be, but is not limited to, a server, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), etc.
[0059] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of the structure of the electronic device 100 provided in the embodiment of the present application. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0060] The electronic device 100 includes a multicast table processing device 110 , a memory 120 , and a processor 130 .
[0061] The memory 120 and the processor 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The multicast table processing device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or fixed in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the memory 120, such as the software function modules and computer programs included in the multicast table processing device 110.
[0062] The memory 120 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 120 is used to store a program, and the processor 130 executes the program after receiving an execution instruction.
[0063] Please refer to Figure 2 , Figure 2 For application Figure 1 The flowchart of a multicast table processing method of the electronic device 100 is shown in FIG.
[0064] Step 201: Determine the destination addresses and source addresses corresponding to multiple IP multicast forwarding entries to be stored.
[0065] Step 202: Combine the destination address and source address of each IP multicast forwarding entry as the target address of the IP multicast forwarding entry.
[0066] Step 203: Determine at least one common prefix included in each target address and first change information of each target address.
[0067] The first change information is information in the target address except for the common prefix, and the common prefix is a prefix with the most matching items with the target address.
[0068] Step 204: Store each common prefix in the TCAM.
[0069] Step 205: Store each first change information into SRAM.
[0070] The first change information corresponding to different common prefixes constitutes a first SRAM table entry.
[0071] Step 206: Establish an index relationship between each common prefix in the TCAM and the corresponding first SRAM table entry.
[0072] Exemplarily, the IP multicast forwarding entries to be stored correspond to destination addresses and source addresses. The destination address and source address of each IP multicast forwarding entry are taken as a whole, that is, the destination address and source address of each IP multicast forwarding entry are taken as a whole as the destination address of each IP multicast forwarding entry.
[0073] In one implementation method of determining the common prefix and first change information of the target address, at least one dictionary tree is constructed based on each target address, and the root nodes corresponding to different dictionary trees are used as the common prefixes. For each dictionary tree, the child nodes in the dictionary tree are determined as the first change information of the dictionary tree.
[0074] In another implementation, based on the type of the target address, at least one common prefix of each target address of the same type is determined.
[0075] Exemplary: when the target address is a first type address, that is, the first type address indicates that the IP multicast forwarding entry has both a source address and a destination address.
[0076] When the first type of address has a common prefix, for example: when multiple target addresses include (230.255.1.1, 1.1.0.1), (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.2.1), (230.255.1.1, 1.1.3.1), (230.255.1.1, 1.1.4.1) and (230.255.1.1, 1.1.5.1), it is determined that the common prefix corresponding to the above multiple target addresses is (230.255.1.1.1.1), and the first change information is (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1).
[0077] The common prefix (230.255.1.1.1.1) is stored in the TCAM, and each first change information (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1) is stored in the SRAM, and the first SRAM table entry is composed of (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1). An index relationship is established between the common prefix (230.255.1.1.1.1) and (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1) constituting the first SRAM table entry.
[0078] like Figure 3As shown, it is a storage relationship table of TCAM and SRAM. When multiple target addresses include (230.255.1.1, 1.1.0.1), (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.2.1), (230.255.1.1, 1.1.3.1), (230.255.1.1, 1.1.4.1) and (230.255.1.1, 1.1.5.1), it is determined that the common prefix corresponding to the above multiple target addresses is (230.255.1.1.1.1), and the first change information is (0.1), (1.1), (2.1), (3.1), (4.1) and (5.1).
[0079] When the first type of address has two common prefixes, for example: when multiple target addresses include (230.255.1.1, 1.1.0.1), (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.2.1), (240.255.1.1, 1.1.3.1), (240.255.1.1, 1.1.4.1) and (240.255.1.1, 1.1.5.1), it is determined that the common prefixes corresponding to the above multiple target addresses are (230.255.1.1.1.1) and (240.255.1.1.1.1), and the first change information is (0.1), (1.1), (2.1), (3.1), (4.1) and (5.1).
[0080] like Figure 4 As shown, it is a storage relationship table between TCAM and SRAM, the common prefixes (230.255.1.1.1.1) and (240.255.1.1.1.1) are stored in TCAM, and the first change information (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1) are stored in SRAM, wherein (0.1), (1.1), and (2.1) constitute a first SRAM table entry, and (3.1), (4.1), and (5.1) constitute another SRAM table entry, an index relationship is established between the common prefix (230.255.1.1.1.1) and the first change information (0.1), (1.1), and (2.1) constituting a first SRAM table entry, and an index relationship is established between the common prefix (240.255.1.1.1.1) and the first change information (3.1), (4.1), and (5.1) constituting another SRAM table entry.
[0081] exist Figure 3 and Figure 4 In the example, each common prefix corresponds to a next hop, and each first change information also corresponds to a next hop.
[0082] When the target address is a second type address, that is, the second type address indicates that the IP multicast forwarding entry only includes the table entry of the group, that is, the second type address indicates that the IP multicast forwarding entry only has the destination address.
[0083] When multiple target addresses include (230.255.2.1), (230.255.2.2), (230.255.2.3), (230.255.2.4), (230.255.2.5), and (230.255.2.6), it is determined that the common prefix corresponding to the above multiple target addresses is (230.255.2), and the first change information is (1), (2), (3), (4), (5), and (6).
[0084] like Figure 5 As shown, it is a storage relationship table between TCAM and SRAM, the common prefix (230.255.2) is stored in TCAM, and each first change information (1), (2), (3), (4), (5), (6) is stored in SRAM, and the first SRAM table entry is composed of (1), (2), (3), (4), (5), (6), and an index relationship is established between the common prefix (230.255.2) and (1), (2), (3), (4), (5), (6) to constitute the first SRAM table entry.
[0085] When the target address includes both the first type address and the second type address, at least one common prefix of each first type address and each second type address is determined respectively. Specifically, the multicast table is processed in the following manner:
[0086] When the target address includes: a first type address and a second type address, wherein the first type address includes: (230.255.1.1, 1.1.0.1), (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.2.1), (230.255.1.1, 1.1.3.1), (230.255.1.1, 1.1.4.1), (230.255.1.1, 1.1.5.1), and the second type address includes: (230.255.2.1), (230.255.2.2), (230.255.2.3), (2 When the common prefix of the above multiple first-type addresses is (230.255.1.1.1.1), the common prefix of the multiple second-type addresses is (230.255.2), the first change information of the common prefix (230.255.1.1.1.1) is (0.1), (1.1), (2.1), (3.1), (4.1), and (5.1), and the first change information of the common prefix (230.255.2) is (1), (2), (3), (4), (5), and (6).
[0087] like Figure 6 As shown, it is a storage relationship table between TCAM and SRAM, the common prefixes (230.255.1.1.1.1) and (230.255.2) are stored in TCAM, and the first change information (0.1), (1.1), (2.1), (3.1), (4.1), (5.1), (1), (2), (3), (4), (5), and (6) are stored in SRAM, (1.1), (2.1), (3.1), (4.1), and (5.1) constitute a first SRAM table entry, and (1), (2), (3), (4), (5), and (6) constitute another first SRAM table entry. An index relationship is established between the common prefix (240.255.1.1.1.1) and the first SRAM table entry composed of (1.1), (2.1), (3.1), (4.1), and (5.1), and an index relationship is established between the common prefix (230.255.2) and the first SRAM table entry composed of (1), (2), (3), (4), (5), and (6).
[0088] exist Figure 5 and Figure 6 In the example, each common prefix corresponds to a next hop, and each first change information also corresponds to a next hop.
[0089] The present application obtains the target address of each IP multicast forwarding entry by taking the destination address and source address of each IP multicast forwarding entry as a whole, determines at least one common prefix contained in each target address and the first change information of each target address, stores each common prefix in a TCAM, stores the first change information in an SRAM, and establishes an index relationship between the common prefix in the TCAM and the corresponding first SRAM table entry in the SRAM. Through the above-mentioned multicast table processing method, the IP multicast forwarding entry data that can be stored behind the TCAM is greatly increased, and the use of the TCAM can be reduced, thereby saving IP multicast resources and improving the table storage specifications, reducing storage costs.
[0090] There are many implementations for determining the common prefix of the target address and the first change information. In one implementation, for example: Figure 7 As shown, the specific steps include:
[0091] Step 203-1: Determine at least one first-level common prefix included in each target address.
[0092] The number of matching items between the first-level common prefix and the target address is less than the number of matching items between the common prefix and the target address.
[0093] Step 203-2: Determine each first address information of each target address except the first-level common prefix.
[0094] Step 203 - 3 : Determine at least one secondary common prefix included in each piece of first address information and second change information of each piece of first address information.
[0095] The second change information is the information in the first address information except the secondary common prefix.
[0096] The first-level common prefix is stored in the TCAM, and each secondary common prefix is stored in the first SRAM, wherein each secondary common prefix corresponding to different first-level common prefixes constitutes a second SRAM table entry; each second change information is stored in the second SRAM, wherein each second change information corresponding to different secondary common prefixes constitutes a third SRAM table entry, and an index relationship between each first-level common prefix in the TCAM and the corresponding second SRAM table entry and the corresponding third SRAM table entry is established.
[0097] Exemplarily, the target addresses include (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.1.2), (230.255.1.1, 1.1.1.3), (230.255.1.1, 1.1.1.4), (230.255.1.1, 1.1.1.5), (230.255.1.1, 1.1.1.6), (230.255.1.1, 2.2.2.1), (230.255.1.1, 2.2.2.2), (230.255.1.1, 2.2.2.3), (230.255.1.1, 2.2.2.4), (230.255 .1.1,2.2.2.5), (230.255.1.1,2.2.2.6), determine the first-level common prefix of multiple target addresses, the first-level common prefix is the common prefix of all target addresses, wherein the first-level common prefix of the above target addresses is (203.255.1.1), and the first-level common prefix is removed to obtain the first address information: (1.1.1.1), (1.1.1.2), (1.1.1.3), (1.1.1.4), (1.1.1.5), (1.1.1.6), (2.2.2.1), (2.2.2.2), (2.2.2.3), (2.2.2.4), (2.2.2.5), (2.2.2.6). Determine at least one secondary common prefix in the above-mentioned first address information, wherein the secondary common prefixes of the above-mentioned first address information are (1.1.1) and (2.2.2), and the secondary common prefix is the prefix with the most matches with the first address information. Based on the secondary common prefix, determine the second change information of each first address information: (1), (2), (3), (4), (5), (6), (1), (2), (3), (4), (5), (6).
[0098] like Figure 8As shown, it is a storage relationship table between TCAM and SRAM, the first-level common prefix (203.255.1.1) is stored in TCAM, the secondary common prefixes (1.1.1) and (2.2.2) are stored in the first SRAM, the second change information (1), (2), (3), (4), (5), (6), (1), (2), (3), (4), (5), (6) are stored in the second SRAM, (1.1.1) and (2.2.2) constitute a second SRAM table entry, (1), (2), (3), (4), (5), (6) constitute a third SRAM table entry, and (1), (2), (3), (4), (5), (6) constitute another third SRAM table entry. An index relationship is established between the first-level common prefix (203.255.1.1) and the second SRAM table entry, and a corresponding relationship between the third SRAM table entry corresponding to the secondary common prefix in the second SRAM table entry is constructed, that is, an index relationship is established between the secondary common prefix (1.1.1) in the second SRAM table entry and a third SRAM table entry composed of (1), (2), (3), (4), (5), and (6), and an index relationship is established between the secondary common prefix (2.2.2) in the second SRAM table entry and another third SRAM table entry composed of (1), (2), (3), (4), (5), and (6).
[0099] In another example, the common prefixes of the target addresses are determined. When the target addresses include (230.255.1.1, 1.1.1.6), (230.255.1.1, 2.2.2.1), (230.255.1.1, 2.2.2.2), (230.255.1.1, 2.2.2.3), (230.255.1.1, 2.2.2.4), (230.255.1.1, 2.2.2.5), (230.255.1.1, 2.2.2.6), an example is given:
[0100] Determine that the common prefix of each target address: (230.255.1.1, 1.1.1.1), (230.255.1.1, 1.1.1.2), (230.255.1.1, 1.1.1.3), (230.255.1.1, 1.1.1.4), (230.255.1.1, 1.1.1.5), (230.255.1.1, 1.1.1.6) is: (230.255.1.1.1.1.1), determine that the third change information of each target address other than the common prefix is (1), (2), (3), (4), (5), (6), store (1), (2), (3), (4), (5), (6) in the second SRAM, store (230.255.1.1.1.1) in the first SRAM, determine the target addresses (230.255.1.1,1.1.1.6), (230.255.1.1,2.2.2.1), (230.255.1.1,2.2.2.2), (230.255.1.1,2.2.2.3), (230.255.1.1,2.2.2.4), (230.255.1.1,2 .2.2.5) and (230.255.1.1,2.2.2.6) are: (230.255.1.1,2.2.2), determine that the fourth change information of each target address other than the common prefix is (1), (2), (3), (4), (5), (6), store (1), (2), (3), (4), (5), (6) in the second SRAM, store the common prefix (230.255.1.1,2.2.2) in the first SRAM, and determine the common prefix (230.255.1.1.1.1.2) stored in the first SRAM. 1) and the first-level common prefix in the common prefix (230.255.1.1, 2.2.2): (230.255.1.1), store (230.255.1.1) in the TCAM, store the fifth change information (1.1.1) and (2.2.2) except the common prefix (230.255.1.1) in the first SRAM, and replace the previously stored (230.255.1.1.1.1) and (230.255.1.1, 2.2.2) with the fifth change information. A second SRAM table entry is formed based on (1.1.1) and (2.2.2), a third SRAM table entry is formed by (1), (2), (3), (4), (5), and (6), and another third SRAM table entry is formed by (1), (2), (3), (4), (5), and (6).An index relationship is established between the first-level common prefix (203.255.1.1) and the second SRAM table entry, and a corresponding relationship between the third SRAM table entry corresponding to the secondary common prefix in the second SRAM table entry is constructed, that is, an index relationship is established between the secondary common prefix (1.1.1) in the second SRAM table entry and a third SRAM table entry composed of (1), (2), (3), (4), (5), and (6), and an index relationship is established between the secondary common prefix (2.2.2) in the second SRAM table entry and another third SRAM table entry composed of (1), (2), (3), (4), (5), and (6).
[0101] After the multicast table is stored, there are many implementations for forwarding based on the stored multicast table. In one implementation, Fig. 9 As shown, the following steps are included:
[0102] Step 301: Determine the IP multicast message information to be forwarded.
[0103] Step 302: Use the destination address and source address corresponding to the IP multicast message information to be forwarded as the target index.
[0104] Step 303: Search the TCAM for the target prefix with the most matching items with the target index.
[0105] Wherein, multiple common prefixes are stored in the TCAM.
[0106] Step 304: Determine a target SRAM table entry corresponding to the target prefix from the SRAM.
[0107] The SRAM stores first SRAM table entries that have an index relationship with the common prefixes in the TCAM, and the target SRAM table entry is composed of a plurality of first change information corresponding to the target prefix.
[0108] Step 305: When the target SRAM entry is valid, determine the first data of the target index excluding the target prefix.
[0109] The target SRAM table entry effectively indicates that the target prefix does not completely contain all the information of the target index.
[0110] Step 306: Use the first data as an index of the target SRAM table entry, and determine the first change information with the most matching items from the target SRAM table entry.
[0111] Step 307: forward the IP multicast message information to be forwarded based on the next hop of the first change information with the most matching items.
[0112] The IP multicast message information to be forwarded enters the chip from the port, and the chip obtains the destination address and source address of the IP multicast message information to be forwarded. The chip uses the destination address and source address of the IP multicast message information to be forwarded as the target index, and searches for the target prefix with the most matches with the target index from the multiple common prefixes stored in the TCAM. Since there is an index relationship between the common prefixes in the TCAM and the first SRAM table entries in the SRAM, the target SRAM table entry corresponding to the target prefix is determined from the SRAM based on the index relationship between the target prefix and the first SRAM table entries in the SRAM, and the first change information with the most matches with the first data of the target index except the target prefix is determined from the target SRAM table entry. Since the first change information corresponds to a next hop, the IP multicast message information to be forwarded is forwarded based on the next hop of the first change information with the most matches.
[0113] When the target SRAM entry is invalid, the next hop of the target prefix is determined, wherein the invalid target SRAM indicates that the target prefix contains all information of the target index, and the IP multicast message information to be forwarded is forwarded based on the next hop of the target prefix.
[0114] When all the information of the target index matches any common prefix destination information in the TCAM, the common prefix matching the target index is determined to be the target prefix, and the target SRAM table entry corresponding to the target prefix is obtained from the SRAM. At this time, the obtained target SRAM table entry is empty, indicating that the target SRAM table entry is invalid. The next hop corresponding to the target prefix is directly determined, and the multiple IP multicast message information to be forwarded is forwarded.
[0115] Please refer to Fig.10 The present application embodiment also provides a method for applying Figure 1 The multicast table processing device 110 of the electronic device 100 includes:
[0116] A first determining module 111, configured to determine a destination address and a source address corresponding to a plurality of IP multicast forwarding entries to be stored;
[0117] A merging module 112, configured to merge the destination address and the source address of each of the IP multicast forwarding entries to be stored as the target address of the IP multicast forwarding entry to be stored;
[0118] A second determination module 113 is configured to determine at least one common prefix contained in each of the target addresses and first change information of each of the target addresses, wherein the first change information is information in the target address other than the common prefix, and the common prefix is a prefix having the most matching items with the target address;
[0119] A first storage module 114, configured to store each of the common prefixes in a TCAM;
[0120] A second storage module 115, configured to store each of the first change information into an SRAM, wherein each of the first change information corresponding to a different common prefix constitutes a first SRAM table entry;
[0121] The index relationship establishing module 116 is used to establish an index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry.
[0122] It should be noted that the basic principle and technical effects of the multicast table processing device provided in this embodiment are the same as those of the multicast table processing method embodiment described above. For the sake of brief description, for parts not mentioned in this embodiment, reference may be made to the corresponding contents in the method embodiment described above.
[0123] The present application also provides an electronic device 100, which includes a processor 130 and a memory 120. The memory 120 stores computer executable instructions, and when the computer executable instructions are executed by the processor 130, the multicast table processing method is implemented.
[0124] The embodiment of the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by the processor 130, the multicast table processing method is implemented.
[0125] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0126] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable 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 application. 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, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
[0127] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0128] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing a multicast table, characterized in that: The method comprises: Determine the destination address and source address corresponding to the multiple IP multicast forwarding entries to be stored; Combining the destination address and the source address of each of the IP multicast forwarding entries as the target address of the IP multicast forwarding entry; Determine at least one common prefix contained in each of the target addresses and first change information of each of the target addresses, wherein the first change information is information in the target address other than the common prefix, and the common prefix is the prefix with the most matching items with the target address; Storing each of the common prefixes in a TCAM; storing each of the first change information in an SRAM, wherein each of the first change information corresponding to a different common prefix constitutes a first SRAM table entry; An index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry is established.
2. The method according to claim 1, characterized in that The step of determining at least one common prefix included in each of the target addresses and first change information of each of the target addresses comprises: Determine at least one first-level common prefix included in each of the target addresses, wherein the number of matching items between the first-level common prefix and the target address is less than the number of matching items between the common prefix and the target address; Determine each first address information of each target address except the first-level common prefix; At least one secondary common prefix included in each piece of the first address information and second change information of each piece of the first address information are determined, wherein the second change information is information in the first address information other than the secondary common prefix.
3. The method according to claim 2, characterized in that The step of storing each of the common prefixes in the TCAM comprises: The first-level common prefix is stored in a TCAM.
4. The method according to claim 2, characterized in that: The step of storing each of the first change information in the SRAM comprises: storing each of the secondary common prefixes in a first SRAM, wherein each of the secondary common prefixes corresponding to different first-level common prefixes constitutes a second SRAM table entry; Each of the second change information is stored in a second SRAM, wherein each of the second change information corresponding to a different secondary common prefix constitutes a third SRAM table entry.
5. The method according to claim 4, characterized in that The step of establishing an index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry comprises: An index relationship between each of the first-level common prefixes in the TCAM and the corresponding second SRAM table entry and the corresponding third SRAM table entry is established.
6. The method according to claim 1, characterized in that The step of determining at least one common prefix included in each of the target addresses and first change information of each of the target addresses comprises: Construct at least one dictionary tree based on each of the target addresses; The root nodes corresponding to different dictionary trees are used as the common prefixes; For each dictionary tree, a child node in the dictionary tree is determined as the first change information of the dictionary tree.
7. A multicast table processing method, characterized in that: The method comprises: Determine the IP multicast message information to be forwarded; The destination address and source address corresponding to the IP multicast message information to be forwarded are used as target indexes; Searching for a target prefix having the most matches with the target index from a TCAM, wherein the TCAM stores a plurality of common prefixes; Determine a target SRAM table entry corresponding to the target prefix from the SRAM, wherein the SRAM stores first SRAM table entries having an index relationship with each common prefix in the TCAM, and the target SRAM table entry is composed of a plurality of first change information corresponding to the target prefix; In the case where the target SRAM table entry is valid, determining first data of the target index excluding the target prefix, wherein the target SRAM table entry is valid indicating that the target prefix does not completely include all information of the target index; Using the first data as an index of the target SRAM table entry, determining first change information with the most matching items from the target SRAM table entry; The IP multicast message information to be forwarded is forwarded based on the next hop of the first change information with the most matching items.
8. The method according to claim 7, characterized in that The method further comprises: In the case where the target SRAM table entry is invalid, determining the next hop of the target prefix, wherein the target SRAM is invalid indicating that the target prefix contains all information of the target index; The IP multicast message information to be forwarded is forwarded based on the next hop of the target prefix.
9. A multicast table processing device, characterized in that: The device comprises: A first determination module, used to determine the destination address and source address corresponding to the multiple IP multicast forwarding entries to be stored; A merging module, used for merging the destination address and the source address of each of the IP multicast forwarding entries to be stored as the target address of the IP multicast forwarding entry to be stored; A second determination module is used to determine at least one common prefix contained in each of the target addresses and first change information of each of the target addresses, wherein the first change information is information in the target address other than the common prefix, and the common prefix is the prefix with the most matching items with the target address; A first storage module, used for storing each of the common prefixes in a TCAM; A second storage module, used for storing each of the first change information into SRAM, wherein each of the first change information corresponding to a different common prefix constitutes a first SRAM table entry; The index relationship establishing module is used to establish an index relationship between each of the common prefixes in the TCAM and the corresponding first SRAM table entry.
10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 8 when executing the computer program.
