CN109413225B - MAC table item processing method and equipment - Google Patents

MAC table item processing method and equipment Download PDF

Info

Publication number
CN109413225B
CN109413225B CN201811435601.XA CN201811435601A CN109413225B CN 109413225 B CN109413225 B CN 109413225B CN 201811435601 A CN201811435601 A CN 201811435601A CN 109413225 B CN109413225 B CN 109413225B
Authority
CN
China
Prior art keywords
mark
mac
aging
processor
entry
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811435601.XA
Other languages
Chinese (zh)
Other versions
CN109413225A (en
Inventor
李佳
尹双双
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN201811435601.XA priority Critical patent/CN109413225B/en
Publication of CN109413225A publication Critical patent/CN109413225A/en
Application granted granted Critical
Publication of CN109413225B publication Critical patent/CN109413225B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method and a device for processing an MAC table entry, wherein the method comprises the following steps: when learning the MAC table entry, the first processor determines the exit type of the MAC table entry; if the exit type is a global port or an equivalent port, setting a hit mark for the MAC table entry in a first hardware forwarding table, and setting an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark; reading the aging tag and the hit tag at each processing cycle; if the aging mark is a first mark and the hit mark is a second mark, adjusting the aging mark of the MAC table entry to a third mark; and if the aging mark is a third mark and the hit mark is a second mark, deleting the MAC table entry from the first hardware forwarding table and the first software forwarding table respectively. By the technical scheme, the MAC table entry can be deleted correctly, and abnormal packet loss is avoided.

Description

MAC table item processing method and equipment
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for processing an MAC entry.
Background
The communication device includes a plurality of LPUs (Line Processing units, service boards for short), and the LPUs are connected by SFUs (Switch Fabric units). For each LPU (e.g., LPU1), source MAC (Media Access Control) learning and destination MAC lookup are involved after receiving the data message. Wherein, the source MAC learning means: the LPU1 inquires whether a MAC table entry corresponding to the source MAC address of the data packet exists in the MAC table, and if not, learns the MAC table entry 1 and synchronizes the MAC table entry 1 to other LPUs. The destination MAC lookup is: the LPU1 queries whether an MAC table entry corresponding to the destination MAC address of the data packet exists in the MAC table, and if not, broadcasts the data packet, and if so, sends the data packet according to the output interface of the MAC table entry.
Since the storage space of the MAC table is limited, the MAC table entry no longer used needs to be deleted. For example, when the MAC table records MAC table entry 1, LPU1 sets an aging flag for MAC table entry 1, which indicates that MAC table entry 1 is learned by the board and is subjected to aging processing by the board, so that when the aging timer times out, MAC table entry 1 is deleted and an aging message is sent to other LPUs. When the MAC table records the MAC table item 1, other LPUs set a static mark for the MAC table item 1, which indicates that the MAC table item 1 is not learned by the board and is not aged by the board, and only when an aging message is received, the MAC table item 1 is deleted.
However, if the egress interface of MAC table entry 1 is a global port, and the global port includes physical port a of LPU1 and physical port B of LPU2, LPU1 and LPU2 may learn the same MAC table entry 1. Thus, if the LPU1 sets the aging flag for the MAC entry 1 or the LPU2 sets the aging flag for the MAC entry 1, there is no specific scheme currently, that is, if the LPU1 deletes the MAC entry 1 or the LPU2 deletes the MAC entry 1, it cannot be distinguished currently, so that the MAC entry 1 cannot be correctly deleted.
Disclosure of Invention
The application provides a MAC table item processing method, which is applied to a first service board of communication equipment, wherein the first service board comprises a first hardware chip and a first processor, and the method comprises the following steps:
when the first processor learns the MAC table item, determining the exit type of the MAC table item;
if the exit type is a global port or an equivalent port, the first processor sets a hit mark for the MAC table entry in a first hardware forwarding table, and sets an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark;
at each processing cycle, the first processor reading the aging tag and the hit tag;
if the aging mark is a first mark and the hit mark is a second mark, the first processor adjusts the aging mark of the MAC table entry into a third mark;
and if the aging mark is a third mark and the hit mark is a second mark, the first processor deletes the MAC table entry from the first hardware forwarding table and the first software forwarding table respectively.
The application provides a communication device, the communication device includes a first service board, the first service board includes a first hardware chip and a first processor, wherein:
the first processor is used for determining the exit type of the MAC table item when the MAC table item is learned; if the exit type is a global port or an equivalent port, setting a hit mark for the MAC table entry in a first hardware forwarding table, and setting an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark;
the first processor is further used for reading the aging mark and the hit mark in each processing cycle; if the aging mark is a first mark and the hit mark is a second mark, adjusting the aging mark of the MAC table entry to a third mark; and if the aging mark is a third mark and the hit mark is a second mark, deleting the MAC table entry from the first hardware forwarding table and the first software forwarding table.
Based on the above technical solution, in this embodiment of the application, when the exit type of the MAC entry is a global port or an equivalent port, a hit flag may be set in the hardware forwarding table for the MAC entry, and an aging flag may be set in the software forwarding table for the MAC entry, so that the processor may process the MAC entry according to the hit flag of the MAC entry and the aging flag of the MAC entry, for example, if the aging flag is a third identifier and the hit flag is a second identifier, the processor may delete the MAC entry from the hardware forwarding table and the software forwarding table, that is, the processor may implement aging deletion of the MAC entry, thereby correctly deleting the MAC entry, avoiding a problem that the MAC entry cannot be correctly deleted, and avoiding abnormal packet loss.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments of the present application or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings of the embodiments of the present application.
Fig. 1 is a flowchart of a MAC entry processing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an application scenario in an embodiment of the present application;
fig. 3 is a flowchart of a MAC entry processing method according to another embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Depending on the context, moreover, the word "if" as used may be interpreted as "at … …" or "when … …" or "in response to a determination".
The MAC entry processing method provided in the embodiment of the present application may be applied to communication devices (such as a router, a switch, a server, and the like), where the communication devices may include a plurality of service boards. For convenience of description, each service board may be used as a first service board, and when a certain service board is used as the first service board, other service boards except the first service board are used as second service boards. Each service board may include a hardware chip (e.g., an NP (Network Processor), a switch chip, etc.) and a Processor (e.g., a CPU (Central Processing Unit), etc.), and for convenience of description, the hardware chip of the first service board is referred to as a first hardware chip, the Processor of the first service board is referred to as a first Processor, the hardware chip of the second service board is referred to as a second hardware chip, and the Processor of the second service board is referred to as a second Processor.
In one example, a hardware chip of each service board maintains a hardware forwarding table, a processor of each service board maintains a software forwarding table, for convenience of differentiation, the hardware forwarding table maintained by a first hardware chip of a first service board is referred to as a first hardware forwarding table, the software forwarding table maintained by the first processor of the first service board is referred to as a first software forwarding table, the hardware forwarding table maintained by a second hardware chip of a second service board is referred to as a second hardware forwarding table, and the software forwarding table maintained by the second processor of the second service board is referred to as a second software forwarding table.
Referring to fig. 1, a method for processing a MAC entry according to an embodiment of the present application may include:
step 101, when learning the MAC entry, the first processor determines the exit type of the MAC entry.
The first processor learns the MAC entry, which may include but is not limited to the following cases:
in case one, after the first hardware chip receives the data packet, source MAC learning may be performed. Assuming that the first hardware forwarding table does not have the MAC entry corresponding to the source MAC address of the data packet, the first hardware chip may learn the MAC entry (hereinafter referred to as MAC entry 1), and record MAC entry 1 in the first hardware forwarding table, where the MAC entry 1 may include a corresponding relationship between the source MAC address of the data packet and an incoming interface (e.g., interface a) of the data packet. Further, the first processor may learn the MAC entry 1 from the first hardware forwarding table, record the MAC entry 1 in the first software forwarding table, synchronize the MAC entry 1 to the second processor, and after receiving the MAC entry 1, the second processor may record the MAC entry 1 in the second hardware forwarding table and the second software forwarding table.
In case two, after the second hardware chip receives the data message, source MAC learning can be performed. Assuming that the second hardware forwarding table does not have the MAC entry corresponding to the source MAC address of the data packet, the second hardware chip may learn the MAC entry (hereinafter referred to as MAC entry 2), and record the MAC entry 2 in the second hardware forwarding table, where the MAC entry 2 may include a corresponding relationship between the source MAC address of the data packet and an incoming interface (e.g., interface B) of the data packet. Further, the second processor may learn the MAC entry 2 from the second hardware forwarding table, record the MAC entry 2 in the second software forwarding table, and synchronize the MAC entry 2 to the first processor, so that the first processor may learn the MAC entry 2 and record the MAC entry 2 in the first software forwarding table and the first hardware forwarding table.
In an example, when learning the MAC entry, the first processor may further determine an egress type of the MAC entry, and specifically, since the MAC entry includes an ingress interface of the data packet, that is, the interface a or the interface B, the first processor may determine the egress type of the interface, which is not limited to this.
The type of the exit may be a global port or an equivalent port, or may be other types of interfaces besides the global port and the equivalent port, and the type of the exit is not limited. Further, the global port may be an aggregation interface or a binding interface, and is used to indicate that the outgoing interface of the MAC entry is an aggregation interface or a binding interface, which is not limited herein. Furthermore, the egress interface of the equivalence port for the MAC table entry is the equivalence interface.
Step 102, if the exit type is a global port or an equivalent port, the first processor sets a hit flag for the MAC entry in the first hardware forwarding table, and sets an aging flag for the MAC entry in the first software forwarding table.
The initial value of the aging flag may be a first flag (e.g. a value 0), and in a subsequent process, the aging flag may be modified to a third flag (e.g. a value 1), for a specific modification process, see the subsequent embodiments.
The initial value of the hit flag may be a second identifier (e.g. a value 0), and in a subsequent process, the hit flag may be modified to a fourth identifier (e.g. a value 1), for a specific modification process, see the subsequent embodiments.
At each processing cycle, the first processor reads the aging tag and the hit tag, step 103.
In one example, when the first processor learns the MAC entry, if the egress type of the MAC entry is a global port or an equivalent port, the first processor may further set a deadline flag for the MAC entry in a first software forwarding table. Based on this, the first processor may set an aging timer (i.e., set an aging timer for all MAC table entries of the first software forwarding table). When the aging timer times out, the first processor acquires all MAC table entries with the deadline marks from the first software forwarding table and re-counts the aging timer. And aiming at each acquired MAC table entry, the first processor reads the aging mark of the MAC table entry from the first software forwarding table and reads the hit mark of the MAC table entry from the first hardware forwarding table. In addition, for the MAC entry without the deadline marker, the MAC entry is processed in a conventional manner, which is not described herein again.
And 104, the first processor processes the MAC table entry according to the hit mark and the aging mark. For example, if the aging flag is a first flag and the hit flag is a second flag, the aging flag of the MAC entry is adjusted to a third flag; and if the aging mark is a third mark and the hit mark is a second mark, deleting the MAC table entry from the first hardware forwarding table and deleting the MAC table entry from the first software forwarding table.
In one example, if the aging flag is a first flag and the hit flag is a fourth flag, the first processor may adjust the hit flag of the MAC entry to the second flag. If the aging flag is the third flag and the hit flag is the fourth flag, the first processor may adjust the aging flag of the MAC entry to the first flag and adjust the hit flag of the MAC entry to the second flag.
In an example, when the first hardware chip receives the data packet matching the MAC entry, the hit flag of the MAC entry may be set to the fourth identifier, that is, when the hit flag is the fourth identifier, the hit flag is kept unchanged, and when the hit flag is the second identifier, the hit flag is modified to the fourth identifier.
In an example, if the hit flag of the MAC entry is the fourth flag, and the aging flag of the MAC entry is the first flag or the third flag, the first processor may further send a synchronous refresh message for the MAC entry to the second processor, so that the second processor determines the MAC entry corresponding to the synchronous refresh message from the second software forwarding table, and sets the aging flag of the MAC entry as the first flag.
Based on the above technical solution, in this embodiment of the application, when the exit type of the MAC entry is a global port or an equivalent port, a hit flag may be set in the hardware forwarding table for the MAC entry, and an aging flag may be set in the software forwarding table for the MAC entry, so that the processor may process the MAC entry according to the hit flag of the MAC entry and the aging flag of the MAC entry, for example, if the aging flag is a third identifier and the hit flag is a second identifier, the processor may delete the MAC entry from the hardware forwarding table and the software forwarding table, that is, the processor may implement aging deletion of the MAC entry, thereby correctly deleting the MAC entry, avoiding a problem that the MAC entry cannot be correctly deleted, and avoiding abnormal packet loss.
The above technical solution is further described below with reference to the application scenario shown in fig. 2.
Referring to fig. 2, the communication device may include 4 service boards (e.g., LPUs) and 1 switching network board 205 (e.g., SFUs), and in practical applications, the number of the service boards may also be other values, which is not limited thereto, and the number of the switching network boards may also be other values, such as 2, 3, and the like, which is not limited thereto.
Referring to fig. 2, the service board 201 may include a hardware chip 2011 and a processor 2012, the service board 202 may include a hardware chip 2021 and a processor 2022, the service board 203 may include a hardware chip 2031 and a processor 2032, and the service board 204 may include a hardware chip 2041 and a processor 2042.
In this application scenario, it is assumed that the interface a of the service board 201 and the interface B of the service board 202 are connected to the same opposite-end device, and the interface a and the interface B form an aggregation port R. The hardware chip 2011 maintains a hardware forwarding table 1, the processor 2012 maintains a software forwarding table 1, the hardware chip 2021 maintains a hardware forwarding table 2, the processor 2022 maintains a software forwarding table 2, the hardware chip 2031 maintains a hardware forwarding table 3, the processor 2032 maintains a software forwarding table 3, the hardware chip 2041 maintains a hardware forwarding table 4, and the processor 2042 maintains a software forwarding table 4.
In the application scenario, referring to fig. 3, the MAC entry processing method may include:
in step 301, the hardware chip 2011 records the MAC entry 1 in the hardware forwarding table 1.
Specifically, after the hardware chip 2011 receives the data packet 1, source MAC learning and destination MAC lookup may be performed, which is not described again, and source MAC learning is described below.
For the source MAC learning, the hardware chip 2011 determines whether an MAC entry corresponding to the source MAC address of the data packet 1 exists in the hardware forwarding table 1; if so, ending the source MAC learning; if not, the MAC entry (subsequently, taking the MAC entry 1 as an example) may be learned, and the MAC entry 1 is recorded in the hardware forwarding table 1, where the MAC entry 1 includes a corresponding relationship between a source MAC address of the data packet 1 and an ingress interface (taking the aggregation port R as an example in this application scenario) of the data packet 1. Certainly, the MAC entry 1 may also include information such as a VPN (Virtual Private Network), which is not limited to this.
In step 302, the processor 2012 learns the MAC entry 1 from the hardware forwarding table 1, records the MAC entry 1 in the software forwarding table 1, and determines the exit type of the MAC entry 1.
In step 303, if the exit type of the MAC entry 1 is a global port or an equivalent port, the processor 2012 sets a hit flag (e.g., an IsHit flag) for the MAC entry 1 in the hardware forwarding table 1, and sets an aging flag (e.g., an isagnedel flag) and a deadline flag (e.g., an IsSoftAge flag) for the MAC entry 1 in the software forwarding table 1. If the exit type of the MAC entry 1 is not a global port or an equivalent port, the processing is performed in a conventional manner, for example, the processor 2012 sets an aging flag for the MAC entry 1 in the hardware forwarding table 1, which is not described again.
When processor 2012 sets a hit flag for MAC table entry 1 in hardware forwarding table 1, the initial value of the hit flag may be a second flag (e.g., 0), which is shown in table 1 and is an example of hardware forwarding table 1. When processor 2012 sets an aging flag for MAC table entry 1 in software forwarding table 1, the initial value of the aging flag may be a first flag (e.g., 0); when the deadline marker is set in the software forwarding table 1 for the MAC table entry 1, the deadline marker may be W, which is shown in table 2 and is an example of the software forwarding table 1.
TABLE 1
MAC address Outlet interface Hit tag
Source MAC address of data message 1 Polymerization port R Second label
TABLE 2
MAC address Outlet interface Aging mark Deadline token
Source MAC address of data message 1 Polymerization port R First mark W
In an example, after the processor 2012 sets a hit flag for the MAC entry 1, the hardware chip 2011 determines a value of the hit flag each time the hardware chip 2011 receives a data packet matched with the MAC entry 1, that is, a source MAC address of the data packet is matched with the MAC entry 1, and if the hit flag is the second identifier, the hit flag of the MAC entry 1 is modified to a fourth identifier (for example, 1), which is shown in table 3 and is an example of the modified hardware forwarding table 1. If the hit tag is the fourth tag, the hit tag is kept unchanged.
TABLE 3
MAC address Outlet interface Hit tag
Source MAC address of data message 1 Polymerization port R Fourth mark
In step 304, processor 2012 synchronizes MAC table entry 1 to processor 2022, processor 2032, and processor 2042. For example, processor 2012 may send a MAC synchronization message in a broadcast manner to synchronize MAC table entry 1 to processor 2022, processor 2032, and processor 2042 via the MAC synchronization message.
Further, the processor 2022 may record the MAC table entry 1 in the software forwarding table 2 and record the MAC table entry 1 in the hardware forwarding table 2 after receiving the MAC synchronization message. Then, the processor 2022 determines the exit type of the MAC entry 1, and if the exit type of the MAC entry 1 is a global port or an equivalent port, sets a hit flag for the MAC entry 1 in the hardware forwarding table 2, and sets an aging flag and a deadline flag for the MAC entry 1 in the software forwarding table 2, which is specifically implemented in reference to the processor 2012.
After processor 2032 receives the MAC synchronization message, refer to processor 2022 for specific implementation, and after processor 2042 receives the MAC synchronization message, refer to processor 2022 for specific implementation, which is not described herein again.
In step 305, when the aging timer times out, the processor 2012 obtains all MAC table entries having a deadline marker (e.g., W) from the software forwarding table 1, and performs the following steps for each obtained MAC table entry. In addition, for the MAC entry without the deadline flag, a conventional manner is adopted, which is not described herein again.
Specifically, processor 2012 may set an aging timer for all MAC entries in software forwarding table 1. When the aging timer times out, the processor 2012 obtains all MAC entries with the deadline tag from the software forwarding table 1, and re-counts the aging timer, and when the aging timer times out, the step 305 is executed again, and so on, and the step 305 is executed each time the aging timer times out.
In step 306, for each obtained MAC entry (e.g., MAC entry 1), the processor 2012 reads a hit flag (e.g., the second identifier or the fourth identifier) of the MAC entry 1 from the hardware forwarding table 1, and reads an aging flag (e.g., the first identifier or the third identifier) of the MAC entry 1 from the software forwarding table 1.
In step 307, the processor 2012 processes the MAC entry 1 according to the hit flag and the aging flag.
The hit flag of the MAC entry 1 is the second identifier or the fourth identifier, the aging flag of the MAC entry 1 is the first identifier or the third identifier, and based on the hit flag and the aging flag, the following cases may be included:
in case one, if the aging flag of the MAC entry 1 is a first flag, and the hit flag of the MAC entry 1 is a second flag (indicating that the hardware chip 2011 does not receive the data packet matching the MAC entry 1 in the current statistical cycle), the processor 2012 adjusts the aging flag of the MAC entry 1 to be a third flag.
For example, if the hardware forwarding table 1 is shown in table 1, and the software forwarding table 1 is shown in table 2, the aging flag of the MAC table entry 1 is a first identifier, and the hit flag of the MAC table entry 1 is a second identifier, so the processor 2012 may adjust the aging flag of the MAC table entry 1 to a third identifier, and keep the hit flag of the MAC table entry 1 as the second identifier, as shown in table 4, which is an example of the modified software forwarding table 1.
TABLE 4
MAC address Outlet interface Aging mark Deadline token
Source MAC address of data message 1 Polymerization port R Third label W
In case two, if the aging flag of the MAC entry 1 is the first flag, and the hit flag of the MAC entry 1 is the fourth flag (indicating that the hardware chip 2011 receives the data packet matching the MAC entry 1 in the current statistical cycle), the processor 2012 adjusts the hit flag of the MAC entry 1 to the second flag.
For example, if the hardware forwarding table 1 is shown in table 3, and the software forwarding table 1 is shown in table 2, the aging flag of the MAC table entry 1 is a first identifier, and the hit flag of the MAC table entry 1 is a fourth identifier, so the processor 2012 may adjust the hit flag of the MAC table entry 1 to a second identifier, and keep the aging flag of the MAC table entry 1 as the first identifier, as shown in table 1, which is an example of the modified hardware forwarding table 1.
Further, processor 2012 may send a synchronization refresh message for MAC table entry 1 to processor 2022, processor 2032, and processor 2042. After receiving the synchronous refresh message, the processor 2022 may determine, from the software forwarding table 2, the MAC table entry 1 corresponding to the synchronous refresh message, and set the aging flag of the MAC table entry 1 to the first identifier. For example, if the aging flag of the MAC entry 1 is the first flag, the processor 2022 keeps the aging flag of the MAC entry 1 unchanged; if the aging flag of the MAC entry 1 is the third flag, the processor 2022 modifies the aging flag of the MAC entry 1 to the first flag.
In an example, after receiving the synchronous refresh message, the processor 2022 may further determine whether a MAC table entry 1 corresponding to the synchronous refresh message exists in the software forwarding table 2. If so, the processor 2022 sets the aging flag of the MAC table entry 1 to the first flag. If the synchronous refreshing message does not exist, the processor 2022 adds the MAC table entry 1 in the software forwarding table 2 according to the synchronous refreshing message, and adds the MAC table entry 1 in the hardware forwarding table 2 according to the synchronous refreshing message; then, the processor 2022 may set a hit flag for the MAC entry 1 in the hardware forwarding table 2, set an aging flag and a deadline flag for the MAC entry 1 in the software forwarding table 2, set the hit flag to the second identifier, and set the aging flag to the first identifier.
After receiving the synchronous refresh message, processor 2032 specifically implements processor 2022, and after receiving the synchronous refresh message, processor 2042 specifically implements processor 2022, which is not described herein again.
In case three, if the aging flag of the MAC entry 1 is the third flag (indicating that the hardware chip 2011 has not received the data packet matching the MAC entry 1 in the previous statistical period), and the hit flag of the MAC entry 1 is the second flag (indicating that the hardware chip 2011 has not received the data packet matching the MAC entry 1 in the current statistical period), the processor 2012 may delete the MAC entry 1 from the hardware forwarding table 1, and delete the MAC entry 1 from the software forwarding table 1, that is, delete the MAC entry 1.
For example, if the hardware forwarding table 1 is shown in table 1 and the software forwarding table 1 is shown in table 4, the aging flag of the MAC table entry 1 is a third identifier, and the hit flag of the MAC table entry 1 is a second identifier, so that the processor 2012 may delete the MAC table entry 1 from the hardware forwarding table 1 and the software forwarding table 1.
In case four, if the aging flag of the MAC entry 1 is the third flag (indicating that the hardware chip 2011 has not received the data packet matching the MAC entry 1 in the previous statistical period), and the hit flag of the MAC entry 1 is the fourth flag (indicating that the hardware chip 2011 has received the data packet matching the MAC entry 1 in the current statistical period), the processor 2012 may adjust the aging flag of the MAC entry 1 to the first flag (indicating that the hardware chip 2011 has received the data packet matching the MAC entry 1 in the previous statistical period), and may adjust the hit flag of the MAC entry 1 to the second flag.
For example, if the hardware forwarding table 1 is shown in table 3, and the software forwarding table 1 is shown in table 4, the aging flag of the MAC table entry 1 is a third identifier, and the hit flag of the MAC table entry 1 is a fourth identifier, so that the processor 2012 adjusts the hit flag of the MAC table entry 1 to the second identifier, and adjusts the aging flag of the MAC table entry 1 to the first identifier, see the hardware forwarding table 1 shown in table 1 and the software forwarding table 1 shown in table 2.
Further, processor 2012 may send a synchronization refresh message for MAC table entry 1 to processor 2022, processor 2032, and processor 2042. After receiving the synchronous refresh message, the processor 2022 may determine, from the software forwarding table 2, the MAC table entry 1 corresponding to the synchronous refresh message, and set the aging flag of the MAC table entry 1 to the first identifier. For example, if the aging flag of the MAC entry 1 is the first flag, the processor 2022 keeps the aging flag of the MAC entry 1 unchanged; if the aging flag of the MAC entry 1 is the third flag, the processor 2022 modifies the aging flag of the MAC entry 1 to the first flag.
After receiving the synchronous refresh message, processor 2032 specifically implements processor 2022, and after receiving the synchronous refresh message, processor 2042 specifically implements processor 2022, which is not described herein again.
In an example, the processor 2022 may also set an aging timer, and when the aging timer times out, the processor 2022 obtains all MAC table entries with deadline markers from the software forwarding table 2, which is implemented similarly to the processor 2012 and is not described herein again. Similarly, processor 2032 and processor 2042 may also set an aging timer, which is similar to processor 2012 in implementation and will not be described herein again.
As can be seen from the foregoing technical solution, for the MAC entry 1, if the hardware chip 2011 does not receive the data packet matching the MAC entry 1 in a certain statistical period, the processor 2012 may set the aging flag to be the third identifier; in the next statistical period, if the hardware chip 2011 still does not receive the data packet matching the MAC entry 1, the processor 2012 may delete the MAC entry 1, so that the MAC entry 1 may be correctly deleted. Moreover, for the processor 2022, the processor 2032 and the processor 2042, the MAC table entry 1 may also be deleted in the above manner, instead of the processor 2012 notifying the processors to delete the MAC table entry 1, so that the MAC table entry 1 can be correctly deleted.
In an example, after the hardware chip 2021 receives the data packet, source MAC learning and destination MAC searching may be performed, and for the source MAC learning, the hardware chip 2021 determines whether an MAC entry corresponding to a source MAC address of the data packet exists in the hardware forwarding table 2; if the MAC table item 1 corresponding to the source MAC address of the data message exists, the source MAC learning is finished, and the MAC table item 1 does not need to be learned again.
Based on the same application concept as the method described above, an embodiment of the present application further provides a communication device, where the communication device includes a first service board, and the first service board includes a first hardware chip and a first processor, where:
the first processor is used for determining the exit type of the MAC table item when the MAC table item is learned; if the exit type is a global port or an equivalent port, setting a hit mark for the MAC table entry in a first hardware forwarding table, and setting an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark;
the first processor is further used for reading the aging mark and the hit mark in each processing cycle; if the aging mark is a first mark and the hit mark is a second mark, adjusting the aging mark of the MAC table entry to a third mark; and if the aging mark is a third mark and the hit mark is a second mark, deleting the MAC table entry from the first hardware forwarding table and the first software forwarding table.
In an example, the first processor is further configured to adjust a hit flag of the MAC entry to a second flag when the aging flag is a first flag and the hit flag is a fourth flag;
the first hardware chip is configured to set a hit flag of the MAC entry as a fourth identifier when receiving the data packet matching the MAC entry.
In an example, the first processor is further configured to, when the aging flag is a third flag and the hit flag is a fourth flag, adjust the aging flag of the MAC entry to the first flag and adjust the hit flag of the MAC entry to the second flag;
the first hardware chip is configured to set a hit flag of the MAC entry as a fourth identifier when receiving the data packet matching the MAC entry.
In one example, the communications device further comprises a second service board comprising a second processor; the first processor is further configured to send a synchronous refresh message for the MAC table entry to the second processor when the hit flag is a fourth identifier;
and the second processor is configured to determine, from a second software forwarding table, an MAC table entry corresponding to the synchronous refresh message, and set an aging flag of the MAC table entry as a first identifier.
In one example, the first processor is further configured to set a deadline marker for the MAC entry in a first software forwarding table if the egress type is a global port or an equivalent port;
the first processor, in each processing cycle, when reading the aging tag and the hit tag, is specifically configured to: setting an aging timer, and acquiring all MAC table entries with deadline marks from the first software forwarding table when the aging timer is overtime; and for each acquired MAC table entry, reading the aging mark of the MAC table entry from the first software forwarding table, and reading the hit mark of the MAC table entry from the first hardware forwarding table.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A MAC table item processing method is applied to a first service board of a communication device, wherein the first service board comprises a first hardware chip and a first processor, and the method comprises the following steps:
when the first processor learns the MAC table item, determining the exit type of the MAC table item;
if the exit type is a global port or an equivalent port, the first processor sets a hit mark for the MAC table entry in a first hardware forwarding table, and sets an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark;
at each processing cycle, the first processor reading the aging tag and the hit tag;
if the aging mark is a first mark and the hit mark is a second mark, the first processor adjusts the aging mark of the MAC table entry into a third mark;
if the aging mark is a third mark and the hit mark is a second mark, the first processor deletes the MAC table entry from the first hardware forwarding table and the first software forwarding table respectively;
when the aging mark is a first mark, the aging mark indicates that the first hardware chip has received a data message matched with the MAC table entry in the last statistical period; when the hit mark is a second mark, the first hardware chip does not receive the data message matched with the MAC table item in the current statistical period; and when the aging mark is a third mark, the aging mark indicates that the first hardware chip does not receive the data message matched with the MAC table entry in the last statistical period.
2. The method of claim 1,
after the first processor reads the aging tag and the hit tag, the method further comprises:
if the aging mark is a first mark and the hit mark is a fourth mark, the first processor adjusts the hit mark of the MAC table entry into a second mark;
when the first hardware chip receives the data message matched with the MAC table item, the hit mark of the MAC table item is set as a fourth identifier;
and when the hit mark is a fourth mark, the first hardware chip receives the data message matched with the MAC table entry in the current statistical period.
3. The method of claim 1,
after the first processor reads the aging tag and the hit tag, the method further comprises:
if the aging mark is a third mark and the hit mark is a fourth mark, the first processor adjusts the aging mark of the MAC table entry into a first mark and adjusts the hit mark of the MAC table entry into a second mark; and when the first hardware chip receives the data message matched with the MAC table item, setting a hit mark of the MAC table item as a fourth identifier.
4. The method of claim 2 or 3, wherein the communication device further comprises a second service board, wherein the second service board comprises a second processor, and wherein the method further comprises:
if the hit mark is a fourth mark, the first processor sends a synchronous refresh message aiming at the MAC table entry to the second processor, so that the second processor determines the MAC table entry corresponding to the synchronous refresh message from a second software forwarding table, and sets an aging mark of the MAC table entry as the first mark.
5. The method of claim 1,
the method further comprises the following steps: when the exit type is a global port or an equivalent port, the first processor sets a deadline marker for the MAC table entry in a first software forwarding table;
said at each processing cycle, said first processor reading said aging tag and said hit tag, comprising: the first processor sets an aging timer, and when the aging timer is overtime, all MAC table entries with deadline marks are acquired from the first software forwarding table; and for each acquired MAC table entry, the first processor reads the aging mark of the MAC table entry from the first software forwarding table and reads the hit mark of the MAC table entry from the first hardware forwarding table.
6. A communication device, comprising a first service board comprising a first hardware chip and a first processor, wherein:
the first processor is used for determining the exit type of the MAC table item when the MAC table item is learned; if the exit type is a global port or an equivalent port, setting a hit mark for the MAC table entry in a first hardware forwarding table, and setting an aging mark for the MAC table entry in a first software forwarding table; the initial value of the aging mark is a first mark, and the initial value of the hit mark is a second mark;
the first processor is further used for reading the aging mark and the hit mark in each processing cycle; if the aging mark is a first mark and the hit mark is a second mark, adjusting the aging mark of the MAC table entry to a third mark; if the aging mark is a third mark and the hit mark is a second mark, deleting the MAC table entry from a first hardware forwarding table and a first software forwarding table;
when the aging mark is a first mark, the aging mark indicates that the first hardware chip has received a data message matched with the MAC table entry in the last statistical period; when the hit mark is a second mark, the first hardware chip does not receive the data message matched with the MAC table item in the current statistical period; and when the aging mark is a third mark, the aging mark indicates that the first hardware chip does not receive the data message matched with the MAC table entry in the last statistical period.
7. The communication device of claim 6,
the first processor is further configured to adjust the hit flag of the MAC entry to a second flag when the aging flag is a first flag and the hit flag is a fourth flag;
the first hardware chip is configured to set a hit flag of the MAC entry as a fourth identifier when receiving the data packet matching the MAC entry;
and when the hit mark is a fourth mark, the first hardware chip receives the data message matched with the MAC table entry in the current statistical period.
8. The communication device of claim 6,
the first processor is further configured to adjust the aging flag of the MAC entry to a first flag and adjust the hit flag of the MAC entry to a second flag when the aging flag is a third flag and the hit flag is a fourth flag;
the first hardware chip is configured to set a hit flag of the MAC entry as a fourth identifier when receiving the data packet matching the MAC entry.
9. The communication device of claim 7 or 8, further comprising a second service board, the second service board comprising a second processor;
the first processor is further configured to send a synchronous refresh message for the MAC table entry to the second processor when the hit flag is a fourth identifier;
and the second processor is configured to determine, from a second software forwarding table, an MAC table entry corresponding to the synchronous refresh message, and set an aging flag of the MAC table entry as a first identifier.
10. The communication device of claim 6,
the first processor is further configured to set a deadline marker for the MAC entry in a first software forwarding table when the egress type is a global port or an equivalent port;
the first processor, in each processing cycle, when reading the aging tag and the hit tag, is specifically configured to: setting an aging timer, and acquiring all MAC table entries with deadline marks from the first software forwarding table when the aging timer is overtime; and for each acquired MAC table entry, reading the aging mark of the MAC table entry from the first software forwarding table, and reading the hit mark of the MAC table entry from the first hardware forwarding table.
CN201811435601.XA 2018-11-28 2018-11-28 MAC table item processing method and equipment Active CN109413225B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811435601.XA CN109413225B (en) 2018-11-28 2018-11-28 MAC table item processing method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811435601.XA CN109413225B (en) 2018-11-28 2018-11-28 MAC table item processing method and equipment

Publications (2)

Publication Number Publication Date
CN109413225A CN109413225A (en) 2019-03-01
CN109413225B true CN109413225B (en) 2021-11-02

Family

ID=65456116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811435601.XA Active CN109413225B (en) 2018-11-28 2018-11-28 MAC table item processing method and equipment

Country Status (1)

Country Link
CN (1) CN109413225B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109802872B (en) * 2019-03-19 2021-07-30 北京信而泰科技股份有限公司 Message capturing method, device and equipment
CN111355823B (en) * 2020-02-17 2023-04-07 杭州迪普科技股份有限公司 Aging processing method and device for MAC address table entry

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1976195B1 (en) * 2007-03-30 2014-05-07 Alcatel-Lucent Method and apparatus for Mac address learning
US8667177B2 (en) * 2010-04-28 2014-03-04 Juniper Networks, Inc. Interface grouping for media access control address pinning in a layer two network
CN105591923B (en) * 2015-10-28 2018-11-27 新华三技术有限公司 A kind of storage method and device of forwarding-table item
CN107666445B (en) * 2016-07-29 2021-09-07 中兴通讯股份有限公司 Distributed system MAC address processing method and device
CN107770076B (en) * 2016-08-23 2020-12-04 中兴通讯股份有限公司 Hash collision processing method and device and switching equipment

Also Published As

Publication number Publication date
CN109413225A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN108848034B (en) Network equipment and table entry learning method
CN107547391B (en) Message transmission method and device
CN108259347B (en) Message transmission method and device
CN108259346B (en) Equivalent routing table item establishing method and device
CN105786451A (en) Method, device and system for processing complicated event
CN108809836A (en) Multicast data packet forwarding method and device
CN108259218B (en) IP address allocation method and device
CN108600109B (en) Message forwarding method and device
CN109413225B (en) MAC table item processing method and equipment
EP3451592A1 (en) Packet transmission
CN108390954B (en) Message transmission method and device
US11240115B2 (en) Network topology display method and network management device
CN109032533B (en) Data storage method, device and equipment
CN106709066B (en) Data synchronization method and device
CN107547346B (en) Message transmission method and device
CN105208060A (en) Service data synchronization method, service data synchronization device and service data synchronization system
EP3544251A1 (en) Resource scheduling method
CN107547400B (en) Virtual machine migration method and device
US10374899B2 (en) Method and device for reporting OpenFLow switch capability
CN110768917A (en) Message transmission method and device
US9596131B2 (en) Method for transiting operation mode of routing processor
CN108259214B (en) Configuration command management method, device and machine-readable storage medium
CN107046503B (en) Message transmission method, system and device
CN106059810B (en) Message notification method and system
CN105939242B (en) Realize the method and device of virtual system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant