Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a method and a system for forwarding a broadcast message.
In a first aspect, an embodiment of the present invention provides a method for forwarding a broadcast packet, where the method includes:
receiving a broadcast message, and calculating a hash value of the broadcast message;
determining n virtual switch links VSLs corresponding to the broadcast message according to the mapping relation between the hash value and the VSLs, wherein n is greater than or equal to 1;
and forwarding the broadcast message according to the forwarding behavior in the broadcast filtering table entry corresponding to the hash value and configured by the chip corresponding to each of the n virtual switch links VSL.
As above method, optionally, after determining n virtual switch links VSL corresponding to the broadcast packet, the method further includes:
when n is larger than or equal to 2, determining a first virtual switching link VSL in the n virtual switching links VSL according to the mapping relation between the hash value and the virtual switching link VSL;
configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switch link VSL is located as allowing forwarding;
configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the other virtual switching links VSL except the first virtual switching link VSL in the n virtual switching links VSL are located to forbid forwarding.
As above method, optionally, the determining a first virtual switching link VSL in the n virtual switching links VSL according to the mapping relationship between the hash value and the virtual switching link VSL includes:
if N is presentHAnd if the number of the links is more than or equal to N, determining a first virtual switch link VSL in the N virtual switch links VSLs according to all hash values of the total number of the links, wherein N is the total number of the links, and N is the total number of the linksHIs the hash value total.
As in the above method, optionally, the determining a first virtual switch link VSL in the n virtual switch links VSLs by equally dividing all hash values according to the total number of links includes:
determining at least one hash value forwarded by each virtual switch link VSL configuration according to the following formula:
Yi=(i-1)+NV*j
wherein i is more than or equal to 1 and less than or equal to n, j is more than or equal to 0, i and j are integers, and Yi≤NH,YiA hash value configured for the ith virtual switch link VSL;
and configuring the virtual switching link VSL for forwarding the hash value as a first virtual switching link VSL in the n virtual switching links VSL. .
The method optionally further comprises:
if the total number n of the links of the VSL is judged to be changed, updating the total number of the links of the VSL;
updating the mapping relation between the hash value and the virtual switch link VSL according to the updated total number of the links;
determining a pre-update forwarding behavior in a broadcast filtering table entry corresponding to each hash value in a chip where each virtual switch link VSL is located according to the updated mapping relation, and marking a configuration result as unprocessed;
traversing all unprocessed broadcast filtering table entries in the changed virtual switching link VSL, if the forwarding behavior in a second broadcast filtering table entry corresponding to the hash value in a chip where a second virtual switching link VSL in the changed virtual switching link VSL is located is pre-updated from allowing forwarding to forbidding forwarding, updating the forwarding row in the second broadcast filtering table entry corresponding to the hash value in the second virtual switching link VSL to forbidding forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filtering table entry to be processed;
if the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the chip where the second virtual switching link VSL in the virtual switching links VSL is located is from forbidding forwarding and pre-updating to allowing forwarding, traversing all processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL except the second virtual switch link VSL are located in the changed virtual switch link VSL, if all forwarding behaviors in the processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL are located are prohibited from forwarding, updating the forwarding behavior in the second broadcast filter table entry corresponding to the hash value in the chip where the second virtual switch link VSL is located to allow forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed.
The method optionally further comprises:
if the configuration result corresponding to the hash value in the second broadcast filter table entry is processed, notifying the configuration result corresponding to the hash value to other virtual switch links VSL.
In a second aspect, an embodiment of the present invention provides a system for forwarding a broadcast packet, including:
the receiving module is used for receiving a broadcast message and calculating the hash value of the broadcast message;
the mapping module is used for determining n virtual switch links VSLs corresponding to the broadcast message according to the mapping relation between the hash value and the VSLs, wherein n is greater than or equal to 1;
and the forwarding module is used for forwarding the broadcast message according to a forwarding behavior in a broadcast filtering table entry corresponding to the hash value and configured by a chip corresponding to each of the n virtual switch links VSL.
The system as described above, optionally, further comprising:
a selecting module, configured to determine, when n is greater than or equal to 2, a first virtual switch link VSL in the n virtual switch links VSL according to a mapping relationship between the hash value and the virtual switch link VSL;
a first configuration module, configured to configure a forwarding behavior in a broadcast filtering table entry corresponding to the hash value in a chip where the first virtual switch link VSL is located as allowing forwarding;
a second configuration module, configured to configure, as a prohibition of forwarding, a forwarding behavior in a broadcast filtering table entry corresponding to the hash value in a chip where other virtual switching links VSLs, except for the first virtual switching link VSL, of the n virtual switching links VSL are located.
As with the system above, optionally, the selection module is specifically configured to:
if N is presentHAnd if the number of the links is more than or equal to N, determining a first virtual switch link VSL in the N virtual switch links VSLs according to all hash values of the total number of the links, wherein N is the total number of the links, and N is the total number of the linksHIs the hash value total.
As with the system above, optionally, the selection module is specifically configured to:
determining at least one hash value forwarded by each virtual switch link VSL configuration according to the following formula:
Yi=(i-1)+NV*j
wherein i is more than or equal to 1 and less than or equal to n, j is more than or equal to 0, i,j is an integer, and Yi≤NH,YiA hash value configured for the ith virtual switch link VSL;
and configuring the virtual switching link VSL for forwarding the hash value as a first virtual switching link VSL in the n virtual switching links VSL.
The system as described above, optionally, further comprising:
the link total number updating module is used for updating the link total number of the virtual switching link VSL if the fact that the link total number n of the virtual switching link VSL changes is judged and known;
the mapping relation updating module is used for updating the mapping relation between the hash value and the virtual switch link VSL according to the updated total number of the links;
the pre-configuration module is used for determining pre-update forwarding behaviors in the broadcast filtering table entry corresponding to each hash value in the chip where each virtual switch link VSL is located according to the updated mapping relation, and marking a configuration result as unprocessed;
a first forwarding updating module, configured to traverse all unprocessed broadcast filtering table entries in a changed virtual switch link VSL, if a forwarding behavior in a second broadcast filtering table entry corresponding to the hash value in a chip in which a second virtual switch link VSL in the virtual switch link VSL is located is pre-updated from allowing forwarding to prohibiting forwarding, update a forwarding behavior in the second broadcast filtering table entry corresponding to the hash value to prohibiting forwarding, and update a configuration result corresponding to the hash value in the second broadcast filtering table entry to processed;
a second forwarding behavior updating module, configured to, if the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the chip where the second virtual switching link VSL in the virtual switching links VSL is located is from forbidding forwarding and pre-updating to allowing forwarding, traversing all processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL except the second virtual switch link VSL are located in the changed virtual switch link VSL, if all forwarding behaviors in the processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL are located are prohibited from forwarding, updating the forwarding behavior in the second broadcast filter table entry corresponding to the hash value in the chip where the second virtual switch link VSL is located to allow forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed.
The system as described above, optionally, further comprising:
and the notification module is used for notifying the configuration result corresponding to the hash value to other virtual switch links VSLs if the configuration result corresponding to the hash value in the second broadcast filter table entry is processed.
According to the broadcast message forwarding method provided by the embodiment of the invention, the broadcast message is distributed to different virtual exchange links according to the hash value by using the broadcast filtering table entry of the chip through the hash value of the broadcast message, so that the limitation that a cross-chip VSL port cannot form a physical TRUNK is avoided, the purpose of balancing cross-equipment broadcast flow according to the hash value is realized, the packet loss of the virtual exchange link caused by overlarge broadcast flow is reduced, and the stable operation of a cross-equipment system is ensured.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 2 is a schematic flow chart of a forwarding method of a broadcast packet according to an embodiment of the present invention, and as shown in fig. 2, the forwarding method includes:
step S21, receiving a broadcast message, and calculating the hash value of the broadcast message;
specifically, in a chassis type stack system (VSU), after a panel port of one of the switching devices receives a packet, if the packet is determined to be a broadcast packet, the broadcast packet is forwarded to the other switching devices through VSL links between the switching device and the other switching devices, for example, as shown in fig. 1, after the panel port of the switch 1 receives the broadcast packet, the broadcast packet is forwarded to three VSL ports of the switch 1: 2. 4, 6, the three VSL ports forward the broadcast packet to the switch 2 through the corresponding links VSL1, VSL2, and VSL, and in order to solve the problem of broadcast traffic balance among different switching devices, the present invention is different from directly forwarding the broadcast packet to the VSL ports.
Step S22, determining n virtual switch links VSL corresponding to the broadcast message according to the mapping relation between the hash value and the VSL, wherein n is greater than or equal to 1;
specifically, a mapping relationship between a hash value and a virtual switch link VSL is set according to the number of VSL links used for balancing and the hash value range of a broadcast packet, for example, m1 VSL links exist in a virtual switch unit VSU, where m2 VSL links are used for balanced forwarding of the broadcast packet (m2 < m1), and the hash value range of the broadcast packet is 0-1023, then the 1024 hash values are distributed to m2 VSL links to form a mapping relationship between the hash value and the VSL of the virtual switch link, that is, each hash value corresponds to m2 VSL links, and according to the mapping relationship, n virtual links VSL corresponding to each broadcast packet are determined to represent n VSL links that may forward the broadcast packet, where n is greater than or equal to 1. For example, the virtual switch link VSL corresponding to the broadcast packet with hash value 1 is VSL 1. The broadcast message is uniformly forwarded through the Hash value, cross-equipment broadcast flow in the VSU can be more randomly balanced to different VSL links, and broadcast forwarding with the maximum bandwidth in the VSU is realized.
Step S23, forwarding the broadcast packet according to the forwarding behavior in the broadcast filtering table entry corresponding to the hash value and configured by the chip corresponding to each of the n virtual switch links VSL.
Specifically, a broadcast filtering table entry exists on a hardware chip inside the switch device, and the function of the broadcast filtering table entry is to implement selective forwarding of broadcast messages among multiple HG member ports in the physical TRUNK by configuring the table entry, that is, 1 specific broadcast message can only be forwarded from part of the HG member ports of the physical TRUNK. The index of the table entry is the HASH value of the message, and the indexed content is a port bitmap which identifies all HG ports to which the message is prohibited from being forwarded. On the chip, the HASH value is calculated by the chip, the value range of the value is 0-1023, namely 1024 entries exist in the broadcast filtering entries. In the current switching equipment, the table entry is used for realizing the broadcast filtering function in the same chip, so that the HG broadcast balance of cross-chips can be realized through the unified distribution management of the broadcast filtering table entries on different chips, and further, the broadcast balance of VSL ports can be realized. Specifically, a forwarding behavior in a broadcast filtering table entry corresponding to the HASH value corresponding to the VSL in the mapping relationship is configured in advance in a chip where the virtual switch link VSL is located (i.e., a chip of a VSL port corresponding to the link), where the forwarding behavior includes allowing forwarding and prohibiting forwarding, so that broadcast messages corresponding to the HASH value can only be forwarded from one or more corresponding VSL links, thereby implementing balanced forwarding of the broadcast messages.
Therefore, after the hash value of the broadcast message is obtained through calculation, the broadcast message can be forwarded in a balanced manner according to the hash value and the forwarding behavior in the broadcast filtering table entry corresponding to the hash value and configured by the chip corresponding to each of the n corresponding VSL links.
According to the broadcast message forwarding method provided by the embodiment of the invention, the broadcast message is distributed to different virtual exchange links according to the hash value by using the broadcast filtering table entry of the chip through the hash value of the broadcast message, so that the limitation that a cross-chip VSL port cannot form a physical TRUNK is avoided, the purpose of balancing cross-equipment broadcast flow according to the hash value is realized, the packet loss of the virtual exchange link caused by overlarge broadcast flow is reduced, and the stable operation of a cross-equipment system is ensured.
On the basis of the foregoing embodiment, further, after determining the n virtual switch links VSL corresponding to the broadcast packet, the method further includes:
when n is larger than or equal to 2, determining a first virtual switching link VSL in the n virtual switching links VSL according to the mapping relation between the hash value and the virtual switching link VSL;
configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switch link VSL is located as allowing forwarding;
configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the other virtual switching links VSL except the first virtual switching link VSL in the n virtual switching links VSL are located to forbid forwarding.
Specifically, in order to obtain a better balancing effect, when the number n of VSL links corresponding to a certain hash value in the mapping relationship is greater than or equal to 2, one of the n VSL links may be selected to forward the broadcast packet corresponding to the hash value, and the link is marked as the first virtual switch link VSL. Specifically, one of the virtual switch links may be randomly selected as the first virtual switch link VSL, or one of the virtual switch links may be selected as the first virtual switch link VSL according to other rules.
And then configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switch link VSL is located as allowing forwarding, and configuring the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the other n-1 VSL links except the first virtual switch link VSL are located in the n VSL links as forbidding forwarding.
After the hash value of the broadcast message is obtained through calculation, the broadcast message is only forwarded from the VSL, so that the broadcast message corresponding to one hash value is only forwarded from one VSL, the broadcast message is distributed to different virtual switching links according to the hash value in a balanced manner, the purpose of balancing cross-device broadcast flow according to the hash value is achieved, packet loss of the virtual switching links due to overlarge broadcast flow is reduced, and stable operation of a cross-device system is guaranteed.
For example, as shown in fig. 1, there are three VSL links deployed in 2 slots, 4 slots, and 6 slots of switch 1 and 11 slots, 13 slots, and 15 slots of switch 2. When a VSL port is created, it will be added to all VLANs. Thus, broadcast messages received from switch 1 panel port are forwarded to three VSL ports of switch 1. Assuming that the HASH value of the broadcast packet is 100, on the switch 1, the bit corresponding to the VSL port in the port bitmap of the 100 th entry in the broadcast filter entry configured with 2 slots is 0, which indicates that forwarding from the VSL port is allowed, and the bit corresponding to the VSL port in the port bitmap of the 100 th entry in the broadcast filter entries configured with 4 slots and 6 slots is 1, which indicates that forwarding from the VSL ports of 4 slots and 6 slots is prohibited. So that the message is forwarded only from the VSL1 link to switch 2. Similarly, for different broadcast messages, 1024 HASH values are uniformly distributed on the three VSL links, and each HASH result is guaranteed to be only allowed to be forwarded by one VSL port, so that the broadcast messages can be guaranteed to be uniformly distributed on the three VSL links. The broadcast filter table entry configuration for three slots 2, 4, and 6 of switch 1 is shown in table 1:
table 1 VSL slot broadcast filter table entry configuration table for switch 1
Through the table 1, the HASH values can be distributed in a balanced manner, so that the broadcast traffic balance among the devices is realized.
According to the broadcast message forwarding method provided by the embodiment of the invention, the cross-device broadcast message is balanced to all virtual switching links according to the hash value of the broadcast message and the broadcast filtering table entry in the hardware chip, so that the possibility of cross-device forwarding packet loss caused by poor broadcast flow balancing effect is reduced, and the stable operation of a cross-device system is ensured.
On the basis of the foregoing embodiments, further, the determining a first virtual switching link VSL in the n virtual switching links VSL according to the mapping relationship between the hash value and the virtual switching link VSL includes:
if N is presentHAnd if the number of the links is more than or equal to N, determining a first virtual switch link VSL in the N virtual switch links VSLs according to all hash values of the total number of the links, wherein N is the total number of the links, and N is the total number of the linksHIs the hash value total.
Specifically, since the total number of hash values of the broadcast packet is fixed, when the total number of hash values N is fixedHWhen the number of hash values is greater than or equal to n, for example, the total number of hash values is 1024, and the total number n of virtual links is 4, at this time, one VSL virtual link may need to forward broadcast messages corresponding to multiple hash values, in order to ensure balanced forwarding effect, the hash values may be uniformly divided into hash value groups of the total number of links, and each hash value group is allocated to one VSL link, so that the broadcast message corresponding to one or more hash values allowed to be forwarded by each VSL link may be determined. For example, if the total number of hash values is 1024 and the total number of links n is 4, the hash values can be divided into 4 equal parts, for example, the division is 0-255, 256-511, 512-767, 768-1023, and each group of hash values is allocated to one VSL link, that is, each group of hash values is allocated to one VSL linkAnd the first virtual switching link VSL corresponding to the group of hash values. For example, the first virtual switch link corresponding to the hash values 0-255 is VSL1, the first virtual switch link corresponding to the hash values 256-511 is VSL2, the first virtual switch link corresponding to the hash values 512-767 is VSL3, and the first virtual switch link corresponding to the hash values 768-1023 is VSL 4. After the first virtual switching link VSL corresponding to each hash value is determined, the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switching link VSL is located is configured to be allowed to forward, and the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the n-1 VSL links except the first virtual switching link VSL are located is configured to be forbidden to forward. The hash values are distributed to different VSL links in a balanced mode, so that a better balanced effect of cross-chip forwarding of the broadcast messages is achieved.
According to the broadcast message forwarding method provided by the embodiment of the invention, the broadcast message is distributed to different virtual switching links according to the hash value in a balanced manner by using the broadcast filtering table entry of the chip through the hash value of the broadcast message, so that the purpose of balancing cross-device broadcast flow according to the hash value is realized, the packet loss of the virtual switching links caused by overlarge broadcast flow is reduced, and the stable operation of a cross-device system is ensured.
On the basis of the foregoing embodiments, further, the determining a first virtual switch link VSL in the n virtual switch links VSL according to all hash values of the total number of links includes:
determining at least one hash value forwarded by each virtual switch link VSL configuration according to the following formula:
Yi=(i-1)+NV*j
wherein i is more than or equal to 1 and less than or equal to n, j is more than or equal to 0, i and j are integers, and Yi≤NH,YiA hash value configured for the ith virtual switch link VSL;
and configuring the virtual switching link VSL for forwarding the hash value as a first virtual switching link VSL in the n virtual switching links VSL.
Specifically, for a VSU environment with n VSLs, the hash value forwarded by the ith (i is greater than or equal to 1 and less than or equal to n, i is an integer) VSL link configuration is:
Yi=(i-1)+NV*j
wherein j is 0,1, …, and (i-1) + NV*j≤NHAnd then, the VSL link configured to forward the HASH value is used as a first virtual switching link VSL corresponding to the HASH value, and after the forwarding behaviors of the n VSL links are configured according to the algorithm, the broadcast message can be automatically balanced to the n VSL links according to the HASH result, so that the maximum utilization of the bandwidth is realized. In practical application, the message which is received by the VSL port and is not in the local case is not forwarded from the VSL port, so that a loop is prevented.
For example, if the total number of hash values is 1024 and the total number of links is 3, the VSL1 configures the forwarded hash values to be 0,3,6,9, …,1023, the VSL2 configures the forwarded hash values to be 1,4,7,10, …,1021, and the VSL3 configures the forwarded hash values to be 2,5,8,11, …, 1022.
According to the broadcast message forwarding method provided by the embodiment of the invention, the cross-equipment broadcast message is balanced to all virtual switching links according to the hash value of the broadcast message, so that the possibility of packet loss caused by cross-equipment forwarding due to poor broadcast flow balancing effect is reduced, and the stable operation of a cross-equipment system is ensured.
On the basis of the above embodiments, further, the method further includes:
if the total number n of the links of the VSL is judged to be changed, updating the total number of the links of the VSL;
updating the mapping relation between the hash value and the virtual switch link VSL according to the updated total number of the links;
determining a pre-update forwarding behavior in a broadcast filtering table entry corresponding to each hash value in a chip where each virtual switch link VSL is located according to the updated mapping relation, and marking a configuration result as unprocessed;
traversing all unprocessed broadcast filtering table entries in the changed virtual switching link VSL, if the forwarding behavior in a second broadcast filtering table entry corresponding to the hash value in a chip where a second virtual switching link VSL in the changed virtual switching link VSL is located is pre-updated from allowing forwarding to forbidding forwarding, updating the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the second broadcast filtering table entry to forbidding forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filtering table entry to be processed;
if the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the chip where the second virtual switching link VSL in the virtual switching links VSL is located is from forbidding forwarding and pre-updating to allowing forwarding, traversing all processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL except the second virtual switch link VSL are located in the changed virtual switch link VSL, if all forwarding behaviors in the processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL are located are prohibited from forwarding, updating the forwarding behavior in the second broadcast filter table entry corresponding to the hash value in the chip where the second virtual switch link VSL is located to allow forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed.
Specifically, in the actual application process, since the VSL links are established at different times, the configuration process when the VSL links are changed needs to be considered. When the VSL link changes, if VLAN is used for broadcast equalization, time consumption is large for VLAN member change configuration, and packet loss occurs for a long time. In order to reduce the time consumption of configuration and avoid long-time packet loss, in the embodiment of the present invention, the VSL link change is divided into VSL joining and VSL exiting, and the processing logics of the two events are the same:
when the total number n of the virtual switch link VSL corresponding to the hash value in the mapping relationship changes, the total number of the VSL link is updated, the updated total number of the link is recorded as n1, the mapping relationship between the hash value and the virtual switch link VSL is reconfigured according to the updated total number n1, and the pre-update forwarding behavior in the broadcast filter table entry corresponding to each hash value in the chip where each virtual switch link VSL is located is determined according to the updated mapping relationship. In order to avoid multiple copies of the same message, it is necessary to always keep that 1 HASH value can only be forwarded from 1 VSL link, and when the pre-update forwarding behavior in the broadcast filtering table entry of one VSL link is determined, it cannot be guaranteed that multiple copies of forwarding do not occur after the configuration result is configured to hardware. Therefore, a certain algorithm is required to control the timing.
Specifically, after determining a pre-update forwarding behavior in a broadcast filtering table entry corresponding to each hash value in a chip where each virtual switch link VSL is located according to an updated mapping relationship, firstly marking a configuration result as unprocessed, traversing all unprocessed broadcast filtering table entries in the virtual switch link VSL, if a certain virtual switch link in the virtual switch link VSL after change is marked as a second virtual switch link VSL, and a forwarding behavior in a second broadcast filtering table entry corresponding to a certain hash value in the chip is pre-updated from allowed forwarding to prohibited forwarding, updating a forwarding row in the second broadcast filtering table entry corresponding to the hash value in the second broadcast filtering table entry to prohibited forwarding, and updating a configuration result corresponding to the hash value in the second broadcast filtering table entry to processed; if the forwarding behavior in the second broadcast filtering table entry corresponding to a certain hash value in the chip where the second virtual switching link VSL in the virtual switching link VSL is located is pre-updated from forwarding prohibition to forwarding permission, traversing all processed broadcast filtering table entries corresponding to the hash value in the chip where the other virtual switching links VSLs except the second virtual switching link VSL in the changed virtual switching link VSL are located, if all the forwarding behaviors in the processed broadcast filtering table entries corresponding to the hash value in the chip where the other virtual switching links VSLs are located are forwarding prohibition, updating the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the chip where the second virtual switching link VSL is located to forwarding permission, and updating the configuration result corresponding to the hash value in the second broadcast filtering table entry to processed. Otherwise, skipping the broadcast filtering table entry, and continuing to process the next unprocessed table entry, so that only when the configuration result corresponding to a certain hash value in the broadcast filtering table entry corresponding to each VSL link in n1 VSL links is prohibited from being forwarded, the configuration result corresponding to the hash value in the broadcast filtering table entry in the certain VSL link is allowed to be updated to be allowed to be forwarded, it is ensured that a broadcast message corresponding to a hash value can still be forwarded from only one VSL when the VSL link is changed, and broadcast packet loss caused by VSL link change is reduced.
According to the broadcast message forwarding method provided by the embodiment of the invention, the cross-device broadcast message is balanced to all virtual switch links according to the hash value of the broadcast message and the broadcast filtering table entry in the hardware chip, and when the VSL link changes, the VLAN member change of the VSL port is cancelled, so that the configuration time is shortened, the broadcast packet loss caused by the VSL link change is reduced, and the stable operation of a cross-device system is ensured.
On the basis of the above embodiments, further, the method further includes:
if the configuration result corresponding to the hash value in the second broadcast filter table entry is processed, notifying the configuration result corresponding to the hash value to other virtual switch links VSL.
Specifically, when the configuration result corresponding to the hash value in the second broadcast filter table entry is processed, the broadcast filter table entry is already configured in hardware, and at this time, the configuration result corresponding to the hash value is notified to other virtual switch links VSL, so that each processed broadcast filter table entry can be known by other VSL links.
Fig. 3 is a schematic diagram of a configuration process of a broadcast filter table entry according to an embodiment of the present invention, as shown in fig. 3, the configuration process includes:
and step S31, judging whether the number of VSL links in the n VSL links corresponding to the hash value changes, if so, executing step S32, otherwise, not processing. When the VSL is established, the VSL link is determined to be added according to the establishment notice, and when the VSL link exits, the VSL link is determined to be deleted according to the exit notice;
step S32, determining the configuration information in the broadcast filter table item corresponding to each hash value in the chip where each VSL link is located based on the VSL link number n1 again, namely, pre-updating and issuing the configuration information, and marking the configuration result as unprocessed;
step S33, traversing all unprocessed broadcast filter table entries, and judging that the pre-update behavior of the broadcast filter table entry corresponding to a certain hash value in the unprocessed broadcast filter table entries is allowed to be forwarded, if so, executing step S34, otherwise, executing step S35;
step S34, determining whether the pre-update issuance of other broadcast filter table entries corresponding to the HASH value in the processed broadcast filter table entries is prohibited from forwarding, that is, for a HASH value, whether the pre-update forwarding behaviors of other broadcast filter table entries corresponding to the HASH value are prohibited from forwarding, if yes, executing step S36, otherwise, skipping the table entry, executing step S37, where the VSL link is obtained by receiving other VSL link announcements;
step S35, judging whether the pre-update forwarding behavior of the table entry is changed from allowable forwarding to forbidden forwarding, if yes, executing step S36;
step S36, configuring the pre-changed broadcast filtering table item, notifying the configured result to other VSL links, and marking the table item as processed;
step S37, determine whether all broadcast filter entries are configured completely, that is, whether there are any unprocessed entries, if yes, continue to execute step S33.
After each traversal, the next traversal can be performed after waiting for 10ms, so as to prevent the CPU from occupying too high. Through the process, cross-device broadcast streams in the VSU system are balanced on all VSL links according to the HASH values, and the balancing effect can be controlled by adjusting the HASH algorithm. Except for the VSU system, other scenes related to cross-chip broadcast balance among HG ports can utilize the broadcast balance forwarding method provided by the embodiment of the invention to realize the balance of broadcast flow.
According to the broadcast message forwarding method provided by the embodiment of the invention, the cross-device broadcast message is balanced to all virtual switch links according to the hash value of the broadcast message and the broadcast filtering table entry in the hardware chip, the cross-device broadcast flow is balanced, the packet loss of a VSL link caused by overlarge broadcast flow is reduced, and the more stable operation of a system is ensured. Meanwhile, the configuration time when the VSL link changes is reduced, and the number of lost packets is reduced.
Fig. 4 is a schematic structural diagram of a forwarding system of a broadcast packet according to an embodiment of the present invention, and as shown in fig. 4, the forwarding system includes: a receiving module 41, a mapping module 42 and a forwarding module 43, wherein:
the receiving module 41 is configured to receive a broadcast packet and calculate a hash value of the broadcast packet; the mapping module 42 is configured to determine n virtual switch links VSL corresponding to the broadcast packet according to a mapping relationship between the hash value and the virtual switch link VSL, where n is greater than or equal to 1; the forwarding module 43 is configured to forward the broadcast packet according to a forwarding behavior in the broadcast filtering table entry corresponding to the hash value and configured by the chip corresponding to each of the n virtual switch links VSL.
Specifically, the receiving module 41 receives a broadcast packet, calculates a hash value of the broadcast packet, the mapping module 42 presets a mapping relationship between the hash value and the virtual switch link VSL, determines n virtual switch links VSL corresponding to the broadcast packet according to the calculated hash value and the mapping relationship, and the forwarding module 43 presets forwarding behaviors in broadcast filter table entries corresponding to the hash value on respective chips corresponding to the n virtual switch links VSL, including allowing forwarding and prohibiting forwarding. And forwarding the broadcast message according to forwarding behaviors in the broadcast filtering table entry corresponding to the hash value configured by the chip corresponding to each of the n virtual switch links VSL. The system provided in the embodiment of the present invention is configured to implement the method, and the functions of the system specifically refer to the method embodiment, which is not described herein again.
According to the broadcast message forwarding system provided by the embodiment of the invention, the broadcast messages are distributed to different virtual exchange links in a balanced manner according to the hash values by using the broadcast filtering table items of the chip through the hash values of the broadcast messages, so that the limitation that cross-chip VSL ports cannot form physical TRUNK is avoided, the purpose of balancing cross-equipment broadcast flow according to the hash values is realized, the packet loss of the virtual exchange links caused by overlarge broadcast flow is reduced, and the stable operation of a cross-equipment system is ensured.
On the basis of the above embodiment, further, the method further includes:
a selecting module, configured to determine, when n is greater than or equal to 2, a first virtual switch link VSL in the n virtual switch links VSL according to a mapping relationship between the hash value and the virtual switch link VSL;
a first configuration module, configured to configure a forwarding behavior in a broadcast filtering table entry corresponding to the hash value in a chip where the first virtual switch link VSL is located as allowing forwarding;
a second configuration module, configured to configure, as a prohibition of forwarding, a forwarding behavior in a broadcast filtering table entry corresponding to the hash value in a chip where other virtual switching links VSLs, except for the first virtual switching link VSL, of the n virtual switching links VSL are located.
Specifically, when the number n of VSL links corresponding to a hash value in the mapping relationship is greater than or equal to 2, the selection module may select one of the n VSL links to forward the broadcast packet corresponding to the hash value, where the link is marked as the first virtual switch link VSL. Specifically, the selection module may randomly select one of the virtual switch links as the first virtual switch link VSL, or select one of the virtual switch links as the first virtual switch link VSL according to other rules. And then the first configuration module configures the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switch link VSL is located as allowed forwarding, and the second configuration module configures the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the other n-1 VSL links except the first virtual switch link VSL are located in the n VSL links as forbidden forwarding.
After the hash value of the broadcast message is obtained through calculation, the broadcast message is only forwarded from the VSL, so that the broadcast message corresponding to one hash value is only forwarded from one VSL, the broadcast message is distributed to different virtual switching links according to the hash value in a balanced manner, the purpose of balancing cross-device broadcast flow according to the hash value is achieved, packet loss of the virtual switching links due to overlarge broadcast flow is reduced, and stable operation of a cross-device system is guaranteed.
On the basis of the foregoing embodiments, further, the selecting module is specifically configured to:
if N is presentHAnd if the number of the links is more than or equal to N, determining a first virtual switch link VSL in the N virtual switch links VSLs according to all hash values of the total number of the links, wherein N is the total number of the links, and N is the total number of the linksHIs the hash value total.
Specifically, since the total number of hash values of the broadcast packet is fixed, when the total number of hash values N is fixedHWhen the number of hash values is greater than or equal to n, for example, the total number of hash values is 1024, and the total number n of virtual links is 4, at this time, one VSL virtual link may need to forward broadcast messages corresponding to multiple hash values, in order to ensure balanced forwarding effect, the hash values may be uniformly divided into hash value groups of the total number of links, and each hash value group is allocated to one VSL link, so that the broadcast message corresponding to one or more hash values allowed to be forwarded by each VSL link may be determined. After the first virtual switching link VSL corresponding to each hash value is determined, the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the first virtual switching link VSL is located is configured to be allowed to forward, and the forwarding behavior in the broadcast filtering table entry corresponding to the hash value in the chip where the n-1 VSL links except the first virtual switching link VSL are located is configured to be forbidden to forward. The hash values are distributed to different VSL links in a balanced mode, so that a better balanced effect of cross-chip forwarding of the broadcast messages is achieved.
On the basis of the above-mentioned embodiments, further,
the selection module is specifically configured to:
determining at least one hash value forwarded by each virtual switch link VSL configuration according to the following formula:
Yi=(i-1)+NV*j
wherein i is more than or equal to 1 and less than or equal to n, j is more than or equal to 0, i and j are integers, and Yi≤NH,YiA hash value configured for the ith virtual switch link VSL;
and configuring the virtual switching link VSL for forwarding the hash value as a first virtual switching link VSL in the n virtual switching links VSL.
Specifically, for a VSU environment with n VSLs, the hash value forwarded by the ith (i is greater than or equal to 1 and less than or equal to n, i is an integer) VSL link configuration is:
Yi=(i-1)+NV*j
wherein j is 0,1, …, and (i-1) + NV*j≤NHAnd then, the VSL link configured to forward the HASH value is used as a first virtual switching link VSL corresponding to the HASH value, and after the forwarding behaviors of the n VSL links are configured according to the algorithm, the broadcast message can be automatically balanced to the n VSL links according to the HASH result, so that the maximum utilization of the bandwidth is realized. In practical application, the message which is received by the VSL port and is not in the local case is not forwarded from the VSL port, so that a loop is prevented. The system provided in the embodiment of the present invention is configured to implement the method, and the functions of the system specifically refer to the method embodiment, which is not described herein again.
According to the broadcast message forwarding system provided by the embodiment of the invention, the cross-equipment broadcast message is balanced to all virtual switching links according to the hash value of the broadcast message, so that the possibility of packet loss caused by cross-equipment forwarding due to poor broadcast flow balancing effect is reduced, and the stable operation of a cross-equipment system is ensured.
On the basis of the above embodiments, further, the system further includes:
the link total number updating module is used for updating the link total number of the virtual switching link VSL if the fact that the link total number n of the virtual switching link VSL changes is judged and known;
the mapping relation updating module is used for updating the mapping relation between the hash value and the virtual switch link VSL according to the updated total number of the links;
the pre-configuration module is used for determining pre-update forwarding behaviors in the broadcast filtering table entry corresponding to each hash value in the chip where each virtual switch link VSL is located according to the updated mapping relation, and marking a configuration result as unprocessed;
a first forwarding updating module, configured to traverse all unprocessed broadcast filtering table entries in a changed virtual switch link VSL, if a forwarding behavior in a second broadcast filtering table entry corresponding to the hash value in a chip in which a second virtual switch link VSL in the virtual switch link VSL is located is pre-updated from allowing forwarding to prohibiting forwarding, update a forwarding behavior in the second broadcast filtering table entry corresponding to the hash value to prohibiting forwarding, and update a configuration result corresponding to the hash value in the second broadcast filtering table entry to processed;
a second forwarding behavior updating module, configured to, if the forwarding behavior in the second broadcast filtering table entry corresponding to the hash value in the chip where the second virtual switching link VSL in the virtual switching links VSL is located is from forbidding forwarding and pre-updating to allowing forwarding, traversing all processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL except the second virtual switch link VSL are located in the changed virtual switch link VSL, if all forwarding behaviors in the processed broadcast filter table entries corresponding to the hash value in the chip where the other virtual switch links VSL are located are prohibited from forwarding, updating the forwarding behavior in the second broadcast filter table entry corresponding to the hash value in the chip where the second virtual switch link VSL is located to allow forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed.
Specifically, when the total number n of links of the virtual switch link VSL changes, the total number update module updates the total number of links of the VSL link, and records the updated total number of links as n1, the mapping relationship update module reconfigures the mapping relationship between the hash value and the virtual switch link VSL according to the updated total number n1, the pre-configuration module determines the pre-updated forwarding behavior in the broadcast filter table entry corresponding to each hash value in the chip where each virtual switch link VSL is located according to the updated mapping relationship, and marks the configuration result as unprocessed, and then the first forwarding module traverses all the unprocessed broadcast filter table entries in the virtual switch link VSL, if a certain virtual switch link in the changed virtual switch link VSL is recorded as a second virtual switch link VSL, the forwarding behavior in the second broadcast filter table entry corresponding to the certain hash value in the chip is pre-updated from forwarding allowed to forwarding prohibited, updating the forwarding row in the second broadcast filter table entry corresponding to the hash value in the second broadcast filter table entry to be prohibited from forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed; if the forwarding behavior in the second broadcast filter table entry corresponding to a certain hash value in the chip where the second virtual switch link VSL in the virtual switch links VSL is located is pre-updated from forbidding forwarding to allowing forwarding, the second forwarding behavior updating module traverses all the processed broadcast filtering table entries corresponding to the hash value in the chip where the other virtual switching links VSL except the second virtual switching link VSL are located in the changed virtual switching links VSL, if all the forwarding behaviors in the processed broadcast filtering table entries corresponding to the hash value in the chip where the other virtual switching links VSL are located are prohibited from forwarding, updating the forwarding behavior in the second broadcast filter table entry corresponding to the hash value in the chip where the second virtual switch link VSL is located to allow forwarding, and updating the configuration result corresponding to the hash value in the second broadcast filter table entry to be processed. Otherwise, the broadcast filtering table entry is skipped over, and the next unprocessed table entry is processed continuously.
According to the broadcast message forwarding system provided by the embodiment of the invention, the cross-device broadcast message is balanced to all virtual switch links according to the hash value of the broadcast message and the broadcast filtering table entry in the hardware chip, and when the VSL link changes, the VLAN member change of the VSL port is cancelled, so that the configuration time is shortened, the broadcast packet loss caused by the VSL link change is reduced, and the stable operation of the cross-device system is ensured.
On the basis of the above embodiments, further, the system further includes:
and the notification module is used for notifying the configuration result corresponding to the hash value to other virtual switch links VSLs if the configuration result corresponding to the hash value in the second broadcast filter table entry is processed.
Specifically, after the broadcast filtering table entry corresponding to the hash value is configured in hardware, the corresponding configuration result is marked as processed, the notification module notifies the configuration result corresponding to the hash value to other virtual switch links VSL, and each processed broadcast filtering table entry can be known by other VSL links. The system provided in the embodiment of the present invention is configured to implement the method, and the functions of the system specifically refer to the method embodiment, which is not described herein again.
According to the broadcast message forwarding system provided by the embodiment of the invention, the cross-device broadcast message is balanced to all virtual switching links according to the hash value of the broadcast message and the broadcast filtering table entry in the hardware chip, the cross-device broadcast flow is balanced, the packet loss of a VSL link caused by overlarge broadcast flow is reduced, and the more stable operation of the system is ensured. Meanwhile, the configuration time when the VSL link changes is reduced, and the number of lost packets is reduced.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the system and the like are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.