Background technology
Switch is by the source MAC study to message, set up one and comprise SA (SourceAddress, source MAC), the transmitting of VLAN (Virtual Local Area Network, VLAN) ID, Port (port), and realize that according to this table clean culture of message transmits.The structure store M AC address of mac address table original adoption sequence list, as shown in table 1, change at mac address table like this, i.e. when interpolation or deletion MAC Address, because will keep the order of mac address table, moving of list item can appear in mac address table.When the mac address table capacity was big, because the complexity that list item moves and searches, efficient was lower.
Table 1
MAC1 |
MAC2 |
MAC3 |
…… |
MACn-1 |
MACn |
Exchange chip afterwards, mac address table adopt the Hash table structure to store.At first, determine the degree of depth of Hash bucket, use the degree of depth of the capacity of whole M AC address table again, obtained the number of the Hash bucket of needs divided by the Hash bucket.Each Hash bucket has own unique numbering, and still the mode of employing order is stored in the inside of Hash bucket.When carrying out MAC address learning, can use certain algorithm according to SA and VLAN ID, obtain the numbering of Hash bucket, and MAC Address is stored in this bucket.Can improve the efficient that MAC Address is added, deleted and search so greatly, but also produce the problem of a hash-collision simultaneously.As shown in table 2, Bucket-1 is full, and other are mapped to the MAC Address of this barrel so, just can not store as MAC1-5, though still have free space in other the Hash bucket at this moment.
Table 2
Bucket-1 |
Bucket-2 |
…… |
Bucket-N |
MAC1-1 |
MAC2-1 |
…… |
MACN-1 |
MAC1-2 |
MAC2-2 |
MACN-2 |
MAC1-3 |
|
MACN-3 |
MAC1-4 |
|
|
As shown in Figure 1, in the prior art, carrying out the flow process that message is transmitted by MAC address learning, is that the message of MAC-A is an example to receive SA from port one, comprises and carries out following steps successively:
Step S10: receive message from port one;
Step S20: the source address MAC-A that at first parses message;
Step S30: carry out MAC address learning based on SA;
Step S40: MAC-A is carried out Hash calculation or Hash calculation is carried out in the combination of MAC-A and its relevant information (as VLANID);
Step S50: judge whether to take place hash-collision; As hash-collision takes place then carry out step S70; As hash-collision does not take place, then carry out step S80;
Step S70: because hash-collision takes place, so can not make an addition to mac address table to MAC-A, therefore, message is forwarded to all of the port in the VLAN with broadcast mode; Carry out the flow process end that message is transmitted by MAC address learning.
Step S80: MAC-A is made an addition to mac address table;
Step S90: destination address is that MAC-A is forwarded to port one with mode of unicast; Carry out the flow process end that message is transmitted by MAC address learning;
By above-mentioned flow process as can be seen, when carrying out MAC address learning, if find that the Hash bucket that this MAC Address is mapped to is full, though free space is still arranged in the mac address table so, but this MAC Address still can not be stored, causing with this MAC Address is that the message of DA is broadcasted in VLAN, takies the effective bandwidth of other ports.Under worst case, all MAC Address are mapped in the same Hash bucket in the network, can broadcast in the VLAN that a large amount of unknown unicast message of appearance causes in network, cause the significant wastage of the network bandwidth.
Summary of the invention
During at the appearance MAC Address hash-collision that exists in the prior art, destination address can not carry out the problem that clean culture is transmitted for the unicast message of conflict MAC Address, the object of the present invention is to provide a kind of method for solving hash collision, do not need the extra support of exchange chip hardware, realize being the clean culture surface speed forwarding of the message of destination address with the conflict MAC Address.
Another object of the present invention is to provide a kind of hash-collision solving device of realizing MAC Address method for solving hash collision of the present invention.
A further object of the present invention is to provide a kind of switching equipment with hash-collision solving device of the present invention.
For achieving the above object, technical scheme of the present invention is as follows:
A kind of method for solving hash collision may further comprise the steps:
Step S100: in the process of MAC address learning, the MAC Address of learning is carried out the detection of MAC Address hash-collision;
Step S200: when detecting hash-collision, the conflict MAC Address that hash-collision takes place is stored in conflict mac address table in the collision table module beyond the address table module;
Step S300:,, message is carried out the clean culture surface speed forwarding according to the conflict mac address table receiving with conflict MAC when being the message of destination address.
Method for solving hash collision of the present invention wherein, before step S100, also is included in the step of setting up the conflict mac address table in the collision table module, and the conflict mac address table is used to preserve the source port information and the vlan information of conflict MAC Address.
Method for solving hash collision of the present invention wherein, in step S100, detects described hash-collision by the interrupt notification that receives the generation hash-collision that exchange chip sends.
Method for solving hash collision of the present invention wherein, in step S300, according to described conflict mac address table configuration acl rule, by issue the mode that is redirected acl rule to each port, is realized the clean culture surface speed forwarding of message.
Method for solving hash collision of the present invention, wherein, step S200 comprises that also the MAC Address that does not detect hash-collision is stored in the mac address table of MAC Address module;
Step S300 also comprises, receiving when being the message of destination address with the MAC Address in the mac address table, according to mac address table, message carried out the clean culture surface speed forwarding.
A kind of hash-collision solving device of realizing method for solving hash collision of the present invention comprises control module, is used for the collision table module of collision detection module, establishment and maintenance conflict mac address table that the MAC Address hash-collision detects and is used to receive and dispatch the transceiver module of message;
Described control module is transmitted in described hash-collision detection module with the MAC Address of learning in the MAC address learning process and carries out the detection of MAC Address hash-collision; And the MAC Address that hash-collision takes place for hash-collision detection module report is transmitted in the collision table module stores; And control described transceiver module according to described conflict mac address table to the conflict MAC be the message clean culture surface speed forwarding of destination address.
Hash-collision solving device of the present invention, wherein, described hash-collision detection module also comprises the interrupt response unit, described interrupt response unit is used to receive and identify the interrupt notification of the generation hash-collision that exchange chip sends, after described collision detection module receives described interrupt notification, to described control module report hash-collision takes place.
Hash-collision solving device of the present invention, wherein, described control module also comprises the forwarding control unit, and described forwarding control unit disposes the acl rule of described transceiver module according to described conflict mac address table, and described transceiver module E-Packets according to described acl rule clean culture.
Hash-collision solving device of the present invention, wherein, described hash-collision solving device also comprises the address table module, the mac address table of its maintenance is used to preserve the MAC Address that does not detect hash-collision;
Described control module is controlled described transceiver module receiving when being the message of destination address with the MAC Address in the mac address table, according to mac address table message is carried out the clean culture surface speed forwarding.
Switching equipment of the present invention has hash-collision solving device of the present invention.
As shown from the above technical solution, the present invention has following beneficial effect: the present invention is by detecting and preserve the MAC Address that hash-collision takes place, and realize to destination address being the clean culture surface speed forwarding of the message of conflict MAC Address, and do not need the extra support of exchange chip hardware.The present invention has also improved the utilance of port bandwidth, avoids because the unknown unicast flow that the failure of hash-collision MAC address learning causes takies network effective bandwidth.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Embodiment
The invention will be further described below in conjunction with the accompanying drawings and the specific embodiments.
The present invention can detect the MAC Address hash-collision, and sets up the conflict mac address table in the collision table module beyond the address table module and preserve the conflict MAC Address, can carry out the clean culture surface speed forwarding for the message of conflict MAC to DA simultaneously.
Method for solving hash collision of the present invention may further comprise the steps:
Step S100: in the process of MAC address learning, the MAC Address of learning is carried out the detection of MAC Address hash-collision;
Step S200: when detecting hash-collision, the conflict MAC Address that hash-collision takes place is stored in conflict mac address table in the collision table module beyond the address table module;
Step S300:,, message is carried out the clean culture surface speed forwarding according to the conflict mac address table receiving with conflict MAC when being the message of destination address.
In the prior art, MAC address learning is finished by hardware usually, does not need software to participate in.Therefore, when producing hash-collision, can't carry out particular processing to the MAC Address of hash-collision.Method for solving hash collision of the present invention, in the process of the study of MAC Address, the MAC Address of learning is carried out the detection of MAC Address hash-collision, can detect hash-collision by method for solving hash collision of the present invention, specifically can realize by two kinds of methods of following two embodiment:
The method for solving hash collision of first embodiment of the invention uses software mode to carry out MAC address learning, in the process that mac address table adds, detects the hash-collision of MAC Address in the MAC Address that will learn.For example call exchange chip to the whether full function of mac address table storage, detect hash-collision.If a certain MAC Address of learning, in the process that a certain Hash bucket toward address table adds, function return value shows that this Hash bucket is full, illustrate that then this MAC Address is the conflict MAC Address, thereby make CPU when hash-collision takes place, can in time detect hash-collision, and set up the conflict mac address table, the conflict MAC Address is stored.
Method for solving hash collision of the present invention, in the process of MAC address learning, the MAC Address that does not detect hash-collision is stored in the mac address table of MAC Address module; Receiving when being the message of destination address,, message is carried out the clean culture surface speed forwarding according to mac address table with the MAC Address in the mac address table.When detecting the conflict MAC Address that hash-collision takes place, the conflict MAC Address is kept at conflict mac address table in the collision table module beyond the mac address table module, conflict mac address table simulation mac address table; When carrying out the message forwarding according to MAC Address, inquiry mac address table and conflict mac address table carry out message and transmit.The conflict mac address table does not take the resource of mac address table.The table length of conflict mac address table can be determined according to actual conditions.The method for solving hash collision of first embodiment of the invention also was included in the step of the establishment of the mac address table that conflicts in the collision table module before step S100.To guarantee enough and stable space being arranged to guarantee the storage of conflict MAC Address.
The method for solving hash collision of second embodiment of the invention in step S100, detects described hash-collision by the interrupt notification that receives the generation hash-collision that exchange chip sends.Carry out in the process of address learning at exchange chip, when producing hash-collision, by interrupt service routine, produce the interruption that hash-collision has taken place in expression by exchange chip, by receiving and identifying expression the interruption of hash-collision having taken place, has carried out the detection of hash-collision.The method for solving hash collision of second embodiment of the invention requires exchange chip to produce when hash-collision takes place and interrupts, and needs to rely on exchange chip and gives notice by the mode of interrupting when hash-collision takes place and realize.
After detecting the hash-collision generation, the MAC Address of preserving hash-collision by the conflict mac address table of having set up.After detecting hash-collision, use the MAC Address of the mac address table preservation hash-collision of table 3 form.In this table, need to write down source port information and the vlan information of SA at least, as the foundation of transmitting for the message of conflict MAC Address.In the conflict mac address table, can also preserve about other forwarding attributes of this MAC Address or the maintenance information of this MAC Address.The conflict mac address table can adopt identical structure with mac address table, and it can be that preface is stored according to MAC Address, also can store in proper order according to the interpolation of conflict MAC Address.
The method for solving hash collision of the embodiment of the invention, as described in Table 3, according to the hash-collision mac address information that the conflict mac address table is preserved, realize destination address is carried out the clean culture surface speed forwarding for the message of conflict MAC Address.Method for solving hash collision of the present invention, its collision table module is actually a kind of hardware module, ACL module for example when it is the ACL module, is to realize target MAC (Media Access Control) address is carried out the clean culture surface speed forwarding for the message of conflict MAC Address by issuing the mode that is redirected acl rule.
In the method for solving hash collision of the embodiment of the invention, realize above-mentioned clean culture surface speed forwarding by issuing the mode that is redirected ACL (AccessControl list, Access Control List (ACL)) rule.Specifically, acl rule according to conflict mac address table configuration exchange chip, issue described acl rule to other all of the ports except that source port, the message that each port of switching equipment can be found at the conflict mac address table for target MAC (Media Access Control) address and VLAN id information, directly surface speed forwarding realizes the clean culture surface speed forwarding to message to the list item corresponding port.Method for solving hash collision of the present invention also can use other modes to realize the clean culture surface speed forwarding of destination address for the message of conflict MAC Address.
For issuing redirected acl rule, the ACL module can decide how to handle message according to message characteristic, and it and mac address table belong to hardware resource, but adhere to different hardware modules separately.
To with conflict MAC being the message of DA when transmitting, can increase redirected acl rule, for the message that purpose MAC and the two combination of VLAN ID can find, be forwarded to the port of appointment in the HASH collision table.
Table 3
MAC Address |
VLAN ID |
Port numbers |
00:e0:fc:00:00:01 |
1 |
14 |
00:e0:fc:00:00:02 |
2 |
15 |
00:e0:fc:00:00:03 |
3 |
16 |
With first list item of table 3 is example, HASH conflict list item hereto, and can issue an acl rule: all DA=00:e0:fc:00:00:01, and the message of VLAN ID=1 is forwarded to port one 4.
Message can experience the processing of a plurality of hardware modules after entering switching equipment such as switch.Generally speaking, can be introduced into the module of mac address table, enter the ACL module again.For being the message of DA, in mac address table, can find corresponding list item, and transmit like this according to the list item middle port information of mac address table with common MAC (no HASH conflict); For being the message of DA, can search failure at mac address table, and then continue to enter the ACL module with HASH conflict MAC, find the acl rule (being redirected ACL) of coupling, and being forwarded to the port of appointment according to rule, the performance of forwarding is the same with the MAC module, all is that hardware is transmitted.
To sum up, use such scheme can both realize the hardware surface speed forwarding as the message of DA for MAC Address with all types (conflict and non-conflict).
As shown in Figure 2, hash-collision detection method of the present invention, step S100 can be refined as step S100-S140, step S200 comprises step S210 and the step S220 that carries out respectively, step S300 comprises step S310 and step S320, to receive SA from port one is that the message of MAC-A is an example, and the method for solving hash collision of the first embodiment of the invention and second embodiment includes and carries out following steps successively:
Step S110: receive message from port one;
Step S120: the source address MAC-A that parses message;
Step S130: carry out MAC address learning;
Step S140: the MAC Address of learning is carried out the MAC Address hash-collision detect; Then carry out step S210 as this MAC Address generation hash-collision; As hash-collision does not take place, then carry out step S220;
Step S210: MAC-A is made an addition to the conflict mac address table; Change step S310 over to;
Step S220: MAC-A is made an addition to mac address table; Change step S320 over to;
Step S310: disposing and issue redirected acl rule, is destination address that the message redirecting of MAC-A is to port one; Change step S320 over to;
Step S320: destination address is that the message of MAC-A is forwarded to port one with mode of unicast; Carry out the flow process end that message is transmitted by MAC address learning;
As shown in Figure 3, step S320 can further be refined as step S321-S327, and promptly the flow process that message is transmitted in the MAC Address method for solving hash collision of the embodiment of the invention comprises the steps:
Step S321: receive and wait to E-Packet;
Step S322: extract destination address to be E-Packeted and VLAN ID;
Step S323: coupling mac address table.Promptly search the list item that has or not this destination address and the two combination of VLAN ID in the mac address table; If the match is successful, execution in step S324; If coupling is unsuccessful, execution in step S325;
Step S324: press mac address table this message clean culture is transmitted; The message forwarding process finishes;
Step S325: enter the ACL module;
Step S326: search the corresponding acl rule of this destination address;
Step S327: according to the acl rule that finds, with the port of this message clean culture surface speed forwarding appointment in the rule; The message forwarding process finishes.
By above-mentioned flow process as can be seen, method for solving hash collision of the present invention, can not cause with the conflict MAC Address is that the message of target MAC (Media Access Control) address is broadcasted in VLAN, and then can not take the effective bandwidth of other ports.Reduced greatly in the VLAN that a large amount of unknown unicast message of appearance causes in network and broadcasted, avoided the waste of the network bandwidth.
Realize the hash-collision solving device of the present invention of method for solving hash collision of the present invention, comprise control module, be used for the collision table module of collision detection module, establishment and maintenance conflict mac address table that the MAC Address hash-collision detects and be used to receive and dispatch the transceiver module of message;
Described control module is transmitted in described hash-collision detection module with the MAC Address of learning in the MAC address learning process and carries out the detection of MAC Address hash-collision; And the MAC Address that hash-collision takes place for hash-collision detection module report is transmitted in the collision table module stores; And control described transceiver module according to described conflict mac address table to the conflict MAC be the message clean culture surface speed forwarding of destination address.
As shown in Figure 4, the hash-collision solving device of first embodiment of the invention comprises control module, collision detection module, collision table module and establishment and safeguards the address table module of mac address table;
Described control module is transmitted in described hash-collision detection module with the MAC Address of learning in the MAC address learning process and carries out the detection of MAC Address hash-collision; And the MAC Address that hash-collision takes place for hash-collision detection module report is transmitted in the collision table module stores; And control described transceiver module according to described conflict mac address table to the conflict MAC be the message clean culture surface speed forwarding of destination address.
Control module comprises storage control unit and transmits control unit.
Described storage control module, in the process of MAC address learning,, be transmitted in the hash-collision detection module and detect for the MAC Address of not learning that transceiver module transmits, and control described address table module, the MAC Address that hash-collision does not take place is stored in mac address table; Control described collision table module, the MAC Address of will conflicting is stored in mac address table;
Described forwarding control unit is controlled described forwarding module, according to the described mac address table and the address table that conflicts, and the described message of clean culture surface speed forwarding;
Described Hash detection module, realization is to the detection of MAC Address hash-collision, the feedback of receiver address table module, for example working as certain Hash bucket is filled with, in the time of can not storing new MAC Address again, return the full information of this Hash bucket to the Hash detection module, hash-collision takes place to the control module report in described Hash detection module, thereby realizes the detection to hash-collision.When hash-collision took place, storage control unit control hazard table module was stored in the MAC Address that hash-collision takes place the conflict mac address table of collision table module.
Described conflict mac address table needs to preserve source port information and the vlan information of source address for the message of conflict MAC Address at least.In described conflict address table, can also preserve about other forwarding attributes of this MAC Address or the maintenance information of this MAC Address.
Described hash-collision solving device also comprises the address table module, and the mac address table of its maintenance is used to preserve the MAC Address that does not detect hash-collision; Described control module is controlled described transceiver module receiving when being the message of destination address with the MAC Address in the mac address table, according to mac address table message is carried out the clean culture surface speed forwarding.
Described transceiver module: comprise receiving element and retransmission unit; Described receiving element receives the MAC Address that exchange chip is learnt, and it is inputed to control module; Described retransmission unit, receive the control command of described forwarding control module, to destination address be in the mac address table message by described conflict mac address table carry out the clean culture surface speed forwarding, to destination address for the conflict MAC Address message carry out the clean culture surface speed forwarding by described conflict mac address table.Described forwarding control unit disposes the acl rule of described transceiver module according to the conflict mac address table in the collision table module, and described transceiver module E-Packets according to described acl rule clean culture.Described forwarding control unit issues and is redirected acl rule and gives described retransmission unit, and described retransmission unit carries out clean culture surface speed forwarding to destination address for the message of conflict MAC Address according to described acl rule.
The hash-collision solving device of second embodiment of the invention, as shown in Figure 5, its control module, transceiver module, address table module, collision table module are identical with the hash-collision solving device of first embodiment, different is, described hash-collision detection module also comprises the interrupt response unit, described interrupt response unit is used to receive and identify the interrupt notification of the generation hash-collision that exchange chip sends, after described collision detection module receives described interrupt notification, to described control module report hash-collision takes place.
Hash-collision of the present invention detects checkout gear, can be applied to the switching equipment of message being transmitted by MAC address learning.
Switching equipment of the present invention has hash-collision checkout gear of the present invention.Switching equipment of the present invention both can be switch, router or other switching equipment.
Above-described only is preferable possible embodiments of the present invention; described embodiment is not in order to limit scope of patent protection of the present invention; therefore the equivalent structure done of every utilization specification of the present invention and accompanying drawing content changes, and in like manner all should be included in protection scope of the present invention.