This application claims the benefit of Taiwan Patent Application No. 099136539, filed on Oct. 26, 2010, which is hereby incorporated by reference for all purposes as if fully set forth herein.
1. Field of Invention
The present invention relates to a network device, and more particularly to a network device and a method thereof capable of quickly establishing path data when any one path is interrupted.
2. Related Art
The current ring topology architecture is a network architecture formed of a plurality of network devices and having a ring connection state. In the network architecture, the Ethernet Automatic Protection Switching (EAPS) protocol is mainly adopted to ensure that a data frame can be successfully transferred to a destination when one of the network devices is disconnected. According to the EAPS protocol, a network manager first chooses one of the network devices as a primary network device and the rest of network devices are transmission network devices, and a primary port and a secondary port are set in two ring ports of each network device respectively. The primary network device periodically sends out a detection data frame through the primary port, while the secondary port detects whether the detection data frame is received to denote that the transmission of a network with an architecture of ring type is successful or not. If yes, the secondary port is locked to reject reception of a non-specified data frame, so as to avoid transfer loop caused during subsequent data frame transfer. According to the EAPS protocol, each network device fixedly transfers the data frame to a next network device through the primary port. However, because the data frame is delivered in a single direction, a transfer path of the data frame may be lengthened in some circumstances. As shown in
Therefore, how to select a shortest path for transferring the data frame in the network during data frame delivery, and how to quickly and accurately transfer data frame if an interruption occurs in the network device are the main topics to be achieved for network devices.
The present invention provides a network device and a method thereof, which have a path selection capability and are capable of establishing path data more quickly when a path is changed.
In order to solve the device problem, the present invention discloses a network device for establishing path data, which includes a memory unit and a processing unit.
The memory unit is recorded with a MAC table data and a ring port table data. The MAC table data includes at least one path data, and each path data includes a device MAC address information and a first identification. The ring port table data comprises a ring port information corresponding to a network. The ring port information comprises a ring port number, information of a primary port and information of a secondary port corresponding to the ring port number and connected to the network, and a second identification.
The processing unit is used to adjust the corresponding second identification when path interruption of the network is detected, and analyzes whether the first identification of destination path data of the data frame is consistent with the second identification corresponding to the destination path data when receiving the data frame, so as to decide an output port for the data frame.
In a network device for establishing path data according to the present invention, each ring port information further includes a port status value corresponding to a connection status of the network, and when a path of the network is interrupted, the processing unit changes the port status value from a ring network value to a line network value and adjusts the second identification.
The network device for establishing path data according to the present invention is recorded with a total hop count value, which can be set by software; the each path data further includes a hop count value corresponding to the device MAC address information.
When obtaining the data frame, the processing unit decides the output port for the data frame according to whether the hop count value of the data frame reaches or exceeds half of the total hop count value.
In order to solve the above method problem, the present invention discloses a method for establishing path data of a network device. This network device is connected to a network with an architecture of ring type for receiving and sending a data frame, and the method includes: establishing a MAC table data and a ring port table data, in which the MAC table data includes at least one path data, each path data includes a device MAC address information and a first identification, and the ring port table data includes a ring port information, which comprises a second identification; and when the network is interrupted after a judgment, whether the first identification of destination path data of the data frame is consistent with the corresponding second identification is analyzed, so as to decide an output port for the data frame.
The method for establishing path data of the network device according to the present invention includes: when the network is not interrupted, the hop count value corresponding to the destination MAC address information is obtained according to the device MAC address information of the each path data corresponding to a destination MAC address information of the data frame; whether the hop count value reaches or exceeds half of the total hop count value is judged; when the hop count value does not reach or exceed half of the total hop count value, the data frame is forwarded from a primary port corresponding to the ring port number matched with the destination path data; and otherwise, the data frame is forwarded from the secondary port corresponding to the ring port number of the destination path data.
The present invention is characterized in that, when that a path is interrupted in a network is judged, any network device is immediately to adjust a second identification corresponding to a ring port table data corresponding to the network, so that in a subsequent data frame forwarding process, an output port for data frame transfer should be quickly judged through a comparison result between a relevant first identification and a relevant second identification, so as to forward the data frame to a destination network device quickly and accurately. Therefore, when the path data is established, the present invention first ensures a transfer capability between a network device and other equipments, so as to avoid data loss due to path interruption. Next, according to the present invention, through calculation and comparison of a hop count value and a total hop count value, the network device can quickly reselect a transmission path with less path cost, so as to increase the communication efficiency and a data transmission rate among network devices.
The present invention will become more fully understood from the detailed description given herein below for illustration only, and thus are not limitative of the present invention, and wherein:
and
Preferred embodiments of the present invention are illustrated with reference to the accompanying drawings as follows.
First,
Referring to
Referring to
A ring port table data (a format like 3202 and 3302 as shown in
MAC table data (for example, 3201, 3301, and 3501 as shown in
(1) A device MAC address information (referred to as DvM for short for the field in the following drawings) is obtained from a source MAC field (S_M in a field in the following drawing) of the received data frame, and a source MAC address information of the data frame represents device MAC address information of sending the data frame.
(2) A connection port type (referred to as PT for sort for the field in the following drawings) is a type of a connection port for receiving the data frame, which comprises information of a connection port mode for receiving the data frame. In the embodiment of the present invention, the connection port type includes two types: one is a ring port type applied to the network, and the other is a non-ring port type; and the non-ring port type further includes a trunk port type and a physical port type.
(3) A connection port number (referred to as PN for short for the fields depicted in the following
(4) A first identification (such as a 1st CID field in
(5) A hop count value (referred to as hop count value for short for the field in the following drawings) refers to the number of hops between the source network device sending the data frame and its own network device (that is, how many network devices are required for forwarding at the time of reaching the destination network device). This hop count value is learnt by each network device from a frame hop count value (FHC) field in the data frame at the time of obtaining the data frame. It is illustrated herein that, the frame hop count value is an accumulated value that a value in the frame hop count value field of the data frame is added by one when each network device obtains a data frame and determines to forward the data frame. For example, when the second network device 320 transmits a data frame 41 to the fifth network device 350, the shortest path should be a path passing through the second network device 320, the first network device 310, and the fifth network device 350, that is, passing through two network devices. Furthermore, for a quantity of network devices through which the data frame 41 practically passes, a network device for forwarding the data frame continuously updates an frame hop count value of the data frame 41, and finally, the fifth network device 350 reads and records the frame hop count value in its own MAC table data. As depicted in
(6) A virtual local area network ID (VLAN ID, referred to as VID in a field in the following drawings).
As shown in
In the network 300 depicted in
In this embodiment, the MAC table data 3201 of the second network device 320 comprises a path data relevant to transmission data of the second electronic device 220, which includes: (1) a VID: 1; (2) a DvM: PC2, that is, a device MAC address information of the second electronic device 220; (3) a PT: a ring port; (4) a connection port number(PN): 1, corresponding to ring port number: 1 of the ring port table data 3202, that is, the corresponding connection ports (321 and 322), where the connection port 321 is a primary port, and the connection port 322 is a secondary port; (5) an H_C: 3; and (6) a 1st CID: 0.
When the second network device 320 obtains the data frame 41 with a destination MAC address information of the second electronic device 220, first a learning process is performed on the data frame 41. It is illustrated herein that, data frame formats used in the following embodiment are as depicted in
Next, the second network device 320 compares the destination MAC address information of the data frame 41 with a device MAC address information of each path data in the MAC table data 3201, so as to judge whether a destination path data conforming to the destination MAC address information exists in the MAC table data 3201. If the destination path data does not exist in the MAC table data 3201, the second network device 320 floods the data frame 41 out through various connection ports. It is worth mentioning that, if a connection port is a ring port and a port status value is a ring network value, the data frame 41 only needs to be sent out through a preset port, either the primary port or the secondary port, for example. If the port status value is a line network value, both the primary port and the secondary port send the data frame.
Otherwise, when the path data corresponding to the device MAC address information exists in the MAC table data, the data frame is sent through a specified connection port according to the path data in the MAC table data. Types of connection ports for receiving the data frame and types of connection ports specified for outputting should have the following several cases: (1) Input through a non-ring port, and output through a ring port; (2) input through a non-ring port, and output through a non-ring port; (3) input through a ring port, and output through a non-ring port; and (4) input through a ring port, and output through a ring port. However, these data frame receiving and sending modes are recited hereinafter.
In this embodiment, the second network device 320 is illustrated in the first case. The second network device 320 obtains the data frame 41 from the first electronic device 210 through the connection port 328, and the second network device 320 decides to transfer path data with the number of 1 of the destination path data of the data frame 41. The transferred port type is a ring port, and a connection port number thereof is 1. Therefore, the second network device 320 then finds out port data with the ring port number of 1 from the ring port table data 3202, and decides that this data frame 41 is forwarded by the connection port 321 (the primary port) or the connection port 322 (the secondary port). In an embodiment of the present invention, the primary port of the ring port is preset as a connection port for sending. In another embodiment, the secondary port of the ring port is preset as the connection port for sending. Next, the second network device 320 finds out that a port status value of the port data of the ring port number of 1 is a ring network value or a line network value, so as to determine whether the network 300 has a ring shape, or any one path thereof is interrupted to form a linear network. It is noted that, a purpose of judging a network port status value by a network device lies in that, when the network has a ring shape, the data frame is sent through a preset port; if the network becomes linear, the data frame is sent through both the primary port and the secondary port. Therefore, when the port status value becomes linear from a ring shape, representing a case that the network is interrupted, the data frame is ensured to be quickly and accurately transmitted to the destination network device.
It is additionally mentioned that, when the data frame enters the connection port having the ring port type from the connection port having the non-ring port type, the network device needs to add an frame hop count value field in this data frame, an initial value thereof is preset to 1, while at the time of finally reaching the destination MAC address information, the network device receiving the data frame 41 needs to remove the frame hop count value field of this data frame, which is also similar to the network header data.
However, when deciding to transfer the destination path data of the data frame 41, the second network device 320 first analyzes whether the transferred port type is a ring port, and if yes, judges that this data frame 41 is forwarded through the connection port 321 (the primary port) or the connection port 322 (the secondary port). A judgment manner is as follows. According to an hop count value of the destination path data, it is judged whether a value thereof reaches or exceeds half of a total hop count value, so as to decide whether the data frame 41 is forwarded through the preset primary port 321 or the secondary port 322.
For example, the MAC table data of the second network device 320 is as depicted in
The second network device 320 analyzes that no path is interrupted in the current the network 300, and the data frame 41 should be forwarded by the connection port 321 (the primary port). The path switching mode is applicable when an electronic device connected to any network device is sending a data frame, and the present invention is not limited thereto.
As shown in
When obtaining the data frame 41 as shown in
For example, it is assumed that the second network device 320 obtains the data frame 41 pointing to the second electronic device 220, and judges that the destination path data pointing to the second electronic device 220 includes a VID: 1; a DvM: PC2; a connection PT: a ring port; a connection port number(PN): 1; an H_C: 3; and a 1st CID: 0.
Next, from the ring port table data 3202, the second network device 320 learns that for an RPN: 1, a corresponding primary port thereof is a connection port 321, and a secondary port is a connection port 322; a second identification of the corresponding “RPN: 1” is 1.
The second network device 320 determines that the read first identification is not equal to the second identification, so the second network device 320 utilizes the connection port 321 and the connection port 322 to send the data frame 41 in the flooding manner. After being received by each network device, the data frame 41 is forwarded or discarded. However, when receiving, each network device analyzes the data frame 41, so as to record the path data with minimal path cost between the first electronic device 210 and each network device again. However, when the path data to be updated already exists in the MAC table data, the second network device 320 directly replaces the original data with a new first identification and other relevant data on the basis of the original path data. In this way, each network device can reestablish mutually connected communication paths in a short time, while the original path data without being updated is deleted one by one in cooperation with practical working demand of a network device depending on the consideration of a designer, or a deletion regulation is formulated, so that the network device clears the original path data according to the deletion regulation.
A MAC table data and a ring port table data are established (Step S110). As depicted in
A data frame is obtained (Step S120). Taking
The data frame is analyzed to update the MAC table data (Step S130). This Step is a step that the second network device 320 performs a learning process (illustrated hereinafter) on the data frame 41.
The MAC table data is analyzed to determine whether a destination path data matched with the destination MAC address information of the data frame exists (Step S140). For example, in
When it is judged that no destination path data exists, a flooding process is performed (Step S150). As shown in
When it is judged that destination path data exists and conforms to the ring port type, that is, to judge whether the network 300 is interrupted (Step S160), and a judgment manner is to analyze whether a port status value included in the destination path data is a network value. For example, in
When it is judged that the network 300 is not interrupted, a path switching determination process is executed (Step S170). For example, in
When it is judged that the network 300 is interrupted, it is analyzed whether the first identification(1st CID) of the destination path data of the data frame 41 is consistent with the second identification(2nd CID) corresponding to the ring port number matched with the connection port number of the destination path data (Step S180).
For example, in
Therefore, in Step S160, from the ring port table data 3202, the second network device 320 learns that the port status value of the port data of the ring port number of 1 is a line network value, so as to determine that the network 300 to which the connection port 321 and the connection port 322 are connected forms a linear network.
Then, in Step S180, the second network device 320 finds out destination path data conforming to the destination MAC address information of the data frame 41 from the MAC table data 3201, analyzes the ring port number corresponding to the destination path data from the ring port table data 3202, compares the connection port number with the ring port number having the same port No., and determines whether the first identification and the second identification corresponding to the both respectively are equal, so as to decide whether to perform the flooding process.
When it is judged that the first identification is not consistent with the second identification, a flooding process is performed (Step S150).
Otherwise, when the first identification is consistent with the second identification, the data frame is forwarded through the primary port corresponding to the connection port number of the destination path data (Step S190).
A destination MAC address information of a data frame is matched with a device MAC address information of each path data, so as to obtain an hop count value of the destination MAC address information (Step S171).
It is calculated whether the hop count value reaches or exceeds half of a total hop count value (Step S172).
When it is judged that the hop count value does not reach or exceed half of the total hop count value, the data frame is forwarded through a primary port corresponding to a connection port number of destination path data (Step S190).
Otherwise, when it is judged that the hop count value reaches or exceeds half of the total hop count value, the data frame is forwarded through a secondary port corresponding to the connection port number of the destination path data (Step S173).
The second network device 320 analyzes that no path is interrupted in the current network 300, and the data frame 41 should be forwarded through the connection port 321 (the primary port). Next, the second network device 320 obtains the hop count value of 3, which reaches or exceeds half of the total hop count value, that is, 5/2=2.5. Therefore, the second network device 320 determines not to forward the data frame 41 through the connection port 321 (the primary port), and instead, forward the data frame 41 onto the network 300 through the connection port 322 (the secondary port) matched with the ring port 321. However, the half of the total hop count value can be a preset value calculated and obtained by each network device in advance, or a set value input by a network operator in advance.
Otherwise, when the hop count value of the destination path data is below 2, the second network device 320 judges that this hop count value is lower than half of the total hop count value, that is, 5/2=2.5. Therefore, the second network device 320 determines to forward the data frame 41 onto the network 300 from the connection port 321 (the primary port).
Referring to
It is judged whether an frame hop count value of the data frame reaches or exceeds a total hop count value (Step S121). As shown in
When it is judged that the frame hop count value reaches the total hop count value, that is, representing that the data loop transfer already occurs, a network device for receiving the data frame 41 discards the data frame (Step S122).
When it is judged that the frame hop count value does not reach the total hop count value, the network device for receiving the data frame 41 analyzes the data frame to update the MAC table data (Step S130).
Referring to
It is judged whether a data frame is obtained by a source connection port conforming to a non-ring port type and forwarded to a network with an architecture of ring type (Step S210).
When the data frame is obtained through the source connection port conforming to the non-ring port type and forwarded to the network, (Step S160) is executed. This mode is the first case of receiving and sending the data frame: input through the non-ring port, and output through the ring port output. Taking the architecture depicted in
When the data frame is obtained through the source connection port conforming to the non-ring port type and forwarded to the destination connection port of the non-ring port type, it is the second case of receiving and sending the data frame: input through the non-ring port, and output through the non-ring port. At this time, the data frame is output by a destination connection port of the destination path data conforming to the non-ring port type (Step S230). Otherwise, it is judged whether a destination MAC address information of the data frame does not point to the network and whether the corresponding source path data conforms to the ring port type (Step S240).
When it is judged that the destination MAC address information of the data frame does not point to the network and the corresponding source path data conforms to the ring port type, this mode is the third case of receiving and sending the data frame: input through the ring port, and output the non-ring port. At this time, ring header data of the data frame is removed, and the data frame with the ring header data removed is forwarded through a relevant connection port having the non-ring port type (Step S250).
When it is judged that the data frame is obtained through the source connection port conforming to the ring port type and forwarded to the network, this mode is the fourth case of receiving and sending the data frame: input through the ring port and output through the ring port. At this time, a ring port number same to the connection port number of the destination MAC address information is obtained from the ring port table data, and the primary port and the secondary port corresponding to the source connection port for obtaining the data frame and the ring port number are analyzed, so as to find out a destination connection port for outputting the data frame (Step S260).
Referring to
The source MAC address information of the data frame, the connection port number of the connection port for obtaining the data frame, and the second identification of the ring port information matched with the connection port number in the ring port table data are analyzed (Step S131), and then it is judged whether the source MAC address information of the data frame is matched with any one path data of the MAC table data (Step S132), so as to decide whether to update the MAC table data.
When it is judged that a source path data conforming to the source MAC address information does not exist, the source path data corresponding to the source MAC address information is established (Step S133).
Otherwise, it is judged whether a data difference exists between the source path data and either the connection port number of the connection port for obtaining the data frame or the second identification matched with the connection port number in the ring port table data (Step S134).
When the source path data conforming to the source MAC address information exists, but the data difference exists between either the connection port number of the ring port for obtaining the data frame or the second identification matched with the connection port number in the ring port table data and the source path data, the MAC table data is updated (Step S135).
After a process of Step S130 ends, Step S140 is performed.
In conclusion, only implementation manners of technical solutions or the embodiments adopted by the present invention for solving the problems are recorded, and are not used to limit the patent implementation scope of the present invention. That is, all equivalent changes and modifications conforming to the meaning of the claims of the present invention or made according to the scope of the present invention fall within the scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
099136539 | Oct 2010 | TW | national |