A MAC address learning and forwarding device and method

By introducing access information cache FIFO and Pop frequency control modules in Ethernet MAC switching design, MAC address search and write operations are optimized, and the time-sharing multiplexing problem of MAC address table in high-speed processing is solved, and efficient MAC address is achieved Learn to forward, suitable for various switching devices.

CN116155807BActive Publication Date: 2024-11-19WUHAN BINARY SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211718037.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2024-11-19
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

In the existing Ethernet MAC switching design, the time-sharing multiplexing problem of the MAC address table makes it difficult to read and write data frame access information in a high-speed processing environment, and cannot meet the needs of high-speed switching devices.

Method used

A MAC address learning forwarding device is designed, including access information cache FIFO, Pop frequency control module, MAC table search module, MAC table write control module, MAC table Cache storage unit and MAC table SRAM storage unit, through cache and cache migration mechanism , optimize MAC address search and write operations to achieve efficient time-sharing multiplexing.

Benefits of technology

While ensuring the efficiency of learning and forwarding search, it maximizes the efficiency of address learning. It is suitable for various switching devices from low speed to high speed, solving the problem of time-sharing multiplexing of MAC address tables in high speed processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116155807B_ABST
    Figure CN116155807B_ABST
Patent Text Reader

Abstract

The present invention discloses a MAC address learning and forwarding device and method, and relates to the field of Ethernet switching technology. The method comprises: pressing access information into an access information cache FIFO for caching; a Pop frequency control module controls the pop-up operation of the access information, and at the same time controls the move enable of the MAC table Cache storage unit; the pop-up access information enters the MAC table search module, first performs a destination MAC address search, and forwards it according to the search result; then performs a source MAC address search, and outputs the search result; the MAC table write control module writes the entry to be learned into the MAC table Cache storage unit according to the search result; the MAC table Cache storage unit moves it to the SRAM access control module according to the move enable. The present invention is not only applicable to various switching devices from low speed to high speed, but also can maximize the efficiency of address learning while ensuring the efficiency of learning search and forwarding search.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of Ethernet switching, in particular to a MAC (Media Access Control) address learning and forwarding device and method. Background Art

[0002] At present, communication needs are increasingly developing towards high speed and large capacity. This trend requires that the circuit processing speed continues to increase, and people continue to adopt integrated circuits with new processes to meet this technological trend. At the same time, in order to save chip area and improve functional applicability, it is recommended to use single-port SRAM (Static Random Access Memory) and shared memory (Shared Memory). The increase in circuit main frequency, the demand for shared memory, and the access timing requirements of RAM (Random Access Memory) have posed new challenges to circuit design. For example, the cycle required for memory data to be read, processed, and then rewritten to the memory becomes longer, resulting in an increasingly complex arrangement of time slots for multiple accesses to a certain memory.

[0003] In Ethernet MAC switching, the source MAC address lookup of the data frame is used for functions such as source address filtering and learning new entries; the destination MAC address lookup is used for functions such as destination address forwarding. These two lookups of the MAC address table must ensure line speed (non-blocking processing) and also meet the learning and update operations. Therefore, the access to the MAC address table is the bottleneck of the entire design, and its time-division multiplexing problem needs to be solved.

[0004] In normal learning and forwarding operations, the access information of a data frame requires three operations on the MAC address table: two read (lookup) operations and one write (learning and updating) operation. The two read (lookup) operations are: one source MAC address lookup, which is used for functions such as source address filtering and learning new entries; one destination MAC address lookup, which is used for functions such as destination address forwarding. One write (learning and updating) operation is to learn new entries after the source MAC address lookup. The newly learned entries also need to be written into the MAC address table. In actual applications, most MAC addresses have been successfully learned into the MAC address table, and there is no need for line-speed learning and updating operations. However, the read and write operations need to be time-division multiplexed on the MAC address table, and the time slots of the two read operations must be guaranteed, while taking into account the learning and writing operations.

[0005] In the existing low-speed design, the MAC address table time slot division is relatively simple. Using the fixed time slot division principle, two read operations and one write operation evenly divide the access time slot of the MAC address table, in which the learning read operation and the learning write operation of different data frame access information do not intersect. However, this method is not suitable for high-speed processing. Summary of the invention

[0006] The purpose of the present invention is to overcome the shortcomings of the above-mentioned background technology and to provide a MAC address learning and forwarding device and method, which can realize high-efficiency processing based on MAC address learning and forwarding, and is not only applicable to various switching devices from low speed to high speed, but also can maximize the efficiency of address learning while ensuring the efficiency of learning search and forwarding search.

[0007] To achieve the above objectives, in a first aspect, an embodiment of the present invention provides a MAC address learning and forwarding device, including an access information cache FIFO, a Pop frequency control module, a MAC table lookup module, a MAC table write control module, a MAC table Cache storage unit and a MAC table SRAM storage unit.

[0008] Among them, the access information cache FIFO is used to cache the access information of all pushed data frames. The Pop frequency control module is used to control the pop-up operation of the access information cache FIFO according to the valid number of entries in the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and control the move enable of the MAC table Cache storage unit. The MAC table lookup module is used to first perform a destination MAC address lookup in the MAC table Cache storage unit and the MAC table SRAM storage unit according to the access information popped out of the access information cache FIFO, and forward it according to the lookup result; then perform a source MAC address lookup and output the lookup result to the MAC table write control module. The MAC table write control module is used to write the entries that need to be learned into the MAC table Cache storage unit according to the input lookup result. The MAC table Cache storage unit is used to store the learning update entry content; and according to the move enable of the Pop frequency control module, the stored learning update entry content is moved to the SRAM access control module. The MAC table SRAM storage unit is used to store the MAC address learning entry.

[0009] As an optional implementation scheme, the Pop frequency control module controls the pop operation of the access information cache FIFO and controls the migration enable of the MAC table Cache storage unit, specifically including:

[0010] Set the Pop frequency of access information cache FIFO to f pop , and f pop ≤f sys / 2, where f sysis the system frequency; set the low-speed threshold M1 and high-speed threshold M2 for the access information FIFO, and M1 < M2 < M, where M is the depth of the access information cache FIFO; set the low-speed threshold N1 and high-speed threshold N2 for the MAC table Cache storage unit, and N1 < N2 ≤ N, where N is the depth of the MAC table Cache storage unit, and M ≥ 2N;

[0011] If the effective number m of the current access information cache FIFO is 0, stop the pop operation and generate a transfer enable for transferring n entries, where n is the effective number of entries in the current MAC table Cache storage unit;

[0012] If the current m < M1, when n ≥ N1, stop the pop operation and generate a transfer enable for transferring N1 entries; when n < N1, first pop N1 - n access information from the access information cache FIFO according to the f pop frequency, and then stop the pop operation and generate a transfer enable for transferring N1 entries;

[0013] Otherwise, if the current m < M2, when n ≥ N2, stop the pop operation and generate a transfer enable for transferring N2 entries; when n < N2, first pop N2 - n access information from the access information cache FIFO according to the f pop frequency, and then stop the pop operation and generate a transfer enable for transferring N2 entries;

[0014] Otherwise, if m ≥ M2, no transfer enable is generated, and N access information is popped from the access information cache FIFO according to the f pop frequency.

[0015] As an optional implementation, the duration of the stop pop operation is: the duration required for transfer plus the duration from when the access information enters the MAC table lookup control module to when it is written into the MAC table Cache storage unit by the MAC table write control module.

[0016] As an optional implementation, when the MAC table lookup module performs destination MAC address lookup and source MAC address lookup, it preferentially performs the lookup in the MAC table Cache storage unit.

[0017] As an optional implementation, when the MAC table lookup module performs source MAC address lookup and outputs the lookup result to the MAC table write control module, it specifically includes:

[0018] If the source MAC address is found in the MAC table Cache storage unit, the entry content in the MAC table Cache storage unit is output to the MAC table write control module, and the preset hit indication flag Hit is set to 1; if the source MAC address is found in the MAC table SRAM storage unit, the entry content in the MAC table SRAM storage unit is output to the MAC table write control module, and the hit indication flag Hit is set to 1; if not found, the hit indication flag Hit is set to 0.

[0019] As an optional implementation scheme, the MAC table write control module writes the entry to be learned into the MAC table Cache storage unit according to the input search result, specifically including:

[0020] When the Hit is 0, under the condition that there is a vacancy in the MAC table SRAM storage unit and the MAC table Cache storage unit is not full, the source MAC address of the access information is written as a new entry into the MAC table Cache storage unit; otherwise, the learning and updating operation of the new entry is abandoned; when the Hit is 1, when the port learning information is consistent, if the aging status does not need to be updated, the learning and updating operation is abandoned; if the aging status needs to be updated or the port learning information changes, the updated entry is written into the MAC table Cache storage unit.

[0021] As an optional implementation scheme, the structure of the MAC table Cache storage unit is a first-in-first-out queue, which is pushed in from the bottom and popped out from the top.

[0022] As an optional implementation, when multiple entries in the MAC table Cache storage unit are hit simultaneously, data of the hit entries close to the bottom are output preferentially.

[0023] As an optional implementation scheme, the device also includes an SRAM access control module; when the MAC table lookup control module searches in the MAC table SRAM storage unit, it outputs a read operation instruction to the SRAM access control module; when the MAC table Cache storage unit moves, it outputs a move operation instruction to the SRAM access control module; the SRAM access control module is used to: arbitrate the input read operation instructions and move operation instructions, and perform corresponding read and write operations on the MAC table SRAM storage unit according to read and write needs.

[0024] In a second aspect, an embodiment of the present invention further provides a MAC address learning and forwarding method based on the device in the embodiment of the first aspect, the method comprising:

[0025] The access information of all data frames is pushed into the access information buffer FIFO for buffering;

[0026] The Pop frequency control module controls the pop operation of the access information cache FIFO according to the valid number of entries in the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and controls the move enable of the MAC table Cache storage unit;

[0027] The access information popped out from the access information cache FIFO enters the MAC table lookup module. The MAC table lookup module first performs a destination MAC address lookup in the MAC table cache storage unit and the MAC table SRAM storage unit according to the access information, and forwards it according to the lookup result; then performs a source MAC address lookup and outputs the lookup result to the MAC table write control module;

[0028] The MAC table write control module writes the entries that need to be learned into the MAC table cache storage unit according to the input search results;

[0029] The MAC table Cache storage unit moves the stored learning update entry content to the SRAM access control module according to the move enable of the Pop frequency control module.

[0030] The beneficial effects of the present invention are:

[0031] In the present invention, a MAC table Cache storage unit is provided in addition to the traditional MAC table SRAM storage unit. The MAC address entry of the data frame is learned and updated by first writing it into the MAC table Cache storage unit, and then moving it from the MAC table Cache storage unit to the MAC table SRAM storage unit in an idle time slot, thereby achieving the purpose of combining the update status of the MAC table Cache storage unit and reducing the time slot occupancy.

[0032] At the same time, a Pop frequency control module is also provided, which can control the pop-up (Pop) operation of the access information cache FIFO (First In First Out) according to the valid number of the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit. By controlling the Pop of the access information, the efficiency of the learning search and forwarding search can be effectively guaranteed. At the same time, the Pop frequency control module can also control the move enable of the MAC table Cache storage unit, so that the learning forwarding search and learning update can be time-division multiplexed, and while ensuring the efficiency of the learning search and forwarding search, the efficiency of the address learning can be maximized, and the application requirements of various switching equipment from low speed to high speed can be met. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a structural block diagram of a MAC address learning and forwarding device in an embodiment of the present invention;

[0034] Figure 2 is a processing flow chart of a Pop frequency control module in an embodiment of the present invention;

[0035] Figure 3 A schematic diagram of a flow chart of a MAC table lookup module performing source MAC address lookup according to an embodiment of the present invention;

[0036] Figure 4 1 is a processing flow chart of a MAC table write control module in an embodiment of the present invention;

[0037] Figure 5 A schematic diagram of the structure of a MAC table Cache storage unit in an embodiment of the present invention;

[0038] Figure 6 The figure is a flow chart of the MAC address learning and forwarding method in an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In view of the problem that in the prior art, the traditional MAC address learning and forwarding scheme has a relatively simple division of MAC address table time slots and adopts a fixed time slot division principle, and the learning read operation and the learning write operation of different data frame access information do not cross, so it can only be applied to low-speed design and cannot be applied to high-speed processing. The present invention aims to provide a MAC address learning and forwarding device and method, which can realize high-efficiency processing based on MAC address learning and forwarding, and can not only be applied to various switching devices from low speed to high speed, but also can maximize the efficiency of address learning while ensuring the efficiency of learning search and forwarding search, and meet the actual application needs.

[0040] In order to achieve the above purpose, the main design idea of ​​the present invention is: the MAC address learning and forwarding device includes an access information cache FIFO, a Pop frequency control module, a MAC table lookup module, a MAC table write control module, a MAC table Cache storage unit and a MAC table SRAM storage unit.

[0041] The access information cache FIFO is used to cache the access information of all pushed data frames.

[0042] The Pop frequency control module is used to control the pop operation of the access information cache FIFO according to the valid number of the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and control the migration enable of the MAC table Cache storage unit.

[0043] The MAC table lookup module is used to: first perform a destination MAC address lookup in the MAC table Cache storage unit and the MAC table SRAM storage unit according to the access information popped out by the access information cache FIFO, and forward according to the lookup result; then perform a source MAC address lookup and output the lookup result to the MAC table write control module.

[0044] The MAC table write control module is used to write the entries that need to be learned into the MAC table Cache storage unit according to the input search result.

[0045] The MAC table Cache storage unit is used to: store the learning update entry content; and according to the migration enable of the Pop frequency control module, move the stored learning update entry content to the SRAM access control module.

[0046] The MAC table SRAM storage unit is used to store MAC address learning entries.

[0047] In this solution, the MAC table Cache storage unit is used to merge the update status to reduce the time slot occupancy; and the Pop frequency control module is used to control the Pop operation of the access information cache FIFO. Through the Pop control of the access information, the efficiency of learning search and forwarding search can be effectively guaranteed; at the same time, the Pop frequency control module can also control the migration enable of the MAC table Cache storage unit, so that learning forwarding search and learning update can be time-division multiplexed, and while ensuring the efficiency of learning search and forwarding search, the efficiency of address learning can be maximized, thereby meeting the application requirements of various switching equipment from low speed to high speed.

[0048] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] However, it should be noted that the examples to be introduced below are only some specific examples, and are not intended to limit the embodiments of the present invention to the following specific steps, values, conditions, data, sequences, etc. Those skilled in the art can apply the concept of the present invention to construct more embodiments not mentioned in this specification by reading this specification.

[0050] Embodiment 1

[0051] See also Figure 1 As shown, this embodiment provides a MAC address learning and forwarding device, including an access information cache FIFO, a Pop frequency control module, a MAC table lookup module, a MAC table write control module, a MAC table Cache storage unit and a MAC table SRAM storage unit.

[0052] Among them, the access information cache FIFO is used to: cache the access information of all the pushed data frames. It can be understood that the access information includes information such as the source MAC address and the destination MAC address.

[0053] The Pop frequency control module is used to: control the Pop operation of the access information cache FIFO according to the valid number in the access information cache FIFO and the valid entries in the MAC table Cache storage unit, and at the same time control the migration enable of the MAC table Cache storage unit.

[0054] It can be understood that in this embodiment, the Pop frequency control module can be used to control the Pop operation of the access information cache FIFO. Through the Pop control of the access information, the high efficiency of learning search and forwarding search can be effectively guaranteed; at the same time, through the Pop frequency control module, the migration enable of the MAC table Cache storage unit can also be controlled, so that the learning forwarding search and learning update can achieve time-sharing multiplexing, and while ensuring the efficiency of learning search and forwarding search, the efficiency of address learning can be maximally satisfied, thus meeting the actual application requirements.

[0055] Such as Figure 2 shown, exemplarily, as an optional implementation manner, the Pop frequency control module controls the Pop operation of the access information cache FIFO according to the valid number in the access information cache FIFO and the valid entries in the MAC table Cache storage unit, and at the same time controls the migration enable of the MAC table Cache storage unit. The specific process may include:

[0056] Step S1: Set the Pop frequency of the access information cache FIFO to f pop , and f pop ≤f sys / 2, where f sys is the system frequency; set the low-speed threshold M1 and high-speed threshold M2 of the access information FIFO, and M1 < M2 < M, where M is the depth of the access information cache FIFO; set the low-speed threshold N1 and high-speed threshold N2 of the MAC table Cache storage unit, and N1 < N2 ≤ N, where N is the depth of the MAC table Cache storage unit, and M ≥ 2N.

[0057] Step S2: If the valid number m of the current access information cache FIFO is 0, stop the Pop operation of the access information cache FIFO, and generate a migration enable to move n entries from the MAC table Cache storage unit, where n is the current number of valid entries in the MAC table Cache storage unit.

[0058] It can be understood that during the relocation process of the MAC table Cache storage unit, a protection mechanism needs to be added, that is, during the relocation process, writing to the MAC table Cache storage unit is prohibited. Because during the relocation process, the MAC table write control module cannot traverse the latest data of the MAC table Cache storage unit, which will lead to inconsistent processed data. Therefore, in this embodiment, the protection mechanism is implemented by stopping the Pop operation of the access information cache FIFO, that is, when the relocation of the MAC table Cache storage unit occurs, the Pop operation of the access information cache FIFO needs to be stopped simultaneously. In practical applications, the duration of stopping the Pop operation is: the duration required for relocation plus the duration from when the access information enters the MAC table lookup control module to when it is written to the MAC table Cache storage unit by the MAC table write control module (i.e., waiting for the processing flow of the last access information before stopping the Pop to end). Since the Pop operation of the access information cache FIFO needs to be stopped during relocation, the more entries are relocated each time, the higher the relocation efficiency.

[0059] Specifically, as Figure 2 shown, step S2 may include:

[0060] S21. Determine whether the effective number m of the current access information cache FIFO is 0. If so, go to step S22; otherwise, go to step S3;

[0061] S22. Determine whether the effective number of entries n of the current MAC table Cache storage unit is not 0. If so, go to step S23; otherwise, return to step S2;

[0062] S23. Stop the Pop operation of the access information cache FIFO and generate a relocation enable signal to relocate n entries from the MAC table Cache storage unit.

[0063] It can be understood that through the above step S2, when the access information cache FIFO is empty, the control of relocating all entries in the MAC table Cache storage unit to the MAC table SRAM storage unit can be achieved.

[0064] Step S3. If the effective number m of the current access information cache FIFO is less than M1, then process according to the effective number of entries n of the current MAC table Cache storage unit and its low-speed threshold N1: If n ≥ N1, stop the Pop operation of the access information cache FIFO and generate a relocation enable signal to relocate N1 entries from the MAC table Cache storage unit; otherwise, first Pop out N1 - n access information from the access information cache FIFO at frequency f pop and then process as above. Specifically, as Figure 2 shown, step S3 may include:

[0065] S31. Determine whether the effective number m of the current access information cache FIFO is less than the low-speed threshold M1. If so, go to step S32; otherwise, go to step S4;

[0066] S32. Determine whether the effective number n of entries in the current MAC table Cache storage unit is less than the low-speed threshold N1. If so, go to step S33; otherwise, go to step S34;

[0067] S33. Pop N1 - n access information from the access information cache FIFO according to the f pop frequency and go to step S34;

[0068] S34. Stop the Pop operation of the access information cache FIFO and generate a transfer enable to transfer N1 entries from the MAC table Cache storage unit.

[0069] It can be understood that through the above step S3, low-speed learning of the MAC address table can be achieved, ensuring the learning success rate at low speed.

[0070] Step S4. If the effective number m of the current access information cache FIFO is less than M2, then process according to the effective number n of entries in the current MAC table Cache storage unit and its high-speed threshold N2: If n ≥ N2, stop the Pop operation of the access information cache FIFO and generate a transfer enable to transfer N2 entries from the MAC table Cache storage unit; otherwise, first Pop N2 - n access information from the access information cache FIFO according to the f pop frequency, and then process as above. Specifically, as Figure 2 shown, step S4 may include:

[0071] S41. Determine whether the effective number m of the current access information cache FIFO is less than the high-speed threshold M2. If so, go to step S42; otherwise, go to step S5;

[0072] S42. Determine whether the effective number n of entries in the current MAC table Cache storage unit is less than the high-speed threshold N2. If so, go to step S43; otherwise, go to step S44;

[0073] S43. Pop N2 - n access information from the access information cache FIFO according to the f pop frequency and go to step S44;

[0074] S44. Stop the Pop operation of the access information cache FIFO and generate a transfer enable to transfer N2 entries from the MAC table Cache storage unit.

[0075] It can be understood that through the above step S4, high-speed learning of the MAC address table can be achieved, and the transfer efficiency of the MAC table Cache storage unit can be improved.

[0076] Step S5: If the effective number of the current access information cache FIFO is m≥M2, no move enable is generated (i.e., the move operation of the MAC table Cache storage unit is abandoned), and the access information cache FIFO is accessed according to f pop The N access information is popped out at a frequency. It can be understood that the line-speed forwarding function of the system can be realized through step S5.

[0077] It can be seen from the above steps S1 to S5 that this embodiment has made a special design for the control processing flow of the Pop frequency control module. When the access information cache FIFO is empty, all the entries of the MAC table Cache storage unit can be moved to the MAC table SRAM storage unit; when the effective number of the access information cache FIFO meets the low-speed requirement, the entry is moved according to the number of the low-speed threshold, which can effectively ensure the learning success rate at low speed when the low-speed learning of the MAC address table is realized; when the effective number of the access information cache FIFO meets the high-speed requirement, the entry is moved according to the number of the high-speed threshold, which can improve the moving efficiency of the MAC table Cache storage unit when the high-speed learning of the MAC address table is realized; and when the effective number of the access information cache FIFO exceeds the high-speed requirement, the moving operation of the MAC table Cache storage unit is abandoned, which can realize the line-speed forwarding function of the system. The overall design can flexibly update the learning entries under the condition of ensuring line-speed learning search and forwarding to meet the needs of large-capacity switching equipment. Among them, line speed means non-blocking processing, and there must be no situation where data frames are not searched or the search behavior affects data flow; however, updating learning entries (learning write) can be abandoned depending on different situations, so updating learning entries (learning write) is not line speed and can be performed flexibly.

[0078] The MAC table lookup module is used to: first perform a destination MAC address lookup in the MAC table Cache storage unit and the MAC table SRAM storage unit according to the access information popped out by the access information cache FIFO, and forward it according to the lookup result; then perform a source MAC address lookup and output the lookup result to the MAC table write control module. The two lookups are time-division multiplexed in the MAC table SRAM storage unit. To ensure the line speed, f pop ≤f sys / 2.

[0079] It is understandable that, in the design of this embodiment, the MAC address entry of the data frame is first written into the MAC table Cache storage unit, and then moved from the MAC table Cache storage unit to the MAC table SRAM storage unit in the idle time slot. Therefore, the MAC address entry cached in the MAC table Cache storage unit must be newer than the entry cached in the MAC table SRAM storage unit. In this regard, in order to improve the efficiency of the search, when performing two searches at line speed, the search can be performed in the MAC table Cache storage unit first, that is, the priority of the MAC table Cache storage unit is higher than that of the MAC table SRAM storage unit, so that it can be ensured that the search starts from the latest entry and the hit is faster.

[0080] For example, the MAC table lookup module may first compose a Key (e.g. {VLAN (Virtual Local Area Network), destination MAC address}) with information such as the destination MAC address based on the access information popped out by the access information cache FIFO, and first search in the MAC table Cache storage unit, and if not found, continue to search in the MAC table SRAM storage unit; then, compose a Key (e.g. {VLAN, source MAC address}) with information such as the source MAC address, and first search in the MAC table Cache storage unit, and if not found, continue to search in the MAC table SRAM storage unit.

[0081] It can be further understood that the MAC table lookup module will first perform a destination MAC address lookup and forward according to the lookup result; then perform a source MAC address lookup and output the lookup result to the MAC table write control module. When performing the source MAC address lookup, the corresponding result will be output to the MAC table write control module according to different lookup results. For example, as an optional implementation, see Figure 3 As shown, the MAC table lookup module performs source MAC address lookup and outputs the lookup result to the MAC table write control module, which may specifically include:

[0082] If the MAC table search module finds the source MAC address in the MAC table Cache storage unit, it outputs the entry content in the MAC table Cache storage unit to the MAC table write control module and sets the preset hit indication flag Hit to 1;

[0083] Otherwise, if the MAC table lookup module finds the source MAC address in the MAC table SRAM storage unit, it outputs the entry content in the MAC table SRAM storage unit to the MAC table write control module and sets the hit indication flag Hit to 1;

[0084] If not found, there is no hit entry, and the hit indicator Hit is set to 0.

[0085] The MAC table write control module is used to write the entries that need to be learned into the MAC table Cache storage unit according to the input search result.

[0086] It is understandable that in actual operation, most entries have been successfully learned and exist in the MAC table SRAM storage unit or the MAC table Cache storage unit, and only the aging status needs to be updated. When the aging status does not need to be updated, the learning and updating operation can be abandoned, thereby further reducing the time slot occupied by the learning and updating.

[0087] For example, as an optional implementation, see Figure 4 As shown, the MAC table write control module writes the entries that need to be learned into the MAC table Cache storage unit according to the input search result, which may specifically include:

[0088] When the hit indication flag Hit is 0, it indicates that the source MAC address of the access information is a new entry. The MAC table write control module writes the new entry into the MAC table Cache storage unit under the condition that there is an empty space in the MAC table SRAM storage unit and the MAC table Cache storage unit is not full; if there is no empty space in the MAC table SRAM storage unit or the MAC table Cache storage unit is full, the learning and updating operation of the new entry is abandoned;

[0089] When the hit indication flag Hit is 1, it indicates that the source MAC address of the access information is an existing entry. When the port learning information is consistent, it is determined whether the aging status needs to be updated. If the aging status does not need to be updated, it indicates that the entry content has not changed and the learning update operation is abandoned. If the aging status needs to be updated or the port learning information has changed, the updated entry is written into the MAC table Cache storage unit.

[0090] The MAC table Cache storage unit is used to: store the learning update entry content; and according to the migration enable of the Pop frequency control module, move the stored learning update entry content to the SRAM access control module.

[0091] For example, as an optional implementation, see Figure 5 As shown, the structure of the MAC table Cache storage unit is a first-in-first-out queue, which is pushed in from the bottom and popped out from the top; its entry content includes a Valid field, a Tag field, and a Data field.

[0092] On this basis, exemplarily, when the MAC table lookup module searches in the MAC table Cache storage unit, it will traverse all entries in the MAC table Cache storage unit and compare the Valid field and the Tag field. If the Valid field is valid and the Tag field matches, it means that the entry is hit; if multiple entries are hit at the same time, the Data data close to the bottom hit entry can be output first, that is, the bottom has the highest priority and the top has the lowest priority. The reason is that the MAC table Cache storage unit is pushed from the bottom, so the entry at the bottom must be the latest data. In order to use the latest data and maintain data consistency, the new entry has the highest priority, so if multiple entries are hit at the same time, the Data data close to the bottom hit entry is output first.

[0093] In another exemplary embodiment, when the MAC table write control module writes the entry that needs to be learned into the MAC table Cache storage unit, if the entry is a new entry, a bottom push operation is used; if the entry already exists, a modification operation is performed on the hit position of the MAC table Cache storage unit. When the MAC table Cache storage unit moves the stored learning update entry content to the SRAM access control module, a top pop-up operation is used. In other words, the update operation of the MAC table Cache storage unit includes bottom push (Push), top pop-up (Pop) and modification (Modify) of any hit position.

[0094] The MAC table SRAM storage unit is used to store MAC address learning entries.

[0095] It can be seen from the above description that in this embodiment, in addition to the traditional MAC table SRAM storage unit, a MAC table Cache storage unit is also provided. The MAC address entry learning and updating of the data frame is first written into the MAC table Cache storage unit, and then moved from the MAC table Cache storage unit to the MAC table SRAM storage unit in the idle time slot, so as to achieve the purpose of merging and updating the state by using the MAC table Cache storage unit to reduce the time slot occupancy. At the same time, a Pop frequency control module is also provided, which can control the Pop operation of the access information cache FIFO according to the valid number of access information cache FIFO and the valid number of entries of the MAC table Cache storage unit. Through the Pop control of the access information, the efficiency of learning search and forwarding search can be effectively guaranteed; at the same time, the Pop frequency control module can also control the move enable of the MAC table Cache storage unit, so that learning forwarding search and learning update can be realized in time-sharing multiplexing, and can maximize the efficiency of address learning while ensuring the efficiency of learning search and forwarding search, and meet the actual application requirements.

[0096] Further, see Figure 1 As shown, as an optional implementation, the device also includes an SRAM access control module. Figure 1 As shown, when the MAC table lookup control module searches in the MAC table SRAM storage unit, it outputs a read operation instruction to the SRAM access control module; when the MAC table Cache storage unit moves, it outputs a move operation instruction to the SRAM access control module.

[0097] The SRAM access control module is used to arbitrate the input read operation instructions and move operation instructions, and perform corresponding read and write operations on the MAC table SRAM storage unit according to the read and write needs. It can be understood that when the MAC table Cache storage unit moves entries to the SRAM storage unit, it actually writes the corresponding entries to the SRAM storage unit, that is, the move operation instruction is actually equivalent to the write operation instruction. Therefore, when the SRAM access control module arbitrates the input move operation instruction, it will determine that it is necessary to perform a corresponding write operation on the MAC table SRAM storage unit. In addition, in this embodiment, the purpose of adding the SRAM access control module in front of the MAC table SRAM storage unit is to further control the reading and writing of the MAC table SRAM storage unit as an auxiliary means, avoid simultaneous reading and writing operations, and ensure the linear speed of the reading and writing operations (because the above-mentioned scheme of this embodiment can completely avoid simultaneous reading and writing and achieve the linear speed of reading and writing operations, so the setting of the SRAM access control module is only optional as an auxiliary means).

[0098] Furthermore, in order to better demonstrate that the device of this embodiment can meet the needs of various scenarios from low speed to high speed, the specific implementation process of various application scenarios will be described in detail below by way of examples.

[0099] In this example, a single-port SRAM is used as the MAC table SRAM storage unit. According to the business needs and timing requirements, the system frequency is determined to be f sys , the depth of the MAC table cache storage unit is N. The time from the access information entering the MAC table search control module to the MAC table write control module writing the MAC table cache storage unit can be set to x clock cycles, where x <N。

[0100] Based on single-port SRAM, in order to ensure the line speed of learning search and forwarding search, the Pop frequency f of access information cache FIFO can be set pop =f sys / 2, that is, one access information is popped out every two clock cycles. To ensure that one access information completes two MAC table lookup operations (source MAC address lookup and destination MAC address lookup), at most N access information is popped out every 2N clock cycles. In the high-speed learning mode, the high-speed threshold M2 of the access information cache FIFO is equal to N+2x, and the high-speed threshold N2 of the MAC table cache storage unit is equal to N.

[0101] It takes three MAC table operations (two searches and one move) to complete the search and learning of one access information. If no more than (2N-x) / 3 access information is popped out in every 2N clock cycles, the search and learning of all access information can be completed by processing according to the pipeline. Among them, two searches require 2(2N-x) / 3 clock cycles, the move requires (2N-x) / 3 clock cycles, and the protection time x of the MAC table cache storage unit during the move process, a total of 2N clock cycles. In the low-speed learning mode, the low-speed threshold M1 of the access information cache FIFO is equal to 2N / 3, and the low-speed threshold N1 of the MAC table cache storage unit is equal to (2N-x) / 3.

[0102] Specifically, assuming that the system frequency f sys =900MHz, f pop =f sys / 2=450MHz, the depth of the MAC table Cache storage unit N=15, and the depth of the access information cache FIFO M=32>2N; assuming that the read delay of the MAC table SRAM storage unit is 2 (in actual applications, the minimum read delay of the MAC table SRAM storage unit is 1, which is related to the chip timing, and the read delay may increase. Generally, the read delay of the MAC table SRAM storage unit in large-scale designs is not less than 2, so in this example, the read delay is assumed to be 2), the time x from the access information entering the MAC table search control module to the MAC table write control module writing the MAC table Cache storage unit can be set to 3, that is, x=3 (because the read delay used is 2 clock cycles, plus 1 clock cycle is reserved for processing, so x can be set to 3). The low-speed threshold M1=2N / 3=10 of the access information cache FIFO, and the high-speed threshold M2=N+2x=21; the low-speed threshold N1=(2N-x) / 3=9 of the MAC table Cache storage unit, and the high-speed threshold N2=N=15. Take the extreme case of learning all new items as an example.

[0103] In the present invention, the time-sharing multiplexing of the MAC table SRAM storage unit is a design bottleneck, and the following scenario analysis is all for the access to the MAC table SRAM storage unit. In addition, it can be understood that in actual application, the Push (pushing in) and Pop (popping out) of the access information cache FIFO are parallel, and Pop (popping out) does not affect Push (pushing in), so in order to describe the completeness of the operation, the Push (pushing in) operation and Pop (popping out) operation of the access information cache FIFO are included in the following scenario analysis. In the above description of the specific embodiment, since it is mainly emphasized how to control the design of Pop (popping out) and how to control the design of moving, it does not care about how to Push (pushing in), therefore, in the above description of the specific embodiment and the corresponding flowchart, only the Pop (popping out) operation is described, and the Push (pushing in) is not reflected, which is specially explained here.

[0104] Scenario 1: Assume that the input data frame rate is 270 Mpps, that is, (30×270 Mpps) / 900 MHz=9 access information is pushed into the access information cache FIFO every 30 clock cycles.

[0105] Then, the specific implementation process in this scenario can be as follows:

[0106] (1) Initialization: the valid number of access information cache FIFO is 0, and the valid number of entries in the MAC table cache storage unit is 0.

[0107] (2) According to f sys Push 9 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. The current valid number of access information cache FIFO is still 0, and the number of valid entries in the MAC table Cache storage unit becomes 9. This process requires 18 clock cycles (i.e., Pop 9 access information, each access information needs to search the MAC table SRAM storage unit twice, so it takes 18 clock cycles to complete 18 searches of 9 access information, and at the same time, 9 new learning entries are written into the MAC table Cache storage unit). Stop Pop, wait for 3 clock cycles of protection time, and then move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of access information cache FIFO is 0, and the valid number of entries in the MAC table Cache storage unit is also 0. This process requires a total of 12 clock cycles (i.e., the protection time of 3 clock cycles plus the move of 9 valid entries requires 9 clock cycles, a total of 12 clock cycles). The whole process requires 30 clock cycles (i.e., 18 clock cycles + 12 clock cycles = 30 clock cycles).

[0108] (3) Repeat step (2), that is, the line speed learning rate is not higher than 270 Mpps, and the low-speed learning mode is maintained.

[0109] (4) If the number of valid entries in the MAC table cache storage unit is not 0 after the access information cache FIFO stops pushing access information, then stop Pop, wait for the protection time of 3 clock cycles, and then move all valid entries in the MAC table cache storage unit. That is, when the access information cache FIFO is empty, all entries in the MAC table cache storage unit are moved to the MAC table SRAM storage unit.

[0110] It can be seen from the example of scenario 1 that when the input data frame rate is low, the low-speed learning mode can be maintained according to the design of this solution, which can be effectively applied to application scenarios that ensure low speed and meet application requirements.

[0111] Scenario 2: The input data frame rate is 360Mpps, that is, (30×360Mpps) / 900MHz=12 access information are pushed into the access information cache FIFO every 30 clock cycles. Then, the specific implementation process in this scenario can be as follows:

[0112] (1) Initialization: the valid number of access information cache FIFO is 0, and the valid number of entries in the MAC table cache storage unit is 0;

[0113] (2) According to f sys Push 12 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of the access information cache FIFO is 3, and the valid number of entries in the MAC table Cache storage unit is 9. This process requires 18 clock cycles (i.e., Pop 9 access information, each access information needs to search the MAC table SRAM storage unit twice, so it takes 18 clock cycles to complete 18 searches of 9 access information, and at the same time, 9 new learning entries are written into the MAC table Cache storage unit). Stop Pop, wait for 3 clock cycles of protection time, and then move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of the access information cache FIFO is 3, and the valid number of entries in the MAC table Cache storage unit is 0. This process requires a total of 12 clock cycles (i.e., the protection time of 3 clock cycles plus the move of 9 valid entries requires 9 clock cycles, a total of 12 clock cycles). The whole process requires 30 clock cycles (i.e., 18 clock cycles + 12 clock cycles = 30 clock cycles).

[0114] (3) Repeat step (2), keep the low-speed learning mode, and follow f sysPush 12 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 6, and the valid number of entries in the MAC table Cache storage unit is 9. Stop Pop, wait for 3 clock cycles of protection time, and then move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of access information cache FIFO is 6, and the valid number of entries in the MAC table Cache storage unit is 0.

[0115] (4) Repeat step (2), keep the low-speed learning mode, and follow f sys Push 12 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of the access information cache FIFO is 9, and the valid number of entries in the MAC table Cache storage unit is 9. Stop Pop, wait for 3 clock cycles of protection time, and then move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of the access information cache FIFO is 9, and the valid number of entries in the MAC table Cache storage unit is 0.

[0116] (5) Repeat step (2), keep the low-speed learning mode, and follow f sys Push 12 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 12, and the valid number of entries in the MAC table Cache storage unit is 9. Stop Pop, wait for 3 clock cycles of protection time, and move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of access information cache FIFO is 12, and the valid number of entries in the MAC table Cache storage unit is 0.

[0117] (6) The number of valid access information cache FIFOs exceeds the threshold M1, and the high-speed learning mode is entered. sys Push 12 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 9, and the valid number of entries in the MAC table Cache storage unit is 15. This process requires 30 clock cycles (that is, Pop 15 access information, each access information needs to search the MAC table SRAM storage unit twice, so it takes 30 clock cycles to complete 30 searches for 15 access information).

[0118] (7) Stop Pop, wait for 3 clock cycles of protection time, and then move 15 valid entries in the MAC table cache storage unit. The number of valid entries in the MAC table cache storage unit is 0. This process requires a total of 18 clock cycles (that is, the protection time of 3 clock cycles plus the movement of 15 valid entries requires 15 clock cycles, a total of 18 clock cycles). This process can be carried out according to the input data frame rate according to f sys The maximum number of access information pushed into the access information cache FIFO is (18×360Mpps) / 900MHz≈8, so the effective number of access information cache FIFO is 17. It can be understood that since Pop does not affect push, even if Pop is stopped and moved during this process, access information can be pushed in parallel.

[0119] (8) The number of valid access information cache FIFOs exceeds the threshold M1, and the high-speed learning mode is entered. sys Push 12 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of the access information cache FIFO is 14, and the valid number of entries in the MAC table Cache storage unit is 15.

[0120] (9) Stop Pop, wait for 3 clock cycles of protection time, and then move 15 valid entries in the MAC table cache storage unit. The number of valid entries in the MAC table cache storage unit is 0. This process can be carried out according to the input data frame rate according to f sys A maximum of (18×360Mpps) / 900MHz≈8 access information are pushed into the access information cache FIFO, so the effective number of access information cache FIFO is 22 at this time.

[0121] (10) The number of valid access information cache FIFOs exceeds the threshold M2, and the system's line-speed forwarding function is realized. sys Push 12 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 19, and the valid number of entries in the MAC table Cache storage unit is 15. This process requires 30 clock cycles, and since no move enable is generated, the move of the MAC table Cache storage unit is abandoned.

[0122] (11) The number of valid entries in the current access information cache FIFO exceeds the threshold M1, and the high-speed learning mode is entered. The number of valid entries in the MAC table cache storage unit exceeds the threshold N2, and Pop is stopped. After waiting for the protection time of 3 clock cycles, the 15 valid entries in the MAC table cache storage unit are moved, and the number of valid entries in the MAC table cache storage unit is 0. This process can be carried out according to the input data frame rate according to f sys A maximum of (18×360Mpps) / 900MHz≈8 access information are pushed into the access information cache FIFO, so the effective number of access information cache FIFO is 27 at this time.

[0123] (12) The number of valid access information cache FIFOs exceeds the threshold M2, and the system's line-speed forwarding function is realized. sys Push 12 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 24, the valid number of entries in the MAC table Cache storage unit is 15, and since no migration enable is generated, the migration of the MAC table Cache storage unit is abandoned.

[0124] (13) The number of valid access information cache FIFOs exceeds the threshold M2, and the system's line-speed forwarding function is realized. sys Push 12 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of the access information cache FIFO is 21, and the valid number of entries in the MAC table cache storage unit is 15 (because the MAC table cache storage unit is full, 15 learning and updating operations are abandoned), and because no migration is enabled, the migration of the MAC table cache storage unit is abandoned. It can be understood that the difference between step (13) and step (10) is that: since the MAC table cache storage unit is full of 15 starting from step (12), and since the threshold M2 is always exceeded in the subsequent steps, no migration operation is generated, so the MAC table cache storage unit is always full, so in step (13), not only the migration is abandoned, but also the learning and updating operation is abandoned.

[0125] …

[0126] By analogy, the corresponding mode is entered for processing according to the valid number of the current access information cache FIFO.

[0127] It can be seen from the example of scenario 2 that when the input data frame rate is high speed, the design of this solution can flexibly switch between low-speed learning mode or high-speed learning mode or realize the line-speed forwarding function of the system, and can still ensure the efficiency of learning search and forwarding search while maximizing the efficiency of address learning. This also proves that the solution of this embodiment can be effectively adapted to high-speed switching equipment to meet usage requirements.

[0128] Scenario 3: The input data frame rate is 450Mpps, that is, (30×450Mpps) / 900MHz=15 access information are pushed into the access information cache FIFO every 30 clock cycles. Then, the specific implementation process in this scenario can be as follows:

[0129] (1) Initialization: the valid number of access information cache FIFO is 0, and the valid number of entries in the MAC table cache storage unit is 0;

[0130] (2) According to f sys Push 15 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 6, and the valid number of entries in the MAC table cache storage unit is 9. This process requires 18 clock cycles. Stop Pop, wait for 3 clock cycles of protection time, and move the 9 valid entries in the MAC table cache storage unit. At this time, the valid number of access information cache FIFO is 6, and the valid number of entries in the MAC table cache storage unit is 0. This process requires a total of 12 clock cycles. The whole process requires 30 clock cycles.

[0131] (3) Repeat step (2), keep the low-speed learning mode, and follow f sys Push 15 access information into the access information cache FIFO, according to f pop Pop 9 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 12, and the valid number of entries in the MAC table Cache storage unit is 9. Stop Pop, wait for 3 clock cycles of protection time, and move the 9 valid entries in the MAC table Cache storage unit. At this time, the valid number of access information cache FIFO is 12, and the valid number of entries in the MAC table Cache storage unit is 0.

[0132] (4) The number of valid access information cache FIFOs exceeds the threshold M1, and the high-speed learning mode is entered. sys Push 15 access information into the access information cache FIFO, according to f popPop 15 access information from the access information cache FIFO. At this time, the valid number of the access information cache FIFO is 12, and the valid number of entries in the MAC table Cache storage unit is 15.

[0133] (5) Stop Pop, wait for 3 clock cycles of protection time, and then move the 15 valid entries in the MAC table cache storage unit. The number of valid entries in the MAC table cache storage unit is 0. This process takes a total of 18 clock cycles. This process can be carried out according to the input data frame rate. sys (18×450Mpps) / 900MHz=9 access information are pushed into the access information cache FIFO, so the effective number of the access information cache FIFO is 21 at this time.

[0134] (6) The effective number of the current access information cache FIFO exceeds the threshold M2, and the system's line-speed forwarding function is realized. sys Push 15 access information into the access information cache FIFO, according to f pop Pop 15 access information from the access information cache FIFO. At this time, the valid number of access information cache FIFO is 21, and the valid number of entries in the MAC table Cache storage unit is 15. This process requires 30 clock cycles, and since no move enable is generated, the move of the MAC table Cache storage unit is abandoned.

[0135] (7) Repeat step (6). Since the migration enable is not generated, the migration of the MAC table cache storage unit is abandoned. Since the MAC table cache storage unit is full, the learning update operation of 15 access information is abandoned (i.e., the learning write operation is abandoned).

[0136] It can be seen from the example of scenario three that when the input data frame rate is higher, the design of this solution will choose to abandon the write operation in order to ensure efficient search, so as to adapt to higher-speed application scenarios and meet application requirements.

[0137] Embodiment 2

[0138] See also Figure 6 As shown, based on the same inventive concept, an embodiment of the present invention further provides a MAC address learning and forwarding method using the device in embodiment 1, the method comprising:

[0139] A. Push the access information of all data frames into the access information buffer FIFO for cache;

[0140] B. The Pop frequency control module controls the pop operation of the access information cache FIFO according to the valid number of entries in the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and controls the move enable of the MAC table Cache storage unit;

[0141] C. The access information popped out from the access information cache FIFO enters the MAC table lookup module. The MAC table lookup module first performs a destination MAC address lookup in the MAC table cache storage unit and the MAC table SRAM storage unit according to the access information, and forwards it according to the lookup result; then performs a source MAC address lookup and outputs the lookup result to the MAC table write control module;

[0142] D. The MAC table write control module writes the entries that need to be learned into the MAC table cache storage unit according to the input search results;

[0143] E. The MAC table Cache storage unit moves the stored learning update entry content to the SRAM access control module according to the move enable of the Pop frequency control module.

[0144] In addition, it should be noted that since the method of this embodiment is the same as the device of the above-mentioned embodiment 1 in terms of the principle of solving the problem, the various changes and specific examples in the above-mentioned device embodiment are also applicable to the method of this embodiment. Through the detailed description of the above-mentioned device, technical personnel in this field can clearly understand the specific implementation of the method in this embodiment. Therefore, for the sake of conciseness of the specification, the repeated parts will not be repeated.

[0145] Note: The above-mentioned specific embodiments are only examples rather than limitations, and those skilled in the art can, based on the concept of the present invention, merge and combine some steps and devices from the various embodiments described separately above to achieve the effects of the present invention. Such merged and combined embodiments are also included in the present invention, and such merges and combinations are not described one by one here.

[0146] The advantages, strengths, effects, etc. mentioned in the embodiments of the present invention are only examples, not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present invention. In addition, the above specific details disclosed in the embodiments of the present invention are only for the purpose of illustration and facilitating understanding, not limitation, and the above details do not limit the embodiments of the present invention to be implemented by adopting the above specific details.

[0147] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present invention to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof. And the content not described in detail in this specification belongs to the prior art known to those skilled in the art.

Claims

1. A MAC address learning and forwarding device, characterized in that: The device includes an access information cache FIFO, a Pop frequency control module, a MAC table lookup module, a MAC table write control module, a MAC table Cache storage unit and a MAC table SRAM storage unit; The access information cache FIFO is used to: cache the access information of all pushed data frames; The Pop frequency control module is used to: control the pop operation of the access information cache FIFO according to the valid number of the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and control the move enable of the MAC table Cache storage unit; The MAC table search module is used to: first search for a destination MAC address in a MAC table Cache storage unit and a MAC table SRAM storage unit according to the access information popped out of the access information cache FIFO, and forward the address according to the search result; Perform another source MAC address lookup and output the lookup result to the MAC table write control module; The MAC table write control module is used to: write the entries that need to be learned into the MAC table Cache storage unit according to the input search results; The MAC table Cache storage unit is used to: store learning update entry content; And according to the migration enable of the Pop frequency control module, the stored learning update entry content is moved to the SRAM access control module; The MAC table SRAM storage unit is used to store MAC address learning entries.

2. The MAC address learning and forwarding device according to claim 1, characterized in that: The Pop frequency control module controls the pop operation of the access information cache FIFO and controls the migration enable of the MAC table Cache storage unit, specifically including: Set the Pop frequency of the access information cache FIFO to f pop , and f pop ≤f sys / 2, where f sys is the system frequency; set the low-speed threshold M1 and high-speed threshold M2 of the access information FIFO, and M1 < M2 < M, where M is the depth of the access information cache FIFO; set the low-speed threshold N1 and high-speed threshold N2 of the MAC table Cache storage unit, and N1 < N2 ≤ N, where N is the depth of the MAC table Cache storage unit, and M ≥ 2N; If the valid number m of the current access information cache FIFO is 0, the pop-up operation is stopped, and a move enable for moving n entries is generated, where n is the valid number of entries in the current MAC table cache storage unit; If the current m < M1, when n ≥ N1, stop the pop operation and generate a transfer enable signal for transferring N1 entries; when n < N1, first pop N1 - n access information from the access information cache FIFO according to the frequency f pop and then stop the pop operation and generate a transfer enable signal for transferring N1 entries; Otherwise, if the current m < M2, when n ≥ N2, stop the pop operation and generate a transfer enable signal for transferring N2 entries; when n < N2, first pop N2 - n access information from the access information cache FIFO according to the frequency f pop and then stop the pop operation and generate a transfer enable signal for transferring N2 entries; Otherwise, if m ≥ M2, no move enable is generated, and the access information cache FIFO is read according to f pop Pop out N access information frequently.

3. The MAC address learning and forwarding device according to claim 2, characterized in that: The duration of stopping the pop-up operation is: the duration required for the move plus the duration from the access information entering the MAC table search control module to the access information being written into the MAC table Cache storage unit by the MAC table write control module.

4. The MAC address learning and forwarding device according to claim 1, characterized in that: When the MAC table search module searches for a destination MAC address and a source MAC address, the search is performed preferentially in the MAC table Cache storage unit.

5. The MAC address learning and forwarding device according to claim 1, characterized in that: The MAC table lookup module performs source MAC address lookup and outputs the lookup result to the MAC table write control module, specifically including: If the source MAC address is found in the MAC table Cache storage unit, the entry content in the MAC table Cache storage unit is output to the MAC table write control module, and the preset hit indication flag Hit is set to 1; If the source MAC address is found in the MAC table SRAM storage unit, the entry content in the MAC table SRAM storage unit is output to the MAC table write control module, and the hit indication flag Hit is set to 1; If not found, the hit indicator Hit is set to 0.

6. The MAC address learning and forwarding device according to claim 5, characterized in that: The MAC table write control module writes the entries to be learned into the MAC table Cache storage unit according to the input search result, specifically including: When the Hit is 0, under the condition that there is a vacancy in the MAC table SRAM storage unit and the MAC table Cache storage unit is not full, the source MAC address of the access information is written as a new entry into the MAC table Cache storage unit; otherwise, the learning and updating operation of the new entry is abandoned; When the Hit is 1, when the port learning information is consistent, if the aging state does not need to be updated, the current learning update operation is abandoned; if the aging state needs to be updated or the port learning information changes, the updated entry is written into the MAC table Cache storage unit.

7. The MAC address learning and forwarding device according to claim 1, characterized in that: The structure of the MAC table Cache storage unit is a first-in-first-out queue, where data is pushed in from the bottom and popped out from the top.

8. The MAC address learning and forwarding device according to claim 7, characterized in that: When multiple entries in the MAC table Cache storage unit are hit at the same time, data of the hit entries close to the bottom are output preferentially.

9. The MAC address learning and forwarding device according to claim 1, characterized in that: The device also includes an SRAM access control module; When the MAC table search control module searches in the MAC table SRAM storage unit, it outputs a read operation instruction to the SRAM access control module; when the MAC table Cache storage unit moves, it outputs a move operation instruction to the SRAM access control module; The SRAM access control module is used to arbitrate input read operation instructions and move operation instructions, and perform corresponding read and write operations on the MAC table SRAM storage unit according to read and write requirements.

10. A MAC address learning and forwarding method based on the device according to any one of claims 1 to 9, characterized in that: The method includes: The access information of all data frames is pushed into the access information buffer FIFO for buffering; The Pop frequency control module controls the pop operation of the access information cache FIFO according to the valid number of entries in the access information cache FIFO and the valid number of entries in the MAC table Cache storage unit, and controls the move enable of the MAC table Cache storage unit; The access information popped out from the access information cache FIFO enters the MAC table lookup module. The MAC table lookup module first performs a destination MAC address lookup in the MAC table cache storage unit and the MAC table SRAM storage unit according to the access information, and forwards it according to the lookup result; then performs a source MAC address lookup and outputs the lookup result to the MAC table write control module; The MAC table write control module writes the entries that need to be learned into the MAC table cache storage unit according to the input search results; The MAC table Cache storage unit moves the stored learning update entry content to the SRAM access control module according to the move enable of the Pop frequency control module.