Disclosure of Invention
The technical problem to be solved by the invention is as follows: and the load of the main stacking equipment for processing the protocol message is reduced.
To solve the foregoing technical problem, an embodiment of the present invention provides a packet forwarding method for a stack system, including:
a first stacking device in a stacking system acquires a first message to be forwarded, which is to be forwarded to a second stacking device of the stacking system;
if the second stacking device is a main stacking device and the first message to be forwarded is an unresolved protocol message, the first stacking device resolves effective data of the first message to be forwarded, and encapsulates the resolved effective data to generate a second message to be forwarded;
and the first stacking device forwards the second message to be forwarded to the second stacking device, so that the second stacking device can directly acquire the analyzed effective data in the second message to be forwarded.
If the first message to be forwarded is a unicast message or the first message to be forwarded is an analyzed protocol message, the first stacking device directly forwards the first message to be forwarded to the second stacking device.
And the first stacking device forwards the first message to be forwarded or the second message to be forwarded to the second stacking device in a hard forwarding mode.
Wherein the first stacking device maintains a forwarding engine configured with forwarding path information; the forwarding path information specifically includes: a connection correspondence relationship between each cascade port of the first stacking apparatus and other stacking apparatuses except the first stacking apparatus;
the first stacking device forwards the first message to be forwarded or the second message to be forwarded to the second stacking device in a hard forwarding manner, including:
the first stacking device determines a target cascading port capable of having a connection corresponding relation with the second stacking device according to the forwarding path information through the forwarding engine; the target cascade port belongs to the first stacking device;
and the first stacking equipment forwards the first message to be forwarded or the second message to be forwarded by using the target cascading port through the forwarding engine.
In addition, another embodiment of the present invention further provides a packet forwarding device of a stacking system, where the packet forwarding device is disposed in a first stacking apparatus, and the packet forwarding device includes:
the acquiring module is used for acquiring a first message to be forwarded, which is to be forwarded to second stacking equipment of the stacking system;
the processing module is used for analyzing effective data of the first message to be forwarded if the second stacking device is a main stacking device and the first message to be forwarded is an unresolved protocol message, encapsulating the effective data obtained by analysis and generating a second message to be forwarded;
and the forwarding module is configured to forward the second to-be-forwarded message to the second stacking device, so that the second stacking device can directly obtain the analyzed effective data in the second to-be-forwarded message.
If the first message to be forwarded is a unicast message or the first message to be forwarded is an analyzed protocol message, the forwarding module directly forwards the first message to be forwarded to the second stacking device.
And the forwarding module forwards the first message to be forwarded or the second message to be forwarded to the second stacking device in a hard forwarding mode.
The forwarding module is specifically a forwarding engine configured with forwarding path information; the forwarding path information specifically includes: a connection correspondence relationship between each cascade port of the first stacking apparatus and other stacking apparatuses except the first stacking apparatus;
the forwarding engine includes:
the determining submodule is used for determining a target cascade port which can have a connection corresponding relation with the second stacking device according to the forwarding path information; the target cascade port belongs to the first stacking device;
and the forwarding submodule is used for forwarding the first message to be forwarded or the second message to be forwarded by using the target cascade port.
In addition, another embodiment of the present invention further provides a stacking apparatus, which includes the above message forwarding device.
The technical scheme of the invention has the following beneficial effects:
compared with the prior art, the method of the embodiment does not need to execute the analysis step on the protocol message by the main stacking device, so that the processing load of the main stacking device can be reduced. The scheme is particularly suitable for a stacking system in the communication field (the main stacking device needs to process massive protocol messages), so that the scheme has high practical value. In addition, the stack device transmits the message by using a hard forwarding mode, and achieves higher transmission efficiency by using fewer processing resources.
Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, an embodiment of the present invention provides a packet forwarding method for a stack system, including:
step 11, a first stacking device in a stacking system acquires a first message to be forwarded, which is to be forwarded to a second stacking device of the stacking system;
step 12, if the second stacking device is a main stacking device and the first to-be-forwarded message is an unanalyzed protocol message, the first stacking device analyzes effective data of the first to-be-forwarded message and packages the effective data obtained through analysis to obtain a second to-be-forwarded message;
step 13, the first stacking device forwards the second message to be forwarded to the second stacking device, so that the second stacking device can directly obtain the analyzed effective data in the second message to be forwarded.
In the method of the embodiment, the slave stacking device is responsible for performing the parsing of the protocol packet, so as to reduce the processing pressure of the master stacking device.
In addition, if the first message to be forwarded is a unicast message (the final destination address is not a stacking device of the stacking system), or the first message to be forwarded is an already-parsed protocol message (the protocol message is parsed and encapsulated by a stacking device connected downstream), the first stacking device directly forwards the first message to be forwarded to the second stacking device.
In addition, protocol messages are mainly transmitted among stacking devices in a soft forwarding manner at present, and if a plurality of stacking devices exist in the middle of a transmission path, CPUs of the plurality of stacking devices are required to process the protocol messages, so that processing resources of the middle stacking devices are obviously consumed, and the transmission efficiency is not high.
For this reason, as a preferred scheme, this embodiment provides a hard forwarding transmission method:
that is, the first stacking apparatus maintains a forwarding engine configured with forwarding path information; the forwarding path information specifically includes: a connection correspondence relationship between each cascade port of the first stacking apparatus and other stacking apparatuses except the first stacking apparatus;
the first stacking device determines a target cascading port capable of having a connection corresponding relation with the second stacking device according to the forwarding path information through the forwarding engine; the target cascade port belongs to the first stacking device;
and the first stacking equipment forwards the first message to be forwarded or the second message to be forwarded by using the target cascading port through the forwarding engine.
The following describes the overall scheme of the present invention in detail with reference to implementation.
< first mode of implementation >
Exemplarily, in the present implementation, 4 stacking apparatuses (Dev 0, 1, 2, 3) in the stacking system constitute the topology shown in fig. 2. Wherein Dev0 is the master stacking device, and Dev1, 2, 3 are the slave stacking devices. P0 and P1 on each stacked device are cascade ports through which connections are established among the stacked devices. In addition, as shown in fig. 2, each stacking apparatus maintains a forwarding path table for recording forwarding path information.
Assuming that Dev 3 receives a protocol message from outside the stacking system through its network port P2, which is to be sent to the master stacking device Dev0, the following procedure is executed:
the CPU of the Dev 3 parses the protocol packet and extracts the valid data of the protocol packet (the valid data includes specific protocol content, control information, etc.).
The CPU of the Dev 3 re-encapsulates the parsed valid data back into the protocol packet.
The CPU of Dev 3 controls the forwarding engine of Dev 3 to forward the protocol message to Dev 0. In this step, the forwarding engine of Dev 3 determines that Dev0 corresponds to the local P0 port according to the forwarding path table of Dev 3, i.e. protocol packet is forwarded through the local P0 port.
Since the P0 port of Dev 3 is not directly connected to Dev0 but directly connected to Dev2, the protocol message will reach Dev2 first. The Dev2 forwarding engine determines that the protocol message needs to be sent to the Dev0 according to the destination address of the protocol message, determines that the Dev0 corresponds to the local P0 port according to the forwarding path table corresponding to the Dev2, and then forwards the protocol message through the P0 port on theDev 2.
Based on the above principle, finally the Dev0 receives the protocol message forwarded by the P0 port of the Dev1, determines that the protocol message is itself according to the destination address of the protocol message, and directly extracts the analyzed valid data of the protocol message for related processing.
Specifically, the destination address of the protocol packet includes: identity ofDev 0. The Dev0 can determine that the protocol message does not need to be forwarded any more according to the identity of the Dev0 of the destination address, but is uploaded to the processor of the device for processing, and is directly sent to the internal processor through the P2 port. It should be noted that the destination address of the existing packet already includes the identity of the destination stack device and the identity of the destination port in the destination stack device, and the present invention is not modified for this.
< second mode for carrying out >
Exemplarily, in the present implementation, 4 stacking apparatuses (Dev 0, 1, 2, 3) in the stacking system constitute the topology shown in fig. 2. Wherein Dev0 is the master stacking device, and Dev1, 2, 3 are the slave stacking devices. P0 and P1 on each stacked device are cascade ports through which connections are established among the stacked devices.
Different from the first implementation, both the P2 port of Dev0 and the P2 port ofDev 3 are network ports, wherein the P2 port ofDev 3 is connected with external network a and the P2 port of Dev0 is connected with external network B.
Assuming that Dev0 receives a unicast message from external network a through its network port P2, which needs to be sent to external network B (for the unicast message, the stacking system only plays a role of forwarding route, and does not need the stacking device to process the single thin message), the following process is executed:
the forwarding engine of the Dev0 determines the P2 port to be sent to theDev 3 according to the destination address of the unicast message, determines the local P1 port corresponding to theDev 3 according to the forwarding path table of the Dev0, and then forwards the message to theDev 3 through the local P1 port.
As with the implementation principle, finally, theDev 3 receives the unicast message and then sends it to the external network B through its P2 port.
According to the first and second implementation manners, it can be known that: compared with the prior art, the method of the embodiment does not need to execute the analysis step on the protocol message by the main stacking device, so that the processing load of the main stacking device can be reduced. The scheme is particularly suitable for a stacking system in the communication field (the main stacking device needs to process massive protocol messages), so that the scheme has high practical value. In addition, the stack device transmits the message by using a hard forwarding mode, and achieves higher transmission efficiency by using fewer processing resources.
In addition, as shown in fig. 3, a message forwarding apparatus of a stacking system is disposed in a first stacking device, and includes:
the acquiring module is used for acquiring a first message to be forwarded, which is to be forwarded to second stacking equipment of the stacking system;
the processing module is used for analyzing effective data of the first message to be forwarded if the second stacking device is a main stacking device and the first message to be forwarded is an unresolved protocol message, encapsulating the effective data obtained by analysis and generating a second message to be forwarded;
and the forwarding module is configured to forward the second to-be-forwarded message to the second stacking device, so that the second stacking device can directly obtain the analyzed effective data in the second to-be-forwarded message.
In the apparatus of this embodiment, the slave stacking device is responsible for performing the parsing of the protocol packet, so as to reduce the processing pressure of the master stacking device.
Wherein. If the first message to be forwarded is a unicast message or the first message to be forwarded is an analyzed protocol message, the forwarding module directly forwards the first message to be forwarded to the second stacking device.
Wherein. And the forwarding module forwards the first message to be forwarded or the second message to be forwarded to the second stacking device in a hard forwarding mode.
Wherein. The forwarding module is specifically a forwarding engine configured with forwarding path information; the forwarding path information specifically includes: a connection correspondence relationship between each cascade port of the first stacking apparatus and other stacking apparatuses except the first stacking apparatus;
the forwarding engine includes:
the determining submodule is used for determining a target cascade port which can have a connection corresponding relation with the second stacking device according to the forwarding path information; the target cascade port belongs to the first stacking device;
and the forwarding submodule is used for forwarding the first message to be forwarded or the second message to be forwarded by using the target cascade port.
Obviously, the message forwarding apparatus of the present embodiment corresponds to the message forwarding method described above, and can achieve the same technical effect.
In addition, another embodiment of the present invention further provides a stacking apparatus, including the above message forwarding device. The stacking device may be a switch, a router, or other hardware.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the appended claims.