CN115334046B - MAC address deleting method and device - Google Patents

MAC address deleting method and device Download PDF

Info

Publication number
CN115334046B
CN115334046B CN202210780240.2A CN202210780240A CN115334046B CN 115334046 B CN115334046 B CN 115334046B CN 202210780240 A CN202210780240 A CN 202210780240A CN 115334046 B CN115334046 B CN 115334046B
Authority
CN
China
Prior art keywords
port
state
mac address
switch
tcam
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
CN202210780240.2A
Other languages
Chinese (zh)
Other versions
CN115334046A (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.)
XFusion Digital Technologies Co Ltd
Original Assignee
XFusion Digital 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 XFusion Digital Technologies Co Ltd filed Critical XFusion Digital Technologies Co Ltd
Priority to CN202210780240.2A priority Critical patent/CN115334046B/en
Publication of CN115334046A publication Critical patent/CN115334046A/en
Application granted granted Critical
Publication of CN115334046B publication Critical patent/CN115334046B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/25Routing or path finding in a switch fabric
    • H04L49/253Routing or path finding in a switch fabric using establishment or release of connections between ports

Abstract

The embodiment of the application discloses a method and a device for deleting an MAC address. The MAC address deleting method comprises the following steps: the switching equipment monitors whether the state of the first port is changed from an UP state to a DOWN state; wherein the UP state indicates that the first port is in a normal running state, and the DOWN state indicates that the first port is in a fault state; and if the state of the first port is changed from the UP state to the DOWN state, the switching equipment deletes the first MAC address which is stored in the TCAM and is associated with the first port. The MAC address deleting method provided by the embodiment of the application is beneficial to improving the deleting efficiency of the MAC address.

Description

MAC address deleting method and device
Technical Field
The embodiment of the application relates to the technical field of communication, in particular to a method and a device for deleting an MAC address.
Background
In the field of communications, the basic mode of processing messages by switching devices is based on learning of source MAC addresses (Media Access Control Address) and forwarding of destination MAC addresses. When the switching equipment receives a message from a certain port, the source MAC address in the message is read first, and then the table entry corresponding to the source MAC address is searched in the MAC table. If the source MAC address of the message is not in the MAC table, the source MAC address and the source port of the received message are recorded in the MAC table, which may be referred to as MAC learning. And the switching equipment reads the target MAC address in the message and searches a table entry corresponding to the target MAC address in an MAC table. If the port corresponding to the destination MAC address is found, the switching equipment sends the message out of the port.
Before forwarding the message, if the switching device detects that the link to be forwarded has a fault, for example, a port of the switching device or a port of a message receiving side has a fault, in order to prevent the message forwarded through the faulty line from being discarded, the switching device may send a deletion command to delete the MAC entry in the MAC table learned by the port, which may be referred to as MAC deletion. And after the exchange equipment relearns the MAC address, switching ports to forward the message.
In the above message forwarding process, the inventor finds that the number of learned MAC entries under a certain port of the switching device is up to several thousand, and when deleting the MAC address corresponding to the certain port, a large number of table entries may take a long time to query, and the deleting time of the MAC address may be longer.
Disclosure of Invention
The embodiment of the application provides a method and a device for deleting an MAC address, which can improve the efficiency of inquiring the MAC address corresponding to a fault port by switching equipment, thereby improving the deleting efficiency of the MAC address.
In a first aspect, the present application provides a method for deleting a MAC address, where the method is applied to a switching device, where the switching device includes a plurality of ports, a ternary content addressable memory (Ternary Content Addressable Memory, TCAM) and a Static Random Access Memory (SRAM), and the MAC address is stored in the TCAM or the SRAM;
the method comprises the following steps:
the switching device monitors whether the state of at least one port of the plurality of ports changes from an UP state to a DOWN state; wherein the UP state indicates that the at least one port is in a normal operating state and the DOWN state indicates that the at least one port is in a fault state;
the switching device determining whether at least one of the plurality of ports is a protection port;
if the state of the at least one port is changed from the UP state to the DOWN state, the at least one port is a protection port, and the switching equipment deletes the MAC address which is stored in the TCAM and is associated with the protection port;
and if the state of the at least one port is changed from the UP state to the DOWN state, the at least one port is a non-protection port, and the switching equipment deletes the MAC address which is stored in the SRAM and is associated with the non-protection port.
The data stored in the TCAM may be found by a hardware search method. When the hardware searching method is used for searching, all data in the TCMA can be searched at the same time, the searching speed is not influenced by the size of the data stored in the TCMA, and one-time searching can be completed in one clock period. The data stored in the SRAM can be searched by a software searching method, when the software searching method is used for searching, a binary sequence searching method can be used, the searching speed is influenced by the data quantity stored in the SRAM, and one search is completed in a plurality of clock cycles.
By adopting the technical scheme, on one hand, the hardware inquiry method based on the TCAM improves the inquiry efficiency of the MAC address on the protection port; on the other hand, the SRAM is used for storing the MAC addresses learned by the unprotected ports, the number of the MAC addresses is relatively reduced, the query efficiency of the second MAC table is improved to a certain extent, and the efficiency of deleting the MAC addresses by the switching equipment can be improved.
It can be appreciated that in the above technical solution, the switching device monitors whether the state of at least one port of the plurality of ports is changed from the UP state to the DOWN state and the switching device determines whether the at least one port is a protection port in no order. For example, the switching device may first monitor whether the state of at least one of the plurality of ports is changed from the UP state to the DOWN state, and then determine whether the at least one of the plurality of ports is a protection port. The switching device may also determine whether at least one of the plurality of ports is a protection port and then monitor whether the state of the at least one of the plurality of ports changes from the UP state to the DOWN state.
In a second aspect, the present application provides a method for deleting a MAC address, where the method is applied to a switching device, where the switching device includes a first port and a ternary content addressable memory TCAM, a first MAC address is stored in the TCAM, and the first MAC address is associated with the first port;
the method comprises the following steps:
the switching equipment monitors whether the state of the first port is changed from an UP state to a DOWN state; wherein the UP state indicates that the first port is in a normal running state, and the DOWN state indicates that the first port is in a fault state;
and if the state of the first port is changed from the UP state to the DOWN state, the switching equipment deletes the first MAC address which is stored in the TCAM and is associated with the first port.
According to the technical scheme, the data stored in the TCAM can be searched by a hardware searching method. When the hardware searching method is used for searching, all data in the TCMA can be searched at the same time, the searching speed is not influenced by the size of the data stored in the TCMA, and one-time searching can be completed in one clock period, so that the switching equipment can be improved to search the first MAC address associated with the first port, and the switching equipment can be improved to delete the first MAC address associated with the first port.
In one implementation, the first port is a protection port.
In one implementation, the switching device further includes an SRAM, where a second MAC address is stored, where the second MAC address is associated with the second port, and the method further includes:
the switching equipment monitors whether the state of the second port is changed from an UP state to a DOWN state; wherein the UP state indicates that the second port is in a normal operating state, and the DOWN state indicates that the second port is in a fault state;
and if the state of the second port is changed from the UP state to the DOWN state, the switching equipment deletes the second MAC address which is stored in the SRAM and is associated with the second port.
Wherein the second port may be a non-protection port.
In a third aspect, the present application provides a switching device, where the switching device includes a first port, a ternary content addressable memory TCAM, and a processor; wherein the processor is coupled with the first port and the TCAM;
the TCAM is used for storing a first MAC address, and the first MAC address is associated with the first port;
the processor is configured to:
monitoring whether the state of the first port is changed from an UP state to a DOWN state; wherein the UP state indicates that the first port is in a normal running state, and the DOWN state indicates that the first port is in a fault state;
and deleting the first MAC address which is stored in the TCAM and is associated with the first port if the state of the first port is changed from the UP state to the DOWN state. In one implementation, the first port is a protection port.
In one implementation, the device further includes an SRAM and a second port, the SRAM to hold a second MAC address, the second MAC address associated with the second port, the processor coupled with the second port;
the processor is further configured to:
monitoring whether the state of the second port is changed from an UP state to a DOWN state; wherein the UP state indicates that the second port is in a normal operating state, and the DOWN state indicates that the second port is in a fault state; and deleting the second MAC address which is stored in the SRAM and is associated with the second port if the state of the second port is changed from the UP state to the DOWN state.
Wherein the second port is a non-protection port.
It can be seen that the learned MAC address on the protected port can be saved in TCAM and the learned MAC address on the unprotected port can be saved in SRAM. Therefore, the number of the MAC addresses stored in the SRAM is relatively reduced, and the query efficiency of the MAC addresses in the SRAM can be improved. And further, the deleting efficiency of the MAC address of the unprotected port of the switching equipment is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application.
FIG. 1 is a schematic diagram of a communication network in accordance with an embodiment of the present application;
FIG. 2 is a switch fabric intent of an embodiment of the present application;
FIG. 3 is another structural intent of a switch in accordance with an embodiment of the present application;
fig. 4 is a schematic diagram of deleting a MAC address according to an embodiment of the present application;
fig. 5 is a schematic diagram of another MAC address deletion provided in an embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will clearly explain the technical solutions in the embodiments of the present application by referring to the drawings in the embodiments of the present application.
In the embodiment of the application, the words of the terms of the first word, the second word and the like do not have a logical or time sequence dependency relationship, and the number and the execution sequence are not limited. It will be further understood that, although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another element.
The meaning of the term "at least one" in embodiments of the present application means one or more, and the meaning of the term "plurality" in embodiments of the present application means two or more.
It should also be understood that the term "if" may be interpreted as "when … …" ("white" or "upon") or "in response to a determination" or "in response to detection". Similarly, the phrase "if a [ stated condition or event ] is detected" may be interpreted as "when a [ stated condition or event ] is determined" or "in response to a determination" or "when a [ stated condition or event ] is detected" or "in response to a detection of a [ stated condition or event ] depending on the context.
Referring to fig. 1, a schematic diagram of a communication network according to an embodiment of the present application is shown. The communication network includes switching devices, the internet, and servers. Specifically, the switching device includes a switch a and a switch B. The switch a includes port 1, port 2, and port 3. The switch B includes port 4, port 5 and port 6. The switch a communicates with the internet through port 1. For example, the internet side may be provided with a network device, and the switch a may communicate with the network device of the internet side through the port 1. The switch B communicates with the internet through port 4. The switch B may communicate with the network device on the internet side through port 4. The switch a communicates with the switch B through ports 2 and 5. The switch a communicates with the server through port 3. The switch B communicates with the server via port 6.
It will be appreciated that the switch in this embodiment may be a network device such as a connected computer. The switch is a network device for electrical signal forwarding. It can provide an unshared electrical signal path for any two network nodes of the access switch. The most common switch is an ethernet switch. The embodiment of the present application is not limited thereto.
In the existing scheme, the switch forwards the message through the learned MAC address, so that communication between network devices is realized. The inventor finds that the number of the learned MAC entries at a certain port of the switch is up to thousands, and the entries are all stored in the SRAM, and because the SRAM is searched in a binary sequence, a large number of table entries can take longer time to search when the MAC addresses are learned and deleted, and the deleting time of the MAC addresses can be longer. In order to solve the above problems, the inventor proposes a method and a device for learning and deleting a MAC address according to an embodiment of the present application.
In one implementation, referring to fig. 2, a schematic diagram of a switch in an embodiment of the present application is shown. The switch may be a schematic of the architecture of switch a. Switch 200 includes a port 210, a ternary content addressable memory (Ternary Content Addressable Memory, TCAM) 220, and a processor 230. As shown in fig. 2, port 210 may be used to forward messages. In addition, port 210 may also be used to connect with external devices to form a link. TCAM 220 is coupled to processor 230. TCAM 220 may be used to maintain a MAC table that may be used to maintain the MAC address learned by port 210.
Wherein port 210 may comprise port 1, port 2, or port 3. For example, port 210 may be port 1 or port 3. As another example, ports 210 may include port 1 and port 2. As another example, ports 210 may include port 1, port 2, and port 3.
In another implementation, referring to fig. 3, the switch further includes SRAM 240.SRAM 240 is coupled to processor 230. The SRAM 240 may also be used to hold a MAC table that is used to hold the MAC address learned by the port 210. The MAC address stored in the SRAM corresponds to a different port from the MAC address stored in the TCAM.
In one implementation, the MAC table may include a MAC address learned by switch a and corresponding port information, which may be a physical port identifier. In another implementation, the MAC table may also include a virtual local area network (virtual local area network, VLAN) Identification (ID).
In the switch 200 described above, the processor 230 may be a general-purpose central processor (central processing unit, CPU), a digital signal processor (digital signal processor, DSP), a network processor (network processer, NP), a graphics processor (Graphics Processing Unit, GPU), a neural-network processor (neural-network processing units, NPU), a data processing unit (Data Processing Unit, DPU), a microprocessor, or one or more integrated circuits for implementing aspects of the present application. For example, the processor includes an application-specific integrated circuit (ASIC), a programmable logic device (programmable logic device, PLD) or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. PLDs are, for example, complex programmable logic devices (complex programmable logic device, CPLD), field-programmable gate arrays (field-programmable gate array, FPGA), general-purpose array logic (generic array logic, GAL), or any combination thereof. Which may implement or perform the various logical blocks, modules, and circuits described in connection with the disclosure of embodiments of the application. The processor may also be a combination that performs the function of a computation, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and so forth.
Processor 230 may be used to generate and manage MAC tables and monitor port status; the above management MAC may be understood that the switch 200 may dynamically add and learn the MAC address to the MAC table or delete the MAC address corresponding to the failed port.
It will be appreciated that the switch 200 may implement the MAC address learning and deletion scheme of the embodiments of the present application described below. Specifically, the processor 230 of the switch 200 may perform the MAC address learning and deletion scheme of the embodiments of the present application described below.
In one implementation, the processor may invoke the program/instructions in memory to implement the MAC address learning and deletion scheme in embodiments of the present application. The Memory may be, but is not limited to, TCAM, SRAM, read-only Memory (ROM) or other type of static storage device that can store static information and instructions, random access Memory (random access Memory, RAM) or other type of dynamic storage device that can store information and instructions, and electrically erasable programmable read-only Memory (electrically erasable programmable read-only Memory, EEPROM), compact disc read-only Memory (compact disc read-only Memory) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by the processor. The memory is, for example, independent and may be connected to the processor. The memory may also be integrated with the processor.
In addition, the processor 210 may also be used for forwarding control, maintaining some software entries (e.g., software routing tables, software ARP (address resolution protocol) tables, etc.).
While switch a is described above as an example, it is to be understood that switch B may have the same or similar structure and function as switch a.
Example 1
The embodiment of the application provides a device for learning and deleting an MAC address. The means for MAC address learning and deletion may be a switch, such as switch a or switch B in fig. 1. The following describes an embodiment of the present application by taking a switch a as an example.
The switch A in the embodiment of the application comprises a port 1, a port 2 and a port 3. Wherein port 3 may act as a protection port. Specifically, the user may configure the port of switch a, for example, the user may configure port 3 of switch a as a protection port.
The configuration of the port 3 by the user may be: based on the type of traffic carried by the server, for example, the server carries important traffic, in order to ensure that the traffic data traffic can be switched rapidly in case of failure of the port 3, the user sets the port 3 as a protection port. In addition, the user may configure the protection port according to the interconnection relationship in the switch network, for example, in the communication network shown in fig. 1, and for the switch a, the user may set the port 2 where the switch a and the switch B are interconnected as the protection port. The user may set a protection port list for saving and managing the protection ports set by the user, as shown in table 1.
Table 1 switch a protects the port list.
The MAC address learning provided by the embodiment of the application can comprise the following two implementation modes:
in one implementation, switch a receives a message sent by a server through port 3. Switch a may record the receiving port as port 3. Switch a may determine port 3 as a protection port based on table 1. And the switch A analyzes the message received by the port 3 to obtain the MAC address of the server. Switch a may look up a first MAC table based on the server's MAC address, which may be stored in the TCAM. If the switch A searches the MAC address of the server in the first MAC table, the acquired MAC address can be discarded; if the switch a does not find the MAC address of the server in the first MAC table, the switch a saves the port 3 and the obtained MAC address of the server in the first MAC table.
It will be appreciated that in this implementation, switch a stores the learned MAC address on the port in the protection port list in the first MAC table.
Switch a may receive a message sent by a network device on the network side through port 1. Switch a may record the receiving port as port 1. Switch a may determine that port 1 is a non-protection port based on table 1. The exchanger A analyzes the message received by the port 1 to obtain the MAC address of the network equipment. Switch a looks up a second MAC table based on the MAC address of the network device, which may be stored in SRAM. If the switch A searches the second MAC table for the MAC address of the network, the acquired MAC address can be discarded. If the switch a does not find the MAC address of the network device in the second MAC table, the switch a stores the port 3 and the obtained MAC address of the network device in the second MAC table.
In this implementation, the lookup of data stored in the TCAM is a hardware lookup. When the hardware searching method is used for searching, all data in the TCMA can be searched at the same time, the searching speed is not influenced by the size of the data stored in the TCMA, and one-time searching can be completed in one clock period. The data stored in the SRAM is searched by a software searching method, when the software searching method is used for searching, a binary sequence searching method is used, the searching speed is influenced by the data quantity stored in the SRAM, one-time searching can be completed in a plurality of clock cycles, and the searching speed is low.
In the embodiment of the application, when the MAC address is learned, the switch A stores the MAC address learned on the protection port in the TCAM, such as a first MAC table which can be stored in the TCAM. When learning other protection ports, the switch a may use a hardware lookup method to find the first MAC table stored in the TCAM, and determine whether the first MAC table stores the learned MAC address.
By adopting the technical scheme, on one hand, the hardware inquiry method based on the TCAM improves the learning efficiency of the MAC address on the protection port; on the other hand, the SRAM is used for storing the MAC addresses learned by the non-protection ports, the number of the MAC addresses is relatively reduced, the query efficiency of the second MAC table is improved to a certain extent, and the learning efficiency of the MAC addresses of the non-protection ports is further improved. Therefore, the embodiment of the application can improve the MAC address learning efficiency of the switch.
In another implementation, switch a receives a message sent by a server through port 3. The switch may record the port receiving the message as port 3. Switch a may determine port 3 as a protection port based on table 1. The switch a parses the packet received by the port 3 to obtain the MAC address and virtual local area network identification (VLAN ID) of the server. The switch A searches a first MAC table based on the MAC address and VLAN ID of the server, and the first MAC table is stored in the TCAM; if the switch A searches the MAC address and VLAN ID of the server in the first MAC table, the acquired MAC address and VLAN ID can be discarded; if the switch A does not find the MAC address and VLAN ID of the server in the first MAC table, the switch A stores the port 3, the MAC address and VLAN ID of the server in the first MAC table.
The switch A receives a message sent by the network device through the port 1. Switch a may record the port receiving the message as port 1. Switch a may determine that port 1 is a non-protection port based on table 1. The switch A analyzes the message received by the port 1 to obtain the MAC address and VLAN ID of the network equipment. The switch A searches a second MAC table based on the MAC address and VLAN ID of the network equipment, and the second MAC table is stored in the SRAM; if the switch A searches the MAC address and VLAN ID of the network in the second MAC table, discarding the acquired MAC address and VLAN ID; if the switch A does not find the MAC address and VLAN ID of the server in the second MAC table, the switch A stores the port 3, the MAC address and VLAN ID of the network device in the second MAC table.
In this implementation, the lookup of data stored in the TCAM is a hardware lookup. When the hardware searching method is used for searching, all data in the TCMA can be searched at the same time, the searching speed is not influenced by the size of the data stored in the TCMA, and one-time searching can be completed in one clock period. The data stored in the SRAM is searched by a software searching method, when the software searching method is used for searching, a binary sequence searching method is used, the searching speed is influenced by the data quantity stored in the SRAM, one-time searching can be completed in a plurality of clock cycles, and the searching speed is low.
In the present embodiment, when the MAC address is learned, the switch a stores the MAC address learned on the protection port in the TCAM, for example, a first MAC table that may be stored in the TCAM. When learning other protection ports, the switch a may search the first MAC table stored in the TCAM by using a hardware search method, and determine whether the first MAC table stores the MAC address of the present learning.
By adopting the technical scheme, on one hand, the hardware inquiry method based on the TCAM improves the learning efficiency of the MAC address on the protection port; on the other hand, the SRAM is used for storing the MAC addresses learned by the non-protection ports, the number of the MAC addresses is relatively reduced, the query efficiency of the second MAC table is improved to a certain extent, and the learning efficiency of the MAC addresses of the non-protection ports is further improved. Therefore, the embodiment of the application can improve the MAC address learning efficiency of the switch.
The deletion of the MAC address provided by the embodiment of the application can comprise the following two implementation modes:
in one implementation, switch a determines whether a port is malfunctioning by listening for the status of the port. For example, after initialization, each port of switch a may be set to an UP state, which may be used to indicate that the port is in a usable state. Switch a may detect the status of each port. If a physical or protocol failure of a port is detected, switch a may set the port state to a DOWN state, which may be used to indicate that the port is in a failed state. When switch a determines that a port state transitions from the UP state to the DOWN state, switch a may delete the MAC address associated with the port in the MAC table.
For example, after initializing the port 1, the port 2, and the port 3, the switch a sets the states of the port 1, the port 2, and the port 3 to the UP state, so that the port 1, the port 2, and the port 3 are in the usable state. If the switch a detects that the port 3 has physical failure, the state of the port 3 is set to the DOWN state. When the switch A determines that the port state of the port 3 is changed from the UP state to the DOWN state, the port 3 is a protection port, and the switch A deletes the MAC address corresponding to the port 3 in the first MAC table stored in the TCAM. In another implementation, if the first MAC table further includes a VLAN ID, the port 3 is a protection port, and the switch a deletes the MAC address and the VLAN ID corresponding to the port 3 in the first MAC table stored in the TCAM.
When switch a detects a physical failure of port 1, the state of port 1 is set to the DOWN state. When the switch A determines that the port state of the port 1 is changed from the UP state to the DOWN state, the port 1 is a non-protection port, and the switch A deletes the MAC address corresponding to the port 1 in the second MAC table stored in the SRAM. In addition, if the second MAC table further includes a VLAN ID, port 1 is a non-protection port, and the switch a deletes the MAC address and the VLAN ID corresponding to port 1 in the second MAC table stored in the SRAM.
In this embodiment, under the condition of the protection port failure, the switch a may search the first MAC table based on the hardware search method of the TCAM, and determine whether the first MAC table stores the MAC address learned this time. By adopting the technical scheme, on one hand, the hardware inquiry method based on TCAM improves inquiry efficiency by concurrent inquiry, and further improves the deletion efficiency of the switch A on the MAC address of the protection port; on the other hand, the SRAM is used for storing the MAC addresses learned by the unprotected ports, and the number of the MAC addresses is relatively reduced. Under the condition of non-protection port faults, the query efficiency of the second MAC table is improved to a certain extent, and the deleting efficiency of the switch A to the non-protection port MAC address is further improved. Therefore, the embodiment of the application can improve the MAC address deleting efficiency of the switch.
In another implementation, the switch a communicates the feedback signal of the peer device through monitoring each port, where the feedback signal is used to indicate whether the communication link corresponding to the port is faulty. When the switch A receives the feedback signal within the preset time, the switch A determines that the communication link corresponding to the port is in a normal state. If the switch A does not receive the feedback signal at a certain port within the preset time, the switch A confirms that the communication link corresponding to the port fails. Switch a deletes the MAC address associated with the port in the MAC table.
For example, switch a listens for feedback signals from the network device, switch B, and server via ports 1, 2, and 3, respectively. If the switch does not receive the feedback signal of the server through the port 3 within the preset time, the switch A determines that the communication link corresponding to the port 3 fails. Based on table 1, the switch a determines that the port 3 is a protection port, deletes the MAC address corresponding to the port 3 in the first MAC table, where the first MAC table is stored in the TCAM. In another implementation, if the first MAC table further includes a VLAN ID, when the switch a determines that the port 3 is a protection port based on table 1, the switch a deletes the MAC address and the VLAN ID corresponding to the port 3 in the first MAC table.
If the switch a does not receive the feedback signal of the network device through the port 1 within the predetermined time, the switch a determines that the communication link corresponding to the port 1 fails. And if the switch A determines that the port 1 is a non-protection port based on the table 1, deleting the MAC address corresponding to the port 1 in a second MAC table, wherein the second MAC table is stored in the SRAM. In another implementation, if the second MAC table further includes a VLAN ID, when the switch a determines that the port 1 is not a protection port according to table 1, the switch a deletes the MAC address and the VLAN ID corresponding to the port 1 in the second MAC table.
In the embodiment of the present application, under the condition that the protection port corresponds to the communication link failure, the switch a may search the first MAC table based on the hardware search method of the TCAM, and determine whether the first MAC table stores the MAC address learned at this time. By adopting the technical scheme, on one hand, the hardware inquiry method based on TCAM improves inquiry efficiency by concurrent inquiry, and further improves the efficiency of deleting the MAC address of the protection port by the switch A; on the other hand, the SRAM is used for storing the MAC addresses learned by the unprotected ports, and the number of the MAC addresses is relatively reduced. Under the condition that the non-protection port corresponds to the communication link fault, the second MAC table query efficiency is improved to a certain extent, and then the efficiency of deleting the MAC address of the non-protection port by the switch A is improved. Therefore, the scheme of the embodiment of the application can improve the MAC address deleting efficiency of the switch.
Another MAC address learning provided in this embodiment may include the following two implementations:
in one implementation, switch a receives a message sent by a server through port 3. Switch a may record the port receiving the message as port 3. And the switch A analyzes the message received by the port 3 to obtain the MAC address of the server. Switch a may look up a MAC table based on the server's MAC address, which may be stored in the TCAM. If the switch A searches the MAC address of the server in the MAC table, the acquired MAC address can be discarded; if the switch a does not find the MAC address of the server in the MAC table, the switch a saves the port 3 and the obtained MAC address of the server in the MAC table.
In another implementation, switch a receives a message sent by a server through port 3. Switch a may record the port receiving the message as port 3. The exchanger A analyzes the message received by the port 3 to obtain the MAC address and VLAN ID of the server. Switch a may look up a MAC table based on the server's MAC address and VLAN, which may be stored in TCAM. If the switch A searches the MAC address and VLAN of the server in the MAC table, the acquired MAC address and VLAN can be discarded; if the switch a does not find the MAC address and VLAN of the server in the MAC table, the switch a saves the port 3 and the obtained MAC address and VLAN of the server in the MAC table.
In the two learning implementations, all data in the TCMA can be queried at the same time, the searching speed is not affected by the size of the data stored in the TCMA, and one searching can be completed in one clock cycle. By adopting the technical scheme, the hardware query method based on the TCAM improves the learning efficiency of the MAC address on the protection port. Therefore, the embodiment of the application can improve the MAC address learning efficiency of the switch.
Another implementation manner of deleting the MAC address provided in this embodiment may include the following two implementation manners:
in one implementation, switch a determines whether a port is malfunctioning by listening for the status of the port. For example, after initialization, each port of switch a may be set to an UP state, which may be used to indicate that the port is in a usable state. Switch a detects the status of each port. If a physical or protocol failure of a port is detected, switch a may set the port state to a DOWN state, which may be used to indicate that the port is in a failed state. When switch a determines that a port state transitions from the UP state to the DOWN state, switch a may delete the MAC address associated with the port in the MAC table.
For example, after initializing the port 1, the port 2, and the port 3, the switch a sets the states of the port 1, the port 2, and the port 3 to the UP state, so that the port 1, the port 2, and the port 3 are in the usable state. If the switch a detects that the port 3 has physical failure, the state of the port 3 is set to the DOWN state. When the switch a determines that the port state of the port 3 is changed from the UP state to the DOWN state, the switch a deletes the MAC address corresponding to the port 3 in the MAC table stored in the TCAM. In another implementation, if the first MAC table further includes a VLAN ID, the switch a deletes the MAC address and VLAN ID corresponding to the port 3 in the MAC table stored in the TCAM.
In another implementation, the switch a communicates the feedback signal of the peer device through monitoring each port, where the feedback signal is used to indicate whether the communication link corresponding to the port is faulty. When the switch A receives the feedback signal within the preset time, the switch A determines that the communication link corresponding to the port is in a normal state. If the switch A does not receive the feedback signal at a certain port within the preset time, the switch A confirms that the communication link corresponding to the port fails. Switch a deletes the MAC address associated with the port in the MAC table.
For example, switch a listens for feedback signals from the network device, switch B, and server via ports 1, 2, and 3, respectively. If the switch does not receive the feedback signal of the server through the port 3 within the preset time, the switch A determines that the communication link corresponding to the port 3 fails. The switch A deletes the MAC address corresponding to the port 3 in the MAC table, and the MAC table is stored in the TCAM. In another implementation, if the MAC table further includes a VLAN ID, the switch a deletes the MAC address and VLAN ID corresponding to the port 3 in the MAC table.
In the above two implementations, the switch a may search the MAC table based on the hardware search method of the TCAM, and determine whether the first MAC table stores the MAC address learned this time. By adopting the technical scheme, the hardware query method based on the TCAM improves the query efficiency by concurrent search, and further improves the deletion efficiency of the switch A on the MAC address of the protection port. Therefore, the embodiment of the application can improve the MAC address deleting efficiency of the switch.
Example two
In combination with the foregoing embodiments and the accompanying drawings, a further embodiment of the present application provides a method for deleting a MAC address. Referring to fig. 4, the method includes:
s110, the switching equipment monitors whether the state of the first port is changed from an UP state to a DOWN state; the UP state indication port is in a normal running state, and the DOWN state indication port is in a fault state;
in one implementation, the first port may be all ports of the switching device. The switching device saves the first MAC address learned by all ports in the TCAM. The switching device then monitors the state changes of all ports to determine if any port failure has occurred.
It will be appreciated that the switching device stores the first MAC address learned by all ports in the TCAM, e.g., the switching device has 3 ports, port 1, port 2 and port 3, respectively. Receiving a message from equipment 1 on a port 1, wherein the learned MAC address is MAC1; receiving a message from the equipment 2 on the port 2, wherein the learned MAC address is MAC2; receiving a message from the equipment 3 on the port 3, wherein the learned MAC address is MAC3; the switching device stores the MAC addresses MAC1, MAC2, and MAC3 learned on the 3 ports in the TCAM.
In another implementation, the first port may be a partial port of the switching device. The switching device saves the learned MAC address on the port of the portion in the TCAM.
The partial port may be a protection port set by a user, for example. The switching device saves the MAC address learned by the protection port in the TCAM. The switching device then monitors the state change of the protection port to determine if the protection port has a port failure.
In both schemes, the switching device may store the MAC address and the first port associated with the MAC address in the TCAM.
And S120, if the state of the first port is changed from the UP state to the DOWN state, the switching equipment deletes the MAC address which is stored in the TCAM and is associated with the first port.
In one implementation, when the first port is all ports of the switching device, the switching device may determine that at least one port fails if the state of the first port changes from the UP state to the DOWN state. In order to ensure that the failed port of the communication data switching device is discarded, the switching device deletes the MAC address associated with the port in the TCAM.
In another implementation scheme, when the first port is a part of ports of the switch device, if the state of the first port is changed from the UP state to the DOWN state, the switch device may determine that at least one port of the part of ports has a fault, and in order to ensure that data does not have a fault port to discard, the switch deletes a MAC address associated with the fault port in the TCAM.
The partial port may be a protection port set by a user, for example. If the switching device monitors that the state of at least one protection port changes from the UP state to the DOWN state, the switching device may determine that the at least one protection port fails. In order to ensure that data is not discarded by at least one failed port, the switching device deletes the MAC address associated with the protection port in the TCAM.
In this embodiment, the switching device may search the MAC table based on the hardware search method of the TCAM, and determine whether the MAC table stores the MAC address learned this time. By adopting the technical scheme, the hardware query method based on the TCAM can improve the query efficiency by concurrent search, and further improve the deletion efficiency of the port MAC address by the switching equipment. Therefore, the present embodiment can improve the MAC address deletion efficiency of the switching device.
In this embodiment, while the first port may be a switch device portion port, the remaining ports of the switch device may be referred to as second ports. The switching device stores the MAC address learned at the second port in SRAM. Referring to fig. 5, the MAC deleting method may further include:
s130, the switching equipment monitors whether the state of the second port is changed from the UP state to the DOWN state;
in one implementation, the second port may be a non-protection port. The switching device stores the unprotected port learned MAC address in SRAM.
And S140, if the state of the second port is changed from the UP state to the DOWN state, the switching equipment deletes the MAC address which is stored in the SRAM and is associated with the second port.
In one implementation, the second port is a non-protection port, and the switching device determines that at least one non-protection port fails if the non-protection port state changes from the UP state to the DOWN state. To ensure that data is not discarded by at least one failed port, the switching device deletes the MAC address associated with the protection non-protection port in the SRAM.
In this embodiment, the MAC address learned by the partial port is stored in the TCAM, and in the case that the communication link corresponding to the partial port fails, the switching device may search the first MAC table based on a hardware search method of the TCAM, to determine whether the first MAC table stores the MAC address learned this time. By adopting the technical scheme, on one hand, the hardware query method based on the TCAM improves the query efficiency by concurrent search, and further improves the deletion efficiency of partial port MAC addresses by the switching equipment; on the other hand, the SRAM is used for storing the MAC addresses learned by the ports of the rest parts, and the number of the MAC addresses is relatively reduced. Under the condition that the ports of the other parts correspond to the communication link faults, the query efficiency of the second MAC table is improved to a certain extent, and then the deleting efficiency of the switching equipment to the MAC addresses of the other ports is improved. Therefore, the scheme of the embodiment of the application can improve the MAC address deleting efficiency of the switch.
In this embodiment, the terms first port and second port are different ports for distinguishing switching devices. The specific number and order of ports, etc. should not be limited by the terms described above.
It should be appreciated that references to "one embodiment," "an embodiment," "one implementation" in an embodiment of the present application mean that a particular feature, structure, or characteristic described in connection with the embodiment or implementation is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment," "one implementation" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
The foregoing description of the embodiments of the application is not intended to limit the application to the particular embodiments of the application disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the application.

Claims (9)

1. A method for deleting a MAC address of a medium access control address, the method being applied to a switching device, the switching device comprising a plurality of ports, a ternary content addressable memory TCAM, and a static random access memory SRAM, characterized in that:
the MAC address is stored in the TCAM or the SRAM;
the method comprises the following steps:
the switching device monitors whether the state of at least one port of the plurality of ports changes from an UP state to a DOWN state; wherein the UP state indicates that the at least one port is in a normal operating state and the DOWN state indicates that the at least one port is in a fault state;
the switching device determining whether at least one of the plurality of ports is a protection port;
if the state of the at least one port is changed from the UP state to the DOWN state, the at least one port is a protection port, and the switching equipment deletes the MAC address which is stored in the TCAM and is associated with the protection port;
and if the state of the at least one port is changed from the UP state to the DOWN state, the at least one port is a non-protection port, and the switching equipment deletes the MAC address which is stored in the SRAM and is associated with the non-protection port.
2. A method for deleting a MAC address, the method being applied to a switching device, the switching device including a first port, a second port, a ternary content addressable memory TCAM, and a static random access memory SRAM, characterized in that:
a first MAC address is stored in the TCAM, and the first MAC address is associated with the first port;
a second MAC address is stored in the SRAM, and the second MAC address is associated with the second port;
the method comprises the following steps:
the switching equipment monitors whether the state of the first port is changed from an UP state to a DOWN state; wherein the UP state indicates that the first port is in a normal running state, and the DOWN state indicates that the first port is in a fault state;
if the state of the first port is changed from the UP state to the DOWN state, the switching device deletes the first MAC address which is stored in the TCAM and is associated with the first port;
the switching equipment monitors whether the state of the second port is changed from an UP state to a DOWN state; wherein the UP state indicates that the second port is in a normal operating state, and the DOWN state indicates that the second port is in a fault state;
and if the state of the second port is changed from the UP state to the DOWN state, the switching equipment deletes the second MAC address which is stored in the SRAM and is associated with the second port.
3. The method of claim 2, wherein the first port is a protection port.
4. A method according to claim 2 or 3, wherein the first MAC address and the first port associated with the first MAC address are stored in the TCAM.
5. A method according to claim 2 or 3, wherein the second port is a non-protection port.
6. A switching device, wherein the switching device comprises a first port, a second port, a ternary content addressable memory TCAM, a static random access memory SRAM, and a processor; wherein the processor is coupled to the first port and the TCAM, the processor being coupled to the second port;
the TCAM is used for storing a first MAC address, and the first MAC address is associated with the first port;
the SRAM is used for storing a second MAC address, and the second MAC address is associated with the second port;
the processor is configured to:
monitoring whether the state of the first port is changed from an UP state to a DOWN state; wherein the UP state indicates that the first port is in a normal running state, and the DOWN state indicates that the first port is in a fault state;
deleting the first MAC address which is stored in the TCAM and is associated with the first port if the state of the first port is changed from an UP state to a DOWN state;
monitoring whether the state of the second port is changed from an UP state to a DOWN state; wherein the UP state indicates that the second port is in a normal operating state, and the DOWN state indicates that the second port is in a fault state; and deleting the second MAC address which is stored in the SRAM and is associated with the second port if the state of the second port is changed from the UP state to the DOWN state.
7. The apparatus of claim 6, wherein the first port is a protection port.
8. The apparatus according to claim 6 or 7, characterized in that: the first MAC address and the first port associated with the first MAC address are stored in the TCAM.
9. The apparatus of claim 6 or 7, wherein the second port is a non-protection port.
CN202210780240.2A 2022-07-04 2022-07-04 MAC address deleting method and device Active CN115334046B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210780240.2A CN115334046B (en) 2022-07-04 2022-07-04 MAC address deleting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210780240.2A CN115334046B (en) 2022-07-04 2022-07-04 MAC address deleting method and device

Publications (2)

Publication Number Publication Date
CN115334046A CN115334046A (en) 2022-11-11
CN115334046B true CN115334046B (en) 2023-09-01

Family

ID=83917105

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210780240.2A Active CN115334046B (en) 2022-07-04 2022-07-04 MAC address deleting method and device

Country Status (1)

Country Link
CN (1) CN115334046B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6393028B1 (en) * 1999-02-25 2002-05-21 Advanced Micro Devices, Inc. Method and apparatus for providing EOF for frame modification
CN1822565A (en) * 2004-10-15 2006-08-23 阿尔卡特公司 Network with MAC table overflow protection
CN101572668A (en) * 2009-05-21 2009-11-04 中兴通讯股份有限公司 Method for deleting MAC addresses and device therefor
CN101834788A (en) * 2010-04-16 2010-09-15 福建星网锐捷网络有限公司 Storage operation method, device and equipment of media access control address table items
CN103731355A (en) * 2013-12-31 2014-04-16 迈普通信技术股份有限公司 Method and system for avoiding Hash collision during MAC address learning
WO2016101488A1 (en) * 2014-12-26 2016-06-30 中兴通讯股份有限公司 Ternary content addressable memory (tcam) table search method and device
CN108199962A (en) * 2017-12-22 2018-06-22 新华三技术有限公司 Address transfer method, apparatus, the network equipment and readable storage medium storing program for executing
WO2022089212A1 (en) * 2020-10-26 2022-05-05 华为技术有限公司 Fault handling method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4918862B2 (en) * 2007-01-05 2012-04-18 富士通株式会社 Link trace frame transfer program, link trace frame transfer apparatus, and link trace frame transfer method
JP6446986B2 (en) * 2014-10-14 2019-01-09 富士通株式会社 Information processing system, control device, control program for control device, and switch device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6393028B1 (en) * 1999-02-25 2002-05-21 Advanced Micro Devices, Inc. Method and apparatus for providing EOF for frame modification
CN1822565A (en) * 2004-10-15 2006-08-23 阿尔卡特公司 Network with MAC table overflow protection
CN101572668A (en) * 2009-05-21 2009-11-04 中兴通讯股份有限公司 Method for deleting MAC addresses and device therefor
CN101834788A (en) * 2010-04-16 2010-09-15 福建星网锐捷网络有限公司 Storage operation method, device and equipment of media access control address table items
CN103731355A (en) * 2013-12-31 2014-04-16 迈普通信技术股份有限公司 Method and system for avoiding Hash collision during MAC address learning
WO2016101488A1 (en) * 2014-12-26 2016-06-30 中兴通讯股份有限公司 Ternary content addressable memory (tcam) table search method and device
CN105791126A (en) * 2014-12-26 2016-07-20 中兴通讯股份有限公司 Ternary content addressable memory (TCAM) table search method and device
CN108199962A (en) * 2017-12-22 2018-06-22 新华三技术有限公司 Address transfer method, apparatus, the network equipment and readable storage medium storing program for executing
WO2022089212A1 (en) * 2020-10-26 2022-05-05 华为技术有限公司 Fault handling method and device

Also Published As

Publication number Publication date
CN115334046A (en) 2022-11-11

Similar Documents

Publication Publication Date Title
US6862287B2 (en) Method and apparatus for a four-way hash table
US7019674B2 (en) Content-based information retrieval architecture
US5815664A (en) Address reporting device and method for detecting authorized and unauthorized addresses in a network environment
US8599858B1 (en) System and method for keep alive message aging
CN111937360B (en) Longest prefix matching
CN105791126B (en) Ternary Content Addressable Memory (TCAM) table look-up method and device
CN108600099B (en) Message forwarding method and device and leaf equipment
CN109981464B (en) TCAM circuit structure realized in FPGA and matching method thereof
JP2021532679A (en) Communication methods, communication equipment, and communication systems
US6337862B1 (en) Network switch with truncated trie look-up facility
US11146476B2 (en) MSDC scaling through on-demand path update
CN115334046B (en) MAC address deleting method and device
US7400623B2 (en) Method and apparatus for managing medium access control (MAC) address
US20030225965A1 (en) Hitless restart of access control module
JPH09321789A (en) Network system with duplexed routers and fault countermeasure method for it
CN103560968A (en) Switch hardware host routing table updating method and device and switch
CN114374637B (en) Routing processing method and device
US20080049612A1 (en) Maintaining filtering database consistency
AT&T
CN111556179A (en) ARP (Address resolution protocol) table item updating method and device
WO2022206397A1 (en) Buffering method and integrated circuit
CN109921948B (en) Fault detection method and device for data plane and gateway equipment
KR100441033B1 (en) Switching database cache management system
TWI739320B (en) Network communication device and operating method for network mapping table
CN114007152B (en) Port convergence processing method and device for optical fiber switch

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