A method and system for realizing accurate aging of Ethernet layer 2 forwarding table

By configuring multiple segmentation cycles and new states to be aged in the Layer 2 forwarding table of the Ethernet switch, using status bit encoding characterization to accurately control the aging process, the problem of inaccurate aging time in the existing technology is solved, and the problem of inaccurate aging time in the existing technology is realized. Higher aging time accuracy and more accurate aging effect.

CN114024919BActive Publication Date: 2024-11-08SUZHOU MOTORCOMM ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111146417.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2024-11-08
Estimated Expiration
2041-09-28

Smart Images

  • Figure CN114024919B_ABST
    Figure CN114024919B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for realizing accurate aging of an Ethernet layer 2 forwarding table, and relates to the technical field of layer 2 forwarding table aging control, including: step S1, configuring an aging cycle and working state of a layer 2 forwarding table in an Ethernet switch, the working state including a starting state, a blank state and at least two states to be aged, the starting state, the blank state and each state to be aged divide the aging cycle into a plurality of segmented cycles; step S2, the Ethernet switch performs accurate aging control on the layer 2 forwarding table according to the working state and the corresponding segmented cycles. The beneficial effect is that by using the state bit in the traditional layer 2 forwarding table, through a new encoding method, the granularity of the refresh time is improved, a more accurate refresh time is provided, and the time accuracy of aging is improved without increasing the original cost, thereby making the aging more fair and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of layer 2 forwarding table aging control, and in particular to a method and system for realizing accurate aging of an Ethernet layer 2 forwarding table. Background Art

[0002] The main function of an Ethernet switch is to forward messages at the data link layer, that is, to output messages to the corresponding ports according to the destination MAC address of the message. The Layer 2 forwarding function is responsible for address learning and message forwarding of Ethernet messages. This function is implemented by the Layer 2 forwarding table (MAC address table) and corresponding logical functions such as address learning, lookup, and aging.

[0003] The MAC address table is a layer 2 forwarding table that contains the relationship between MAC addresses and forwarding ports. It is the basis for Ethernet switches to achieve fast forwarding of layer 2 messages. The layer 2 forwarding table of Ethernet switches has limited capacity. In order to maximize the use of layer 2 forwarding table resources, Ethernet switches use an aging mechanism to update the layer 2 forwarding table. That is, when the system dynamically creates a table entry, it starts the aging timer. If no message from the MAC address in the table entry is received again within the aging time, the Ethernet switch will delete the MAC address table entry.

[0004] In the prior art, the valid bit V and the aging bit A are used to define the three working states of the table entries, namely the starting state (V=1, A=0), the state to be aged (V=1, A=1) and the blank state (V=0, A=0). When a new address is learned, the learning function stores the source MAC address and the receiving port number in the Layer 2 forwarding table, and the table entry becomes the starting state. The aging timer starts the aging process in the background and changes all the table entries in the starting state to the state to be aged. At this time, the table entries are still valid; the table entries to be aged are converted to the blank state during the aging process, that is, the table entry is deleted. If a refresh event occurs, the state to be aged returns to the starting state. Based on this, if Figure 1 As shown in the figure, if an aging cycle is set to T, it can be seen that the maximum aging time of an entry is 2T and the shortest aging time is T. The arrival time of the refresh event, that is, the message, is random, and the average value is half of an aging cycle. Figure 1 It can be clearly seen from the figure that if an aging cycle is set to T, the average aging time is 1.5T, and the error is 50%, that is, the existing aging mechanism has a large error. Summary of the invention

[0005] In view of the problems existing in the prior art, the present invention provides a method for realizing accurate aging of an Ethernet layer 2 forwarding table, which is used to accurately control the aging of a layer 1 and layer 2 forwarding table pre-configured in an Ethernet switch. The method for realizing accurate aging of an Ethernet layer 2 forwarding table comprises:

[0006] Step S1, configuring an aging cycle and a working state of the layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two states to be aged, wherein the starting state, the blank state, and each of the states to be aged divide the aging cycle into a plurality of segmented cycles;

[0007] Step S2: the Ethernet switch performs precise aging control on the layer 2 forwarding table according to the working state and the corresponding segment periods.

[0008] Preferably, the working status is encoded and represented by a status bit in the layer 2 forwarding table.

[0009] Preferably, the status bits include a valid bit, an aging bit and a static bit.

[0010] Preferably, the step S2 comprises:

[0011] Step S21, the Ethernet switch determines whether an Ethernet address entry is received in any segment period for each of the aging periods:

[0012] If yes, go to step S22;

[0013] If not, the Ethernet switch refreshes the working state of the Ethernet address table entry according to the state transition sequence of the initial state, each of the aging states, and the blank state, and deletes the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table to perform precise aging control on the layer 2 forwarding table, and then exits;

[0014] Step S22, the Ethernet switch determines whether the Ethernet address entry exists in the layer 2 forwarding table:

[0015] If yes, the Ethernet switch refreshes the working state of the corresponding Ethernet address entry in the layer 2 forwarding table to the starting state, and then returns to step S21;

[0016] If not, the Ethernet switch adds the Ethernet address entry to the layer 2 forwarding table, and configures the working state of the Ethernet address entry to the initial state, and then returns to step S21.

[0017] The present application also provides a system for realizing accurate aging of an Ethernet layer 2 forwarding table, and the method for realizing accurate aging of an Ethernet layer 2 forwarding table is applied. The system for realizing accurate aging of an Ethernet layer 2 forwarding table comprises:

[0018] A state configuration module, configured to configure an aging cycle and a working state of the layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two states to be aged, wherein the starting state, the blank state, and each of the states to be aged divide the aging cycle into a plurality of segmented cycles;

[0019] An aging control module is connected to the state configuration module and is used to perform precise aging control on the layer 2 forwarding table according to the working state and the corresponding segment periods.

[0020] Preferably, the working status is encoded and represented by a status bit in the layer 2 forwarding table.

[0021] Preferably, the status bits include a valid bit, an aging bit and a static bit.

[0022] Preferably, the aging control module includes:

[0023] A first judgment unit is used for generating a first judgment signal when an Ethernet address table entry is not received in any of the segment periods for each of the aging periods, and generating a second judgment signal when an Ethernet address table entry is received in any of the segment periods;

[0024] a first aging unit, connected to the first judgment unit, configured to refresh the working state of the Ethernet address table entry according to the state transition sequence of the initial state, each of the aging states and the blank state according to the first judgment signal, and delete the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table, so as to perform accurate aging control on the layer 2 forwarding table;

[0025] a second judgment unit, connected to the first judgment unit, configured to generate a third judgment signal when judging that the Ethernet address entry exists in the layer 2 forwarding table according to the second judgment signal, and to generate a fourth judgment signal when judging that the Ethernet address entry does not exist in the layer 2 forwarding table;

[0026] a second aging unit, connected to the second judgment unit, and configured to refresh the working state of the corresponding Ethernet address entry in the layer 2 forwarding table to the starting state according to the third judgment signal, so as to enter a new aging cycle;

[0027] A third aging unit is connected to the second judgment unit, and is used to add the Ethernet address table entry to the layer 2 forwarding table according to the fourth judgment signal, and configure the working state of the Ethernet address table entry to the starting state to enter a new aging cycle.

[0028] The above technical solution has the following advantages or beneficial effects: with the help of the status bits in the traditional Layer 2 forwarding table, a new encoding method is used to improve the granularity of the refresh time, provide a more accurate refresh time, and improve the time accuracy of aging without increasing the original cost, thereby making aging more fair and accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A schematic diagram of an aging cycle and a corresponding entry state in an existing aging mechanism of a layer 2 forwarding table;

[0030] Figure 2 A flow chart of a method for realizing accurate aging of an Ethernet layer 2 forwarding table in a preferred embodiment of the present invention;

[0031] Figure 3 A schematic diagram of a process for performing precise aging control on a layer 2 forwarding table in a preferred embodiment of the present invention;

[0032] Figure 4 It is a schematic diagram of the principle of the aging process of the layer 2 forwarding table corresponding to five aging states in a preferred embodiment of the present invention;

[0033] Figure 5 It is a schematic diagram of the principle of the aging process of the layer 2 forwarding table corresponding to three aging states in a preferred embodiment of the present invention;

[0034] Figure 6 A schematic diagram of an aging cycle and a corresponding table entry state in a preferred embodiment of the present invention;

[0035] Figure 7 The structure diagram of a system for realizing accurate aging of Ethernet layer 2 forwarding table in a preferred embodiment of the present invention is shown in FIG. DETAILED DESCRIPTION

[0036] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The present invention is not limited to this embodiment, and other embodiments may also fall within the scope of the present invention as long as they conform to the gist of the present invention.

[0037] In a preferred embodiment of the present invention, based on the above problems existing in the prior art, a method for realizing accurate aging of an Ethernet layer 2 forwarding table is provided, which is used to accurately control the aging of a layer 1 and layer 2 forwarding table pre-configured in an Ethernet switch, such as Figure 2As shown, the method for realizing accurate aging of Ethernet layer 2 forwarding table includes:

[0038] Step S1, configuring an aging cycle and a working state of a layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two states to be aged, and the starting state, the blank state, and each state to be aged divide the aging cycle into a plurality of segment cycles;

[0039] Step S2: The Ethernet switch performs precise aging control on the layer 2 forwarding table according to the working status and the corresponding segment periods.

[0040] Specifically, in this embodiment, the working state is encoded and represented by the state bit in the layer 2 forwarding table, and the state bit includes a valid bit V (valid), an aging bit (aging), and a static bit S (static). In the traditional layer 2 forwarding table, the static bit S (static) is configured by the user, indicating that the table item is a static table item, and the static table item does not participate in aging. Preferably, the definition and the state represented by the above-mentioned state bits are shown in the following table:

[0041] V S A Table status 0 x x Blank table entry 1 1 x Valid, static 1 0 0 Valid, dynamic, start state 1 0 1 Valid, dynamic, waiting for aging status

[0042] As can be seen from the above table, the valid bit V, the aging bit A and the static bit S can be used to represent 8 working states, but the traditional layer 2 forwarding table only uses 4 of them. This solution preferably uses at least one of the remaining four states, and adds 4 new states to be aged by re-encoding. Among them, when the remaining four states are all involved in aging, the encoding and representative states of each working state are shown in the following table:

[0043]

[0044]

[0045] It is understandable that the above encoding method is only an embodiment of the present technical solution and does not limit the present technical solution. In actual use, the encoding method of some of the above-mentioned aging states 1 to aging states 5 may be occupied by other purposes. In order to avoid conflicts, when configuring the working state, the factors of being occupied by other purposes are considered. When none of the above-mentioned states are occupied by other purposes, it is preferred to configure 5 aging states to improve the time accuracy of aging as much as possible. It is also possible to configure two or more aging states. The specific configuration can be made according to the needs.

[0046] More specifically, if the above 001 representing the state to be aged 1 and 111 representing the state to be aged 4 are occupied by other purposes, when configuring the working state, 001 of the state to be aged 1 and 111 representing the state to be aged 4 can be removed, and only at least two of the states to be aged 2, 3 and 5 are retained. The number of states to be aged determines the number of segmented cycles. Taking the original complete aging cycle T as an example, the duration of each segmented cycle can be T / n, where n is used to represent the number of states to be aged. Each segmented cycle can also be configured with different durations, and the total duration of each segmented cycle is T.

[0047] After the configuration of the working state and segment period is completed, the Ethernet switch then performs precise aging control on the Layer 2 forwarding table according to the working state and the corresponding segment period, such as Figure 3 As shown, step S2 includes:

[0048] Step S21: The Ethernet switch determines whether an Ethernet address entry is received in any segment period for each aging period:

[0049] If yes, go to step S22;

[0050] If not, the Ethernet switch refreshes the working state of the Ethernet address table entry according to the state transition sequence of the initial state, each aging state, and the blank state, and deletes the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table to perform precise aging control on the layer 2 forwarding table, and then exits;

[0051] Step S22: The Ethernet switch determines whether there is an Ethernet address entry in the Layer 2 forwarding table:

[0052] If yes, the Ethernet switch refreshes the working state of the corresponding Ethernet address entry in the Layer 2 forwarding table to the initial state, and then returns to step S21;

[0053] If not, the Ethernet switch adds the Ethernet address entry to the layer 2 forwarding table, and configures the working state of the Ethernet address entry to the initial state, and then returns to step S21.

[0054] Specifically, in this embodiment, taking the aging state of 5 as an example, the aging process of the layer 2 forwarding table is as follows: Figure 4As shown, the new address learned is used to indicate that the Ethernet switch receives the Ethernet address table entry, and the Ethernet address table entry does not exist in the current Layer 2 forwarding table, indicating that the Ethernet address table entry is a learned new address; no refresh event is used to indicate that the Ethernet switch does not receive the Ethernet address table entry in the segment period, and refresh occurs to indicate that the Ethernet switch receives the Ethernet address table entry in the segment period, and the Ethernet address table entry exists in the current Layer 2 forwarding table. The aging timer starts the aging process in the background, inserts 4 new states to be aged, and changes the table entry in the starting state to aging 1, 2, 3, 4 and the final state to be aged 5 in sequence. The table entries are still valid in these states; the final table entry to be aged is converted to a blank state in the aging process, that is, the table entry is deleted.

[0055] Further, taking the aging state as 5 as an example, Figure 5 As shown, it can be clearly seen that if a complete aging cycle is T (each segment aging cycle is T / 5), the average aging time is (0.5+5)*(T / 5)=1.1T. Therefore, the error is 10%, reducing the original time error from 50% to 10%, that is, the accuracy is improved by 5 times.

[0056] As a preferred implementation, if the above 001 representing the state to be aged 1 and the 111 representing the state to be aged 4 are occupied by other purposes, when configuring the working state, the 001 representing the state to be aged 1 and the 111 representing the state to be aged 4 can be removed, and only at least two of the states to be aged 2, 3 and 5 are retained. At this time, the corresponding aging process of the second-layer forwarding table is as follows: Figure 6 As shown, among which, the aging state 1, the aging state 2 and the aging state 3 are respectively Figure 4 The original aging state 2, aging state 3 and aging state 5 are available. Other occupancy scenarios are similar and will not be described here.

[0057] The present application also provides a system for realizing accurate aging of Ethernet layer 2 forwarding table, and the method for realizing accurate aging of Ethernet layer 2 forwarding table is applied, such as Figure 7 As shown, the system for realizing accurate aging of Ethernet layer 2 forwarding table includes:

[0058] The state configuration module 1 is used to configure an aging cycle and a working state of the layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two waiting-for-aging states, and the starting state, the blank state, and each waiting-for-aging state divide the aging cycle into a plurality of segmented cycles;

[0059] The aging control module 2 and the connection state configuration module 1 are used to perform precise aging control on the layer 2 forwarding table according to the working state and the corresponding segment periods.

[0060] In a preferred embodiment of the present invention, the working status is encoded and represented by the status bit in the layer 2 forwarding table.

[0061] In a preferred embodiment of the present invention, the status bit includes a valid bit, an aging bit and a static bit.

[0062] In a preferred embodiment of the present invention, the aging control module 2 includes:

[0063] The first judgment unit 21 is used for generating a first judgment signal when an Ethernet address table entry is not received in any segment period for each aging period, and generating a second judgment signal when an Ethernet address table entry is received in any segment period;

[0064] The first aging unit 22 is connected to the first judgment unit 21, and is used to refresh the working state of the Ethernet address table entry according to the state conversion sequence of the initial state, each aging state and the blank state according to the first judgment signal, and delete the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table, so as to perform accurate aging control on the layer 2 forwarding table;

[0065] The second judgment unit 23 is connected to the first judgment unit 21, and is used to generate a third judgment signal when judging that there is an Ethernet address entry in the layer 2 forwarding table according to the second judgment signal, and to generate a fourth judgment signal when judging that there is no Ethernet address entry in the layer 2 forwarding table;

[0066] The second aging unit 24 is connected to the second judgment unit 23 and is used to refresh the working state of the corresponding Ethernet address entry in the layer 2 forwarding table to the starting state according to the third judgment signal to enter a new aging cycle;

[0067] The third aging unit 25 is connected to the second judgment unit 23, and is used to add the Ethernet address table entry to the layer 2 forwarding table according to the fourth judgment signal, and configure the working state of the Ethernet address table entry to the starting state to enter a new aging cycle.

[0068] The above description is only a preferred embodiment of the present invention, and does not limit the implementation mode and protection scope of the present invention. For those skilled in the art, it should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of this specification and illustrations should be included in the protection scope of the present invention.

Claims

1. A method for realizing accurate aging of Ethernet layer 2 forwarding table, characterized in that: The method for accurately controlling the aging of a layer 1 or 2 forwarding table pre-configured in an Ethernet switch comprises: Step S1, configuring an aging cycle and a working state of the layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two states to be aged, wherein the starting state, the blank state, and each of the states to be aged divide the aging cycle into a plurality of segmented cycles; Step S2, the Ethernet switch performs precise aging control on the layer 2 forwarding table according to the working state and the corresponding segment periods; The step S2 comprises: Step S21, the Ethernet switch determines whether an Ethernet address entry is received in any segment period for each of the aging periods: If yes, go to step S22; If not, the Ethernet switch refreshes the working state of the Ethernet address table entry according to the state transition sequence of the initial state, each of the aging states, and the blank state, and deletes the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table to perform precise aging control on the layer 2 forwarding table, and then exits; Step S22: The Ethernet switch determines whether the Ethernet address entry exists in the layer 2 forwarding table. If yes, the Ethernet switch refreshes the working state of the corresponding Ethernet address entry in the layer 2 forwarding table to the starting state, and then returns to step S21; If not, the Ethernet switch adds the Ethernet address entry to the layer 2 forwarding table, and configures the working state of the Ethernet address entry to the initial state, and then returns to step S21.

2. The method for realizing accurate aging of Ethernet layer 2 forwarding table according to claim 1, characterized in that: The working status is coded and represented by the status bit in the layer 2 forwarding table.

3. The method for realizing accurate aging of Ethernet layer 2 forwarding table according to claim 2, characterized in that: The status bits include a valid bit, an aging bit and a static bit.

4. A system for realizing accurate aging of Ethernet layer 2 forwarding table, characterized in that: The method for realizing accurate aging of an Ethernet layer 2 forwarding table as claimed in any one of claims 1 to 3 is applied, and the system for realizing accurate aging of an Ethernet layer 2 forwarding table comprises: A state configuration module, configured to configure an aging cycle and a working state of the layer 2 forwarding table in the Ethernet switch, wherein the working state includes a starting state, a blank state, and at least two states to be aged, wherein the starting state, the blank state, and each of the states to be aged divide the aging cycle into a plurality of segmented cycles; An aging control module, connected to the state configuration module, for performing precise aging control on the layer 2 forwarding table according to the working state and the corresponding segment periods; The aging control module comprises: A first judgment unit is used for generating a first judgment signal when an Ethernet address table entry is not received in any of the segment periods for each of the aging periods, and generating a second judgment signal when an Ethernet address table entry is received in any of the segment periods; a first aging unit, connected to the first judgment unit, configured to refresh the working state of the Ethernet address table entry according to the state transition sequence of the initial state, each of the aging states and the blank state according to the first judgment signal, and delete the Ethernet address table entry corresponding to the blank state from the layer 2 forwarding table, so as to perform accurate aging control on the layer 2 forwarding table; a second judgment unit, connected to the first judgment unit, configured to generate a third judgment signal when judging that the Ethernet address entry exists in the layer 2 forwarding table according to the second judgment signal, and to generate a fourth judgment signal when judging that the Ethernet address entry does not exist in the layer 2 forwarding table; A second aging unit, connected to the second judgment unit, is used to refresh the working state of the corresponding Ethernet address entry in the layer 2 forwarding table to the starting state according to the third judgment signal, so as to enter a new aging cycle; A third aging unit is connected to the second judgment unit, and is used to add the Ethernet address table entry to the layer 2 forwarding table according to the fourth judgment signal, and configure the working state of the Ethernet address table entry to the starting state to enter a new aging cycle.

5. The system for realizing accurate aging of Ethernet layer 2 forwarding table according to claim 4, characterized in that: The working status is coded and represented by the status bit in the layer 2 forwarding table.

6. The system for realizing accurate aging of Ethernet layer 2 forwarding table according to claim 5, characterized in that: The status bits include a valid bit, an aging bit and a static bit.