WO2018036457A1 - 一种哈希冲突的处理方法、装置及交换设备和存储介质 - Google Patents

一种哈希冲突的处理方法、装置及交换设备和存储介质 Download PDF

Info

Publication number
WO2018036457A1
WO2018036457A1 PCT/CN2017/098328 CN2017098328W WO2018036457A1 WO 2018036457 A1 WO2018036457 A1 WO 2018036457A1 CN 2017098328 W CN2017098328 W CN 2017098328W WO 2018036457 A1 WO2018036457 A1 WO 2018036457A1
Authority
WO
WIPO (PCT)
Prior art keywords
mac address
entry
user
packet
address
Prior art date
Application number
PCT/CN2017/098328
Other languages
English (en)
French (fr)
Inventor
简福建
焦赵云
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2018036457A1 publication Critical patent/WO2018036457A1/zh

Links

Images

Classifications

    • 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
    • H04L45/7453Address table lookup; Address filtering using hashing

Definitions

  • the present disclosure relates to the field of network communication technologies, and in particular, to a method, an apparatus, and a switching device and a storage medium for processing a MAC address hash collision.
  • the MAC address Media Access Control Address
  • the forwarding of the switch or other Layer 2 devices is based on the MAC address table. It establishes a forwarding table containing the source MAC address, VLAN ID (virtual area network identification number), and PORT (device port number), and implements packet forwarding according to the forwarding table.
  • the MAC address table initially stores the MAC address in the structure of the sequence table.
  • the MAC address table changes, that is, when the MAC address is added or deleted, in order to maintain the order of the MAC address table, the MAC address table will appear to move.
  • the MAC address table stores a large amount of content, the movement and the search become complicated. At this time, the message cannot reach the line speed, and the search efficiency is also low.
  • the MAC address table uses a hash table format to store MAC address entries.
  • the chip uses a specific hash algorithm to obtain the hash bucket number based on the source MAC address and VLAN ID of the packet, and then stores the MAC address in the bucket.
  • the storage of MAC address entries through the hash table can effectively improve the efficiency of table lookup, but it also creates a hash collision problem.
  • a hash bucket can store N MAC addresses, when it is full of N MAC addresses, the MAC address of a learning MAC address that is being learned according to the hash algorithm is still the hash bucket, and cannot be stored in the hash bucket. In a hash bucket, this is a hash collision. How to reduce the probability of hash collisions has become an urgent problem in the industry under the premise of meeting performance requirements.
  • the storage algorithm of the MAC address hardware table is optimized to reduce the probability of occurrence of a hash collision.
  • the hardware inside the switch chip is closed to the user, and it is basically difficult to achieve a probability of reducing the hash collision by changing the hardware storage algorithm.
  • Solution 2 Upgrade the hardware, use a switch chip with a larger MAC address hardware table capacity or an external TCAM.
  • the implementation of the solution has the following problems: First, the cost of replacing the switch chip is high, the chip manufacturer may not be able to provide the chip product that meets the user's needs; secondly, the external TCAM will have compatibility problems with the switch chip, and also need The user modifies the hardware.
  • the embodiment of the present disclosure provides a hash collision processing method and apparatus, and a switching device and a storage medium, to solve the problem that the related technology needs to modify hardware and increase cost when dealing with a hash collision.
  • an embodiment of the present disclosure provides a hash conflict processing method, including:
  • the packet When receiving the packet with the MAC address as the destination address, the packet is forwarded by querying the entry information of the MAC address from the L2_USER_ENTRY table.
  • determining the media access control MAC address in which the hash collision occurs includes:
  • storing the entry information of the MAC address in the L2_USER_ENTRY table of the switch chip includes:
  • the entry information of the MAC address is stored in the L2_USER_ENTRY table.
  • the method further includes:
  • the aging time flag is reset to 0 in the case that the packet with the MAC address as the source address is not received in the first aging time period;
  • the entry information of the MAC address is deleted.
  • the method further includes:
  • the aging time identifier is set to 1.
  • the entry information of the MAC address is MAC address information, port information, and virtual local area network VLAN id information.
  • the embodiment of the present disclosure further discloses a hash conflict processing apparatus, including:
  • Determining a module configured to determine a media access control MAC address at which a hash collision occurs
  • a storage module configured to store the entry information of the MAC address in a user-defined forwarding table L2_USER_ENTRY of the switch chip;
  • the forwarding module is configured to perform packet forwarding by querying the entry information of the MAC address from the L2_USER_ENTRY table when receiving the packet with the MAC address as the destination address.
  • the determining module includes:
  • Determining a sub-module which is configured to determine, by querying the access control list ACL, a packet whose MAC address learning fails;
  • the parsing submodule is configured to parse the source MAC address carried in the packet
  • the first determining sub-module is configured to determine whether the source MAC address is stored in the MAC address hardware table of the switch chip, and if the determination result is no, determine that the source MAC address has a hash collision.
  • the storage module includes:
  • a second determining sub-module configured to determine whether the entry of the MAC address is stored in the L2_USER_ENTRY table
  • the storage submodule is configured to store, in the case of the determination result, the entry information of the MAC address in the L2_USER_ENTRY table.
  • the embodiment of the present disclosure also discloses a switching device having the device described in any of the above.
  • a storage medium is further provided, and the storage medium may store an execution instruction for executing the hash conflict processing method in the above embodiment.
  • the present application determines the MAC address of the media access control that generates the hash conflict; stores the entry information of the MAC address in the user-defined forwarding table L2_USER_ENTRY of the switch chip; when receiving the packet with the MAC address as the destination address, By forwarding the packet information of the MAC address from the L2_USER_ENTRY table, the message forwarding is implemented, and the hash conflict of the MAC address is effectively alleviated without modifying the hardware design and increasing the hardware cost.
  • FIG. 1 is a flowchart of a hash collision processing method according to an embodiment of the present disclosure
  • FIG. 2 is a flowchart of a method for querying a MAC address according to an embodiment of the present disclosure
  • FIG. 3 is a block diagram 1 of a hash conflict processing apparatus according to an embodiment of the present disclosure
  • FIG. 4 is a block diagram 2 of a hash collision processing apparatus according to an embodiment of the present disclosure
  • FIG. 5 is a block diagram 3 of a hash conflict processing apparatus according to an embodiment of the present disclosure.
  • FIG. 6 is a block diagram 4 of a hash collision processing apparatus according to an embodiment of the present disclosure.
  • FIG. 1 is a flowchart of a hash conflict processing method according to an embodiment of the present disclosure. As shown in FIG. 1 , the hash conflict processing method includes the following processing steps:
  • Step S102 determining a media access control MAC address where a hash collision occurs
  • Step S104 storing the entry information of the MAC address in the user-defined forwarding table L2_USER_ENTRY of the switch chip;
  • the L2_USER_ENTRY table is a hardware table stored inside the switch chip.
  • the basic function is to store the bridge protocol data unit BPDU (bridge protocol data unit) and exchange information between the bridges.
  • BPDU bridge protocol data unit
  • the L2_USER_ENTRY table can forward the message, so it can use its free storage space to store the MAC address information of the hash collision, and query L2_USER_ENTRY the next time it receives the message with the MAC address as the destination address. The information in the table forwards the message.
  • Step S106 When receiving the packet with the MAC address as the destination address, the packet is forwarded by querying the entry information of the MAC address from the L2_USER_ENTRY table.
  • the L2_USER_ENTRY table can be searched first. If the MAC address is found, the packet is forwarded according to the entry information; otherwise, the MAC address hardware table is continuously searched.
  • FIG. 2 is a flowchart of a packet forwarding method according to an embodiment of the present disclosure. As shown in FIG. 2, the method includes the following processing steps:
  • Step S202 parsing the received packet, and obtaining the destination MAC address carried in the packet
  • Step S204 querying the L2_USER_ENTRY table
  • Step S206 determining whether the destination MAC address is stored in the table, if the determination result is yes, executing step S208, if the determination result is no, executing step S210;
  • Step S208 forwarding a message according to the entry information of the destination MAC address stored in the L2_USER_ENTRY table
  • Step S210 querying a MAC address hardware table
  • Step S212 it is determined whether the destination MAC address is stored in the table, if the determination result is yes, step S214 is performed, if the determination result is no, step S216 is performed;
  • Step S214 Forward the packet according to the entry information of the destination MAC address stored in the MAC address hardware table.
  • step S216 the message is flooded.
  • the method for determining the media access control MAC address of the hash collision includes: determining, by querying the access control list ACL, a packet whose MAC address learning fails; parsing the source MAC address carried by the packet; determining the Whether the entry of the source MAC address is stored in the hardware table of the MAC address of the switch chip, and if the result of the determination is no, it is determined that the source MAC address has a hash collision.
  • the ACL is stored in the ACL.
  • the statistic information indicates whether the corresponding MAC address is a learning success or a learning failure. By querying the status information of the table, the packet with the MAC address learning failure can be determined.
  • the source MAC address carried in the packet is obtained by parsing, and the storage status of the source MAC address in the MAC address hardware table is queried, so that the MAC address of the learning failure due to the hash conflict can be further determined, and the MAC address drift is excluded.
  • the MAC address caused by the learning failure is obtained by parsing, and the storage status of the source MAC address in the MAC address hardware table is queried, so that the MAC address of the learning failure due to the hash conflict can be further determined, and the MAC address drift is excluded.
  • the MAC address caused by the learning failure is obtained by parsing, and the storage status of the source MAC address in the MAC address hardware table is queried, so that the MAC address of the learning failure due to the hash conflict can be further determined, and the MAC address drift is excluded.
  • storing the entry information of the MAC address in the L2_USER_ENTRY table of the switch chip may include: determining whether the entry of the MAC address is stored in the L2_USER_ENTRY table; if the determination result is no, MAC address The entry information is stored in the L2_USER_ENTRY table.
  • the L2_USER_ENTRY table can be directly queried to determine whether the above MAC address is stored in the table, but directly querying the L2_USER_ENTRY table requires reading hardware, and the time for reading the hardware is generally longer and the efficiency is lower. Therefore, a new software table can be maintained, and the MAC address entry information stored in the L2_USER_ENTRY table is recorded again in the software table, and the information recorded in the software table is used to determine whether the MAC address is stored in the L2_USER_ENTRY table. This method is more efficient than directly querying the hardware table.
  • the method further includes: setting an aging time period and an aging time identifier bit for the MAC address, and setting the aging time identifier position to In the first aging time period, if the packet with the MAC address as the source address is not received, the aging time flag is reset to 0; in the second aging time period If the packet with the MAC address as the source address is not received, the entry information of the MAC address is deleted.
  • the aging time flag is reset to 0, in the second aging time period, when the packet with the MAC address as the source address is received, the aging time is identified. Is 1.
  • the L2_USER_ENTRY table does not provide the MAC hardware aging mechanism.
  • the MAC address aging is required in software. Through the foregoing aging step, some unnecessary MAC addresses can be deleted in time, and space reserved for other MAC addresses that need to be stored for hash collisions.
  • the entry information of the foregoing MAC address may be MAC address information, port information, and virtual local area network VLAN id information.
  • FIG. 3 is a block diagram of a hash conflict processing apparatus according to an embodiment of the present disclosure. As shown in FIG. 3, the apparatus includes:
  • a determining module 32 configured to determine a media access control MAC address at which a hash collision occurs
  • the storage module 34 is configured to store the entry information of the MAC address in the user-defined forwarding table L2_USER_ENTRY of the switch chip;
  • the forwarding module 36 is configured to perform packet forwarding by querying the entry information of the MAC address from the L2_USER_ENTRY table when receiving the packet with the MAC address as the destination address.
  • FIG. 4 is a block diagram 2 of a hash conflict processing apparatus according to an embodiment of the present disclosure.
  • the determining module 32 includes:
  • the determining sub-module 42 is configured to determine, by querying the access control list ACL, a packet whose MAC address learning fails;
  • the parsing sub-module 44 is configured to parse the source MAC address carried in the packet
  • the first determining sub-module 46 is configured to determine whether the source MAC address is stored in the MAC address hardware table of the switch chip, and if the determination result is no, determine that the source MAC address has a hash collision.
  • FIG. 5 is a block diagram 3 of a hash conflict processing apparatus according to an embodiment of the present disclosure.
  • the storage module 34 includes:
  • the second determining sub-module 52 is configured to determine whether the entry information of the MAC address is stored in the L2_USER_ENTRY table;
  • the storage submodule 54 is configured to store the entry information of the MAC address in the L2_USER_ENTRY table if the determination result is negative.
  • FIG. 6 is a block diagram 4 of a hash conflict processing apparatus according to an embodiment of the present disclosure. As shown in FIG. 6, the apparatus further includes:
  • the aging module 62 is configured to set an aging time period and an aging time identifier bit for the MAC address after the entry of the MAC address is stored in the L2_USER_ENTRY table of the switch chip, and set the aging time identifier to 1;
  • the MAC address is not received as the source address.
  • the aging time flag is reset to 0;
  • the entry information of the MAC address is deleted.
  • the aging module 62 is further configured to:
  • the aging time identifier is set to 1.
  • the present disclosure also discloses an exchange device having any of the above devices.
  • the switching device can be a switch, router or other switching device.
  • Embodiments of the present disclosure also provide a storage medium.
  • the storage medium is arranged to store program code for performing the following steps:
  • the storage medium is further arranged to store program code for performing the following steps:
  • the storage medium is further arranged to store program code for performing the following steps:
  • the storage medium is further arranged to store program code for performing the following steps:
  • the storage medium is further arranged to store program code for performing the following steps:
  • the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM).
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • modules or steps of the present disclosure described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module. As such, the disclosure is not limited to any specific combination of hardware and software.
  • the MAC address of the MAC address is determined by storing the MAC address of the MAC address; the entry information of the MAC address is stored in the user-defined forwarding table L2_USER_ENTRY of the switch chip; In the message, the message forwarding is performed by querying the entry of the MAC address from the L2_USER_ENTRY table, thereby realizing the purpose of effectively alleviating the hash conflict of the MAC address without modifying the hardware design and increasing the hardware cost.

Abstract

本公开提供了一种哈希冲突的处理方法、装置及交换设备和存储介质,其中,该方法包括:确定发生哈希冲突的媒体接入控制MAC地址;将该MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;在接收到以该MAC地址为目的地址的报文时,通过从该L2_USER_ENTRY表中查询该MAC地址的表项信息进行报文转发,解决了相关技术在应对哈希冲突时所造成的需要修改硬件设计以及成本增加的问题,实现了在不修改硬件设计,不增加硬件成本的前提下,有效缓解MAC地址的哈希冲突。

Description

一种哈希冲突的处理方法、装置及交换设备和存储介质 技术领域
本公开涉及网络通信技术领域,特别涉及一种MAC地址哈希冲突的处理方法、装置及交换设备和存储介质。
背景技术
MAC地址(媒体接入控制地址),也被称为物理地址或硬件地址。它是与网络硬件相关联的固定序列号,由网络设备制造商生产时写在硬件内部。交换机或者其他二层设备的转发是基于MAC地址表来进行的。它通过建立一张包含源MAC地址,VLAN ID(虚拟局域网标识号),PORT(设备端口号)的转发表,并根据该转发表来实现报文的转发。
MAC地址表最初采用顺序表的结构存储MAC地址,当MAC地址发生变化时,即添加或删除MAC地址时,为了保持MAC地址表的有序性,MAC地址表会出现表项移动。当MAC地址表存储的内容较多时,移动与查找就变得复杂,此时报文无法达到线速,查找效率也较低下。后期的芯片,MAC地址表多采用哈希表格式存储MAC地址表项。当进行MAC地址学习时,芯片会根据报文的源MAC地址和VLAN ID使用特定的哈希算法得到哈希桶的编号,然后把MAC地址存储到该桶中。通过哈希表存储MAC地址表项可以有效提高查表效率,但是同时也产生了哈希冲突的问题。
假如一个哈希桶能存储N个MAC地址,当它装满N个MAC地址后,一个正在被学习的MAC地址根据哈希算法获得的存储编号依然为该哈希桶时,就无法存储到该哈希桶中,此种情况即为哈希冲突。如何在满足性能要求的前提下,降低哈希冲突发生的概率已成为业界亟需解决的问题。
通常情况下,交换芯片中MAC地址硬件表的容量越大,MAC地址产生冲突的概率就越小。相关的应对哈希冲突的方案主要有以下两类:
方案一,优化MAC地址硬件表的存储算法,降低哈希冲突发生的概率。然而,交换芯片内部的硬件对用户是封闭的,想要通过改变硬件的存储算法以降低哈希冲突发生的概率基本难以实现。
方案二,升级硬件,使用MAC地址硬件表容量更大的交换芯片或者外挂TCAM等。该方案的实现存在以下问题:第一,更换交换芯片的成本较高,芯片厂家不一定能提供符合用户需求的芯片产品;第二,外挂TCAM会存在与交换芯片的兼容性问题,并且同样需要用户修改硬件。
关于相关技术在解决哈希冲突时所造成的需要修改硬件以及增加硬件成本的问题,相关技术没有提出有效的解决方案。
发明内容
本公开实施例提出了一种哈希冲突处理方法、装置及交换设备和存储介质,以解决相关技术在应对哈希冲突时所造成的需要修改硬件以及成本增加的问题。
为了解决上述技术问题,本公开实施例提供了一种哈希冲突处理方法,包括:
确定发生哈希冲突的媒体接入控制MAC地址;
将所述MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
在接收到以所述MAC地址为目的地址的报文时,通过从所述L2_USER_ENTRY表中查询所述MAC地址的表项信息进行报文转发。
可选的,确定所述发生哈希冲突的媒体接入控制MAC地址包括:
通过查询访问控制列表ACL确定MAC地址学习失败的报文;
解析得到所述报文携带的源MAC地址;
判断所述交换芯片的MAC地址硬件表中是否存储所述源MAC地址的表项信息,在判断结果为否的情况下,确定所述源MAC地址发生哈希冲突。
可选的,将所述MAC地址的表项信息存储于所述交换芯片的L2_USER_ENTRY表中包括:
判断所述L2_USER_ENTRY表中是否存储所述MAC地址的表项信息;
在判断结果为否的情况下,将所述MAC地址的表项信息存储于所述L2_USER_ENTRY表中。
可选的,在将所述MAC地址的表项信息存储于所述交换芯片的L2_USER_ENTRY表中之后,所述方法还包括:
为所述MAC地址设置老化时间周期以及老化时间标识位,将所述老化时间标识位置为1;
在第一个所述老化时间周期之内,在未接收到以所述MAC地址为源地址的报文的情况下,将所述老化时间标识位复位为0;
在第二个所述老化时间周期之内,在未接收到以所述MAC地址为源地址的报文的情况下,删除所述MAC地址的表项信息。
可选的,所述方法还包括:
在第二个所述老化时间周期之内,在接收到以所述MAC地址为源地址的报文的情况下,将所述老化时间标识位置为1。
可选的,所述MAC地址的表项信息为MAC地址信息、端口信息、虚拟局域网VLAN id信息。
本公开实施例还公开了一种哈希冲突处理装置,包括:
确定模块,设置为确定发生哈希冲突的媒体接入控制MAC地址;
存储模块,设置为将所述MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
转发模块,设置为在接收到以所述MAC地址为目的地址的报文时,通过从所述L2_USER_ENTRY表中查询所述MAC地址的表项信息进行报文转发。
可选的,所述确定模块包括:
确定子模块,设置为通过查询访问控制列表ACL确定MAC地址学习失败的报文;
解析子模块,设置为解析得到所述报文携带的源MAC地址;
第一判断子模块,设置为判断所述交换芯片的MAC地址硬件表中是否存储所述源MAC地址,在判断结果为否的情况下,确定所述源MAC地址发生哈希冲突。
可选的,所述存储模块包括:
第二判断子模块,设置为判断所述L2_USER_ENTRY表中是否存储所述MAC地址的表项信息;
存储子模块,设置为在判断结果为否的情况下,将所述MAC地址的表项信息存储于所述L2_USER_ENTRY表中。
本公开实施例还公开了一种交换设备,具有上述任一项所述的装置。
在本公开实施例中,还提供了一种存储介质,该存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的哈希冲突处理方法。
本申请通过确定发生哈希冲突的媒体接入控制MAC地址;将MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;在接收到以MAC地址为目的地址的报文时,通过从L2_USER_ENTRY表中查询MAC地址的表项信息进行报文转发,实现了在不修改硬件设计,不增加硬件成本的前提下,有效缓解MAC地址的哈希冲突的目的。
附图说明
图1是根据本公开实施例的一种哈希冲突处理方法流程图;
图2是根据本公开实施例的一种MAC地址查询方法流程图;
图3是根据本公开实施例的一种哈希冲突处理装置框图一;
图4是根据本公开实施例的一种哈希冲突处理装置框图二;
图5是根据本公开实施例的一种哈希冲突处理装置框图三;
图6是根据本公开实施例的一种哈希冲突处理装置框图四。
具体实施方式
下面通过附图和实施例,对本公开的技术方案做进一步的详细描述。
本公开实施例提供了一种哈希冲突处理方法,通过检测确定发生哈希冲突的MAC地址,并将该地址存储于交换芯片中除MAC地址硬件表以外的用户自定义转发表中,在下一次接收到以该MAC地址为目的地址的报文时,就可以查询用户自定义转发表中的信息进行报文转发。图1是根据本公开实施例的一种哈希冲突处理方法流程图,如图1所示,该哈希冲突处理方法包括以下处理步骤:
步骤S102,确定发生哈希冲突的媒体接入控制MAC地址;
步骤S104,将该MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
L2_USER_ENTRY表是存储于交换芯片内部的硬件表,基本功能为存储生成树协议问候数据包BPDU(bridge protocol data unit),并在网桥间进行信息交换。与MAC地址硬件表相同,L2_USER_ENTRY表可以转发报文,因此可以利用其空闲存储空间存储发生哈希冲突的MAC地址信息,并在下一次接收到以该MAC地址为目的地址的报文时,查询L2_USER_ENTRY表中的信息进行报文转发。
步骤S106,在接收到以该MAC地址为目的地址的报文时,通过从该L2_USER_ENTRY表中查询该MAC地址的表项信息进行报文转发。
在进行MAC地址查询的时候可以先查找L2_USER_ENTRY表,如果查找到该MAC地址,则依据其表项信息进行报文转发;否则,继续查找MAC地址硬件表。
图2是根据本公开实施例的一种报文转发方法流程图,如图2所示,该方法包括以下处理步骤:
步骤S202,解析接收到的报文,获取该报文携带的目的MAC地址;
步骤S204,查询L2_USER_ENTRY表;
步骤S206,判断表中是否存储该目的MAC地址,在判断结果为是的情况下,执行步骤S208,在判断结果为否的情况下,执行步骤S210;
步骤S208,依据该L2_USER_ENTRY表中存储的该目的MAC地址的表项信息转发报文;
步骤S210,查询MAC地址硬件表;
步骤S212,判断该表中是否存储该目的MAC地址,在判断结果为是的情况下,执行步骤S214,在判断结果为否的情况下,执行步骤S216;
步骤S214,依据该MAC地址硬件表中存储的该目的MAC地址的表项信息转发报文;
步骤S216,洪泛该报文。
可选的,确定该发生哈希冲突的媒体接入控制MAC地址的方法包括步骤:通过查询访问控制列表ACL确定MAC地址学习失败的报文;解析得到该报文携带的源MAC地址;判断该交换芯片的MAC地址硬件表中是否存储该源MAC地址的表项信息,在判断结果为否的情况下,确定该源MAC地址发生哈希冲突。
访问控制列表ACL中存储有查表状态信息,该查表状态信息会标记出对应的MAC地址是学习成功还是学习失败,通过查询该查表状态信息就可以确定MAC地址学习失败的报文。
通过解析得到上述报文携带的源MAC地址,并查询MAC地址硬件表上述源MAC地址的存储情况,可以进一步确定由于哈希冲突所导致的学习失败的MAC地址,排除由于MAC地址漂移等原因所造成的学习失败的MAC地址。
可选的,将该MAC地址的表项信息存储于该交换芯片的L2_USER_ENTRY表中可以包括:判断该L2_USER_ENTRY表中是否存储该MAC地址的表项信息;在判断结果为否的情况下,将该MAC地址 的表项信息存储于该L2_USER_ENTRY表中。
通过判断L2_USER_ENTRY表中的MAC地址存储情况,可以防止同一个发生哈希冲突的MAC地址被重复存储。可以通过直接查询L2_USER_ENTRY表的方式判断表中是否存储了上述的MAC地址,但是直接查询L2_USER_ENTRY表需要读取硬件,读取硬件的时间一般较长,效率也较低。因此,可以维护一张新的软件表,将已存储于L2_USER_ENTRY表的MAC地址表项信息再次记录到该软件表中,通过查询软件表中记录的信息判断L2_USER_ENTRY表中是否存储了上述的MAC地址,该方法相较于直接查询硬件表而言效率更高。
可选的,在将该MAC地址的表项信息存储于该交换芯片的L2_USER_ENTRY表中之后,该方法还包括:为该MAC地址设置老化时间周期以及老化时间标识位,将该老化时间标识位置为1;在第一个该老化时间周期之内,在未接收到以该MAC地址为源地址的报文的情况下,将该老化时间标识位复位为0;在第二个该老化时间周期之内,在未接收到以该MAC地址为源地址的报文的情况下,删除该MAC地址的表项信息。
可选的,在将该老化时间标识位复位为0之后,在第二个该老化时间周期之内,在接收到以该MAC地址为源地址的报文的情况下,将该老化时间标识位置为1。
通常情况下,L2_USER_ENTRY表不提供MAC硬件老化机制,需要通过软件的方式进行MAC地址的老化。通过上述老化步骤,可以及时删除一些不必要的MAC地址,为其他发生哈希冲突需要被存储的MAC地址预留存储的空间。
上述的MAC地址的表项信息可以为MAC地址信息、端口信息、虚拟局域网VLAN id信息。
本公开还公开了一种哈希冲突处理装置,图3是根据本公开实施例的一种哈希冲突处理装置框图一,如图3所示,该装置包括:
确定模块32,设置为确定发生哈希冲突的媒体接入控制MAC地址;
存储模块34,设置为将该MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
转发模块36,设置为在接收到以该MAC地址为目的地址的报文时,通过从该L2_USER_ENTRY表中查询该MAC地址的表项信息进行报文转发。
图4是根据本公开实施例的一种哈希冲突处理装置框图二,如图4所示,该确定模块32包括:
确定子模块42,设置为通过查询访问控制列表ACL确定MAC地址学习失败的报文;
解析子模块44,设置为解析得到该报文携带的源MAC地址;
第一判断子模块46,设置为判断该交换芯片的MAC地址硬件表中是否存储该源MAC地址,在判断结果为否的情况下,确定该源MAC地址发生哈希冲突。
图5是根据本公开实施例的一种哈希冲突处理装置框图三,如图5所示,该存储模块34包括:
第二判断子模块52,设置为判断该L2_USER_ENTRY表中是否存储该MAC地址的表项信息;
存储子模块54,设置为在判断结果为否的情况下,将该MAC地址的表项信息存储于该L2_USER_ENTRY表中。
图6是根据本公开实施例的一种哈希冲突处理装置框图四,如图6所示,该装置还包括:
老化模块62,设置为在将该MAC地址的表项信息存储于该交换芯片的L2_USER_ENTRY表中之后,为该MAC地址设置老化时间周期以及老化时间标识位,将该老化时间标识位置为1;
在第一个该老化时间周期之内,在未接收到以该MAC地址为源地址 的报文的情况下,将该老化时间标识位复位为0;
在第二个该老化时间周期之内,在未接收到以该MAC地址为源地址的报文的情况下,删除该MAC地址的表项信息。
可选的,该老化模块62还设置为:
在第二个该老化时间周期之内,在接收到以该MAC地址为源地址的报文的情况下,将该老化时间标识位置为1。
本公开还公开了一种交换设备,具有上述的任意一种装置。该交换设备可以是交换机、路由器或其他交换设备。
以上所述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。
实施例3
本公开的实施例还提供了一种存储介质。可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:
S1,确定发生哈希冲突的媒体接入控制MAC地址;
S2,将MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
S3,在接收到以MAC地址为目的地址的报文时,通过从L2_USER_ENTRY表中查询MAC地址的表项信息进行报文转发。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:
S1,通过查询访问控制列表ACL确定MAC地址学习失败的报文;
S2,解析得到报文携带的源MAC地址;
S3,判断交换芯片的MAC地址硬件表中是否存储源MAC地址的表项信息,在判断结果为否的情况下,确定源MAC地址发生哈希冲突。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:
S1,判断L2_USER_ENTRY表中是否存储MAC地址的表项信息;
S2,在判断结果为否的情况下,将MAC地址的表项信息存储于L2_USER_ENTRY表中。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:
S1,为MAC地址设置老化时间周期以及老化时间标识位,将老化时间标识位置为1;
S2,在第一个老化时间周期之内,在未接收到以MAC地址为源地址的报文的情况下,将老化时间标识位复位为0;
S3,在第二个老化时间周期之内,在未接收到以MAC地址为源地址的报文的情况下,删除MAC地址的表项信息。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:
S1,在第二个老化时间周期之内,在接收到以MAC地址为源地址的报文的情况下,将老化时间标识位置为1。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
显然,本领域的技术人员应该明白,上述的本公开的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本公开不限制于任何特定的硬件和软件结合。
以上仅为本公开的可选实施例而已,并不用于限制本公开,对于本领 域的技术人员来说,本公开可以有各种更改和变化。凡在本公开的原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。
工业实用性
在本公开实施例中,通过确定发生哈希冲突的媒体接入控制MAC地址;将MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;在接收到以MAC地址为目的地址的报文时,通过从L2_USER_ENTRY表中查询MAC地址的表项信息进行报文转发,实现了在不修改硬件设计,不增加硬件成本的前提下,有效缓解MAC地址的哈希冲突的目的。

Claims (11)

  1. 一种哈希冲突处理方法,包括:
    确定发生哈希冲突的媒体接入控制MAC地址;
    将所述MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
    在接收到以所述MAC地址为目的地址的报文时,通过从所述L2_USER_ENTRY表中查询所述MAC地址的表项信息进行报文转发。
  2. 如权利要求1所述的方法,其中,确定所述发生哈希冲突的媒体接入控制MAC地址包括:
    通过查询访问控制列表ACL确定MAC地址学习失败的报文;
    解析得到所述报文携带的源MAC地址;
    判断所述交换芯片的MAC地址硬件表中是否存储所述源MAC地址的表项信息,在判断结果为否的情况下,确定所述源MAC地址发生哈希冲突。
  3. 如权利要求1所述的方法,其中,将所述MAC地址的表项信息存储于所述交换芯片的用户自定义转发表L2_USER_ENTRY表中包括:
    判断所述L2_USER_ENTRY表中是否存储所述MAC地址的表项信息;
    在判断结果为否的情况下,将所述MAC地址的表项信息存储于所述L2_USER_ENTRY表中。
  4. 如权利要求1至3任一项所述的方法,其中,在将所述MAC地址的表项信息存储于所述交换芯片的L2_USER_ENTRY表中之后, 所述方法还包括:
    为所述MAC地址设置老化时间周期以及老化时间标识位,将所述老化时间标识位置为1;
    在第一个所述老化时间周期之内,在未接收到以所述MAC地址为源地址的报文的情况下,将所述老化时间标识位复位为0;
    在第二个所述老化时间周期之内,在未接收到以所述MAC地址为源地址的报文的情况下,删除所述MAC地址的表项信息。
  5. 如权利要求4所述的方法,其中:
    在第二个所述老化时间周期之内,在接收到以所述MAC地址为源地址的报文的情况下,将所述老化时间标识位置为1。
  6. 如权利要求5所述的方法,其中,所述MAC地址的表项信息为MAC地址信息、端口信息、虚拟局域网VLAN id信息。
  7. 一种哈希冲突处理装置,包括:
    确定模块,设置为确定发生哈希冲突的媒体接入控制MAC地址;
    存储模块,设置为将所述MAC地址的表项信息存储于交换芯片的用户自定义转发表L2_USER_ENTRY中;
    转发模块,设置为在接收到以所述MAC地址为目的地址的报文时,通过从所述L2_USER_ENTRY表中查询所述MAC地址的表项信息进行报文转发。
  8. 如权利要求7所述的装置,其中,所述确定模块包括:
    确定子模块,设置为通过查询访问控制列表ACL确定MAC地址学习失败的报文;
    解析子模块,设置为解析得到所述报文携带的源MAC地址;
    第一判断子模块,设置为判断所述交换芯片的MAC地址硬件表中是否存储所述源MAC地址,在判断结果为否的情况下,确定所述源MAC地址发生哈希冲突。
  9. 如权利要求7或8所述的装置,其中,所述存储模块包括:
    第二判断子模块,设置为判断所述L2_USER_ENTRY表中是否存储所述MAC地址的表项信息;
    存储子模块,设置为在判断结果为否的情况下,将所述MAC地址的表项信息存储于所述L2_USER_ENTRY表中。
  10. 一种交换设备,包括如权利要求7至9任一项所述的装置。
  11. 一种存储介质,所述存储介质包括存储的程序,其中,所述程序运行时执行上述权利要求1至6任一项中所述的方法。
PCT/CN2017/098328 2016-08-23 2017-08-21 一种哈希冲突的处理方法、装置及交换设备和存储介质 WO2018036457A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610708625.2 2016-08-23
CN201610708625.2A CN107770076B (zh) 2016-08-23 2016-08-23 一种哈希冲突的处理方法、装置及交换设备

Publications (1)

Publication Number Publication Date
WO2018036457A1 true WO2018036457A1 (zh) 2018-03-01

Family

ID=61246363

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/098328 WO2018036457A1 (zh) 2016-08-23 2017-08-21 一种哈希冲突的处理方法、装置及交换设备和存储介质

Country Status (2)

Country Link
CN (1) CN107770076B (zh)
WO (1) WO2018036457A1 (zh)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343089A (zh) * 2020-02-17 2020-06-26 烽火通信科技股份有限公司 解决mac地址hash冲突导致洪泛问题的方法及系统
CN112286966A (zh) * 2020-09-23 2021-01-29 清华大学 一种数据流处理、恢复方法以及设备和存储介质
CN112398739A (zh) * 2020-11-13 2021-02-23 深圳市风云实业有限公司 一种支持hsr协议的代理节点表实现方法
CN112702270A (zh) * 2020-12-18 2021-04-23 深圳赛安特技术服务有限公司 基于事件分发机制的节点调用方法、系统及存储介质
CN113518033A (zh) * 2020-04-09 2021-10-19 阿里巴巴集团控股有限公司 路由方法、哈希运算方法、路由器、装置和设备
CN113904987A (zh) * 2021-10-29 2022-01-07 西安微电子技术研究所 一种mac地址路由管理控制器、系统及控制方法

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413215B (zh) * 2018-04-28 2023-11-07 伊姆西Ip控股有限责任公司 用于获取访问权限的方法、设备和计算机程序产品
CN108848034B (zh) * 2018-07-17 2021-04-27 新华三技术有限公司 一种网络设备及表项学习方法
CN109413225B (zh) * 2018-11-28 2021-11-02 新华三技术有限公司 一种mac表项处理方法和设备
CN110752996A (zh) * 2019-10-24 2020-02-04 杭州迪普信息技术有限公司 一种报文转发方法及装置
CN111950000B (zh) * 2020-07-30 2022-10-21 新华三技术有限公司 一种接入访问控制方法及设备
CN112491723B (zh) * 2020-12-07 2022-03-01 上海励驰半导体有限公司 网关报文转发方法、装置、存储介质及网关
CN112637072B (zh) * 2020-12-23 2022-08-02 北京时代民芯科技有限公司 一种用于交换芯片地址存储及查找的快速并行电路及方法
CN115118662A (zh) * 2022-06-16 2022-09-27 浪潮思科网络科技有限公司 一种基于arp表的哈希冲突处理方法、系统、设备及介质
CN115421804B (zh) * 2022-07-29 2023-02-24 中科驭数(北京)科技有限公司 一种基于kpu统一接口的数据管理方法、系统及装置

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834788A (zh) * 2010-04-16 2010-09-15 福建星网锐捷网络有限公司 媒体访问控制地址表项的存储操作方法、装置及设备
CN101232444B (zh) * 2008-01-22 2012-03-21 杭州华三通信技术有限公司 哈希冲突解决方法、装置及具有该装置的交换设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6889225B2 (en) * 2001-08-09 2005-05-03 Integrated Silicon Solution, Inc. Large database search using content addressable memory and hash
CN103117931B (zh) * 2013-02-21 2015-07-01 烽火通信科技股份有限公司 基于哈希表和tcam表的mac地址硬件学习方法及系统
CN103577564A (zh) * 2013-10-25 2014-02-12 盛科网络(苏州)有限公司 通过软件搬移降低hash冲突的方法及装置
CN103731355B (zh) * 2013-12-31 2017-01-25 迈普通信技术股份有限公司 避免mac地址学习时哈希冲突的方法及系统
CN105323175A (zh) * 2014-08-05 2016-02-10 中兴通讯股份有限公司 一种地址解析协议表的扩展方法和装置

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101232444B (zh) * 2008-01-22 2012-03-21 杭州华三通信技术有限公司 哈希冲突解决方法、装置及具有该装置的交换设备
CN101834788A (zh) * 2010-04-16 2010-09-15 福建星网锐捷网络有限公司 媒体访问控制地址表项的存储操作方法、装置及设备

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343089A (zh) * 2020-02-17 2020-06-26 烽火通信科技股份有限公司 解决mac地址hash冲突导致洪泛问题的方法及系统
CN113518033A (zh) * 2020-04-09 2021-10-19 阿里巴巴集团控股有限公司 路由方法、哈希运算方法、路由器、装置和设备
CN112286966A (zh) * 2020-09-23 2021-01-29 清华大学 一种数据流处理、恢复方法以及设备和存储介质
CN112398739A (zh) * 2020-11-13 2021-02-23 深圳市风云实业有限公司 一种支持hsr协议的代理节点表实现方法
CN112398739B (zh) * 2020-11-13 2022-03-08 深圳市风云实业有限公司 一种支持hsr协议的代理节点表实现方法
CN112702270A (zh) * 2020-12-18 2021-04-23 深圳赛安特技术服务有限公司 基于事件分发机制的节点调用方法、系统及存储介质
CN113904987A (zh) * 2021-10-29 2022-01-07 西安微电子技术研究所 一种mac地址路由管理控制器、系统及控制方法

Also Published As

Publication number Publication date
CN107770076B (zh) 2020-12-04
CN107770076A (zh) 2018-03-06

Similar Documents

Publication Publication Date Title
WO2018036457A1 (zh) 一种哈希冲突的处理方法、装置及交换设备和存储介质
US10992574B2 (en) Packet forwarding method and device
US9997245B1 (en) Method and apparatus for TCAM based look-up
US7606236B2 (en) Forwarding information base lookup method
CN108259347B (zh) 一种报文传输方法和装置
CN107547243B (zh) 一种报文转发方法及装置
JP2005130489A (ja) ルータ用の改良型アクセス制御リスティング機構
WO2021135491A1 (zh) 流表的匹配方法及装置
US10771386B2 (en) IP routing search
CN106789859B (zh) 报文匹配方法及装置
US20090158006A1 (en) Facilitating management of layer 2 hardware address table based on packet priority information
CN101620623A (zh) 内容可寻址存储器表项管理方法和装置
CN110768917B (zh) 一种报文传输方法及装置
US10084613B2 (en) Self adapting driver for controlling datapath hardware elements
US10289384B2 (en) Methods, systems, and computer readable media for processing data containing type-length-value (TLV) elements
CN110191135B (zh) Acl配置方法、装置、电子设备
CN109873766B (zh) 报文传输方法和装置
US10546018B2 (en) System and method of coalescing writes to a hardware table in a non-disruptive fashion
CN108990126B (zh) 报文转发方法和装置
CN112511438A (zh) 一种利用流表转发报文的方法、装置及计算机设备
US11469915B2 (en) Technologies for sharing packet replication resources in a switching system
US20130077530A1 (en) Scaling IPv6 on Multiple Devices Virtual Switching System with Port or Device Level Aggregation
US20170149936A1 (en) Method, system, and computer-readable recording medium for processing network traffic
WO2016173196A1 (zh) 地址映射关系的学习方法及装置
CN115550290A (zh) 一种在存储区域网络中实现Zone隔离的方法及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17842880

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17842880

Country of ref document: EP

Kind code of ref document: A1