# Patent

## Title
Framework for reliably communicating port information in a system of devices

## Abstract

A framework for reliably communicating port information in a system of devices is provided. In one embodiment, each device in the system of devices can create a first record that includes port information pertaining to a plurality of ports of the device, where the plurality of ports are usable for communicatively coupling the device to other devices in the system of devices. The device can further receive, from the other devices in the system of devices, one or more second records including port information pertaining to the ports of the other devices, and can store the first record and the one or more second records in a data store maintained locally on the device. The device can then forward copies of the first record and the one or more second records out of each of the plurality of ports, thereby causing the copies of the first record and the one or more second records to be communicated to the other devices in the system of devices.

## Background
CROSS REFERENCES TO RELATED APPLICATIONS
The present application claims the benefit and priority under 35 U.S.C. 119(e) of U.S. Provisional Application No. 61/974,924, filed Apr. 3, 2014, entitled “A RESILIENT DESIGN FOR RECOVERING FROM COMMUNICATION PORT SENDING/RECEIVING PROBLEMS IN A STACKING SYSTEM.” The entire contents of this provisional application are incorporated herein by reference for all purposes.


BACKGROUND
As known in the art, a “stackable switch” is a network switch that can operate independently as a standalone device or in concert with one or more other stackable switches in a “stack” or “stacking system.” FIG. 1A illustrates the front face of an exemplary stackable switch 100. As shown, the front face includes a set of data ports 102 (denoted by the letter “D”), a set of stacking ports 104 (denoted by the letter “S”), and an out-of-band management port 106 (denoted by the letter “M”). Data ports 102 are operable for connecting stackable switch 100 to one or more hosts and/or data networks. Stacking ports 104 are operable for linking stackable switch 100 to other stackable switches in the same stacking system/topology. Stacking ports 104 can be dedicated ports (i.e., ports designed specifically for stacking) or high bandwidth data uplink ports that operate in a stacking mode. Out-of-band management port 106 is operable for connecting stackable switch 100 to a separate terminal device, such as a laptop or desktop computer. Once connected, an administrator can use the terminal device to access the management console of stackable switch 100 and perform various switch management functions.
FIG. 1B illustrates an exemplary stacking system 150 comprising stackable switches 100(1), 100(2), and 100(3), each of which is substantially similar to stackable switch 100 of FIG. 1A. As shown, stackable switches 100(1)-100(3) are linked together via their respective stacking ports, thereby establishing a data path between the switches for forwarding network traffic. With this stack configuration, switches 100(1)-100(3) can behave as a single, logical switch having the combined data port capacity of the individual switches.
In a system of interconnected devices like stacking system 150, port failures can occasionally occur that affect the ability of system members to communicate with each other. For instance, in FIG. 1B, a failure may occur with respect to stacking port 152 of stackable switch 100(1) that prevents port 152 from sending data packets to and/or receiving data packets from port 154 of stackable switch 100(2). Generally speaking, if this failure causes stacking port 152 to transition from an “UP” status to a “DOWN” status, stackable switch 100(1) can detect that the port is down and can re-route traffic for the port on an alternative link/path to stackable switch 100(2) (e.g., through stackable switch 100(3)).
However, in some failure scenarios, a port may fail in a manner that does not cause its status to change. For example, ports that support speeds of 10 Gigabits per second (Gbps) or higher typically have sophisticated electronic and/or optical components and firmware logic. Further, such ports are internally connected to a packet processor that handles queuing, makes wire-speed forwarding decisions, and so on. A failure that arises due to a component/firmware problem or due to an issue with a connected packet processor may prevent the affected port from sending or receiving packets, but may nevertheless cause the port remain in an UP status. This, in turn, can prevent the switch that owns the port from detecting the failure, potentially leading to packet mis-forwarding, packet black holes, and other conditions that can result in a partial or complete network breakdown.
There are certain existing protocols, such as Unidirectional Link Detection Protocol (UDLD), that can mitigate the issue above by determining when a bidirectional link has become unidirectional or nonfunctional and marking the end ports of the link as being logically down. However, these existing protocols generally operate with respect to a single link at a time. For example, in stacking system 150 of FIG. 1B, a separate instance of UDLD would need to be run on each stacking link interconnecting stackable switches 100(1)-100(3), and each protocol instance would only be able to communicate, between the two end switches of the link, information regarding the link's end ports. This means that UDLD and other similar protocols do not have a holistic view of the port statuses of all of the devices in a system, which limits their ability to detect different types of port/link problems. For instance, UDLD cannot distinguish between (1) a scenario where a bidirectional link has become unidirectional (due to, e.g., a failure of a single end port) and (2) a scenario where the same bidirectional link has become completely nonfunctional (due to, e.g., failures of both end ports or a cable failure). Further, UDLD cannot detect a problem where one end port of a link remains up while the other end port of the link has gone down (referred to as the “one-end-up, one-end-down” problem).
SUMMARY
A framework for reliably communicating port information in a system of devices is provided. In one embodiment, each device in the system of devices can create a first record that includes port information pertaining to a plurality of ports of the device, where the plurality of ports are usable for communicatively coupling the device to other devices in the system of devices. The device can further receive, from the other devices in the system of devices, one or more second records including port information pertaining to the ports of the other devices, and can store the first record and the one or more second records in a data store maintained locally on the device. The device can then forward copies of the first record and the one or more second records out of each of the plurality of ports, thereby causing the copies of the first record and the one or more second records to be communicated to the other devices in the system of devices.
The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of particular embodiments.



BRIEF DESCRIPTION OF DRAWINGS
FIG. 1A depicts an exemplary stackable switch.
FIG. 1B depicts an exemplary stacking system.
FIG. 2 depicts a stacking system that supports a framework for reliably communicating port information according to an embodiment.
FIG. 3 depicts the structure of a device record according to an embodiment.
FIG. 4 depicts a flowchart for creating and propagating device records according to an embodiment.
FIG. 5 depicts a flowchart for initializing connection entries of a device record according to an embodiment.
FIG. 6 depicts a flowchart for periodically updating the port age and neighbor age fields of a device record according to an embodiment.
FIG. 7 depicts a flowchart for updating other fields of a device record according to an embodiment.
FIG. 8 depicts a flowchart for processing device records received from other devices according to an embodiment.
FIGS. 9A and 9B depict a flowchart for detecting port/link problems according to an embodiment.
FIG. 10 depicts a flowchart for automatically resolving a detected port/link problem according to an embodiment.
FIG. 11 depicts a network switch according to an embodiment.



DETAILED DESCRIPTION
In the following description, for purposes of explanation, numerous examples and details are set forth in order to provide an understanding of various embodiments. It will be evident, however, to one skilled in the art that certain embodiments can be practiced without some of these details, or can be practiced with modifications or equivalents thereof.
1. Overview
The present disclosure describes a framework for reliably communicating port information in a system of devices, such as a stacking system comprising stackable switches. In one set of embodiments, each device in the system of devices can create a device record that includes port information regarding the ports of the device that are useable for connecting the device to other devices in the system. This port information can comprise, e.g., physical connection information (e.g., which neighbor port each port is connected to), port status information (e.g., whether each port is UP or DOWN), and more. The device can store the created device record in a data store (e.g., database) that is locally maintained on the device. The device can further forward the created device record out each of its ports to the other devices in the system of devices.
Upon receiving a device record from another device in the system of devices, each device can add the received device record to its local data store (if the latest version of that record does not already exist). In this manner, the device can keep copies of the device records of other system members, in addition to its own device record, in the local data store. Each device can also update its own device record in response to events that affect the port information included therein (e.g., port status changes, the addition or removal of ports, the receipt of a device record with neighbor port information, etc.).
Finally, each device in the system of devices can periodically aggregate and forward the device records in its local data store out of each of its ports, thereby communicating the latest versions of those device records and their included port information to the other devices in the system of devices.
With the framework described above, each device in the system of devices can have a complete and accurate view of the port connections and port statuses of the entire system. For instance, if there are M devices in the system of devices, each device will maintain (once the exchange of device records reaches a stable state) M device records in its local data store, each record comprising the latest port information for a different device in the system. Among other things, this system-wide port information can enable each device to more intelligently and more precisely detect port/link problems. For example, in certain embodiments, each device can analyze the device records in its local data store to detect and distinguish between: (1) a problem that causes a link to become unidirectional; (2) a problem that causes a link to become nonfunctional; and (3) a problem that causes one end port of a link to remain up while the other end port goes down. Depending on the nature of the detected problem, the system may report the problem to an administrator, or may take steps to automatically resolve the problem (by, e.g., disabling the failed ports or reloading the devices with the failed ports).
Further, since each device in the system forwards device records using every possible device-to-device port, the foregoing framework provides a more reliable and resilient communication mechanism than conventional Layer 2 unicast, multicast, or broadcast. Generally speaking, as long as there is at least one available path between any two devices in the system, each device will be able to exchange device records with every other device. This resiliency is particularly beneficial when attempting to detect port/link problems as noted above, because those port/link problems (assuming they do not break the system into partitions) will not prevent the devices from exchanging the port information needed to carry out the detection process.
In some embodiments, in addition to including port information, each device record can also include a general-purpose message field. As described in further detail below, the devices in the system can leverage this general-purpose message field to reliably communicate different types of information beyond port information (e.g., device actions, etc.) to each other. The devices can then analyze and/or act on this information for various purposes (e.g., logging, coordinating device reloads, etc.).
For clarity of explanation, in the sections that follow, several examples and embodiments are described in the context of stacking systems. However, it should be appreciated that the techniques described herein can apply to other types of networked systems where the reliable exchange of port information may be a desirable or useful feature. Accordingly, within the detailed description, references to “stacks” or “stacking systems” can be construed as encompassing generalized systems of devices, and references to “switches” or “stackable switches” can be construed as encompassing generalized devices within a system.
2. System Environment
FIG. 2 depicts a stacking system 200 that supports a framework for reliably communicating port information according to an embodiment. As shown, stacking system 200 comprises a number of stackable switches 202(1)-202(M) that are interconnected via their respective stacking ports 204(1)-204(M). Although stackable switches 202(1)-202(M) are depicted as forming a ring topology, it should be appreciated that other types of topologies (e.g., linear, star, arbitrary mesh, etc.) are possible.
In the example of FIG. 2, stackable switch 202(2) is designated as the master switch of stacking system 200, which means that switch 202(2) serves as the point of user contact for all management functions of system 200. For instance, master switch 202(2) can accept and process user commands directed to the overall configuration of stacking system 200. Master switch 202(2) can also communicate with the non-master switches of stacking system 200 as needed in order to propagate various types of management commands and data to those switches.
As noted in the Background section, one challenge with managing a system of devices such as stacking system 200 is that the ports interconnecting the constituent switches (i.e., stacking ports 204(1)-204(M)) can occasionally fail to send or receive packets, but can remain in an UP status. In these scenarios, the stackable switches that own the problematic ports cannot easily detect the failures because the ports appear to be operational according to their statuses, potentially leading to various conditions that can cause a network breakdown.
To address the foregoing and other similar issues, each stackable switch 202(1)-202(M) of stacking system 200 can include a novel device record manager 206(1)-206(M), a novel device record database 208(1)-208(M), and a novel port analysis component 210(1)-210(M). In one set of embodiments, these components can be implemented as software that is executed by, e.g., a management processor of each respective switch and stored in an associated memory (not shown). In other embodiments, one or more of these components can be implemented partially or entirely in hardware.
At a high level, each device record manager 206(1)-206(M) can execute flows for creating, updating, and propagating device records through stacking system 200. These device records, which are maintained in device record databases 208(1)-208(M), can include port information pertaining to the stacking ports of each individual switch 202(1)-202(M), such as stacking port connection information, stacking port status information, etc. The device records can also include other types of information that stackable switches 202(1)-202(M) may wish to communicate to each other, such as device actions and so on. The end result of these flows is that each stackable switch 202(1)-202(M) will have, in the form of the aggregated device records stored in device record databases 208(1)-208(M), a complete view of the stacking port connections and stacking port statuses throughout stacking system 200. Stackable switches 202(1)-202(M) can then leverage this system-wide port information in various ways. For example, in one set of embodiments, each port analysis component 210(1)-210(M) can analyze the devices records in its corresponding device record database 208(1)-208(M) to intelligently detect different types of stacking port/link problems. In further embodiments, each port analysis component 210(1)-210(M) can take steps to resolve certain types of stacking port/link problems, without human intervention.
Notably, as part of the device record propagation described above, device record managers 206(1)-206(M) can make use of every possible stacking link interconnecting stackable switches 202(1)-202(M) for communicating device records. For instance, in FIG. 2, device record manager 206(1) of stackable switch 202(1) can forward device records out of each of the switch's two stacking ports 204(1), device record manager 206(2) of stackable switch 202(2) can forward device records out of each of the switch's two stacking ports 204(2), and device record manager 206(M) of stackable switch 202(M) can forward device records out of each of the switch's two stacking ports 204(M). If any of stacking ports 204(1)-204(M) is a trunk port, device managers 206(1)-206(M) can forward device records out of each sub-port of the trunk port. In this way, device record managers 206(1)-206(M) can increase the likelihood that the transmitted device records will reach every other stack member, which is particularly useful in problematic systems where stacking port/link failures can shut down one or more stacking links.
The detailed operation of device record managers 206(1)-206(M) and port analysis components 210(1)-210(M) is presented in the sections that follow.
3. Creating, Updating, and Propagating Device Records
As discussed above, in various embodiments, the mechanism by which device record managers 206(1)-206(M) can communicate port information among stackable switches 202(1)-202(M) of stacking system 200 is via the exchange of device records. FIG. 3 depicts the structure of an example device record 300 according to an embodiment. As shown, device record 300 includes a device ID 302, a record serial number 304, a number of connection entries 306(1)-306(N) (each comprising a stacking port 308(1)-308(N), a port status 310(1)-310(N), a port age 312(1)-312(N), a neighbor port 314(1)-314(N), and a neighbor age 316(1)-316(N)), and a message and message serial number 318. Each of these fields is described in turn below.

    
    
        Device ID 302—Identifies the stackable switch to which device record 300 pertains.
        Record serial number 304—Identifies the version of device record 300. In one embodiment, this field can only be updated by the device record manager of the switch identified by device ID 302.
        Connection entries 306(1)-306(N)—Contains information pertaining to each stacking port N of the switch identified by device ID 302 (one entry per stacking port). Each connection entry includes:
        
            Stacking port 308(1)-308(N)—Identifies the stacking port to which the current connection entry pertains. In one embodiment, this field can be populated with a device ID/port ID pair (e.g., 2/10, which identifies stacking port 10 of switch 2). In other embodiments, this field can be populated with additional information that may be relevant for the stacking port (e.g., associated trunk ID, speed, etc.).
            Port status 310(1)-310(N)—Identifies the current status of stacking port 308(1)-308(N). In one embodiment, can be populated with an “UP” status (indicating that the stacking port is up/operational) or a “DOWN” status (indicating that the stacking port is down/nonoperational).
            Port age 312(1)-312(N)—Identifies the amount of time (in, e.g., seconds) since port status 310(1)-310(N) last changed.
            Neighbor port 314(1)-314(N)—Identifies the neighbor port (if any) to which stacking port 308(1)-308(N) is currently (or was previously) connected.
            Neighbor age 316(1)-316(N)—If port status 310(1)-310(N) is UP, identifies the amount of time (in, e.g., seconds) since stacking port 308(1)-308(N) has received a probe packet (described below) from corresponding neighbor port 314(1)-314(N).
        
        
        Message and message serial number 318—General purpose fields for communicating additional information to other stackable switches. The message serial number identifies the version of the message. As discussed in Section (5) below, these fields can be leveraged to communicate device actions among switches for, e.g., activity logging or coordinating device reloads in the case of a port/link recovery routine.
    
    


With the structure of device record 300 in mind, FIG. 4 depicts a flowchart 400 that can be performed by each device record manager 206(X) of FIG. 2 in order to create, update, and propagate device records within stacking system 200 according to an embodiment. By carrying out flowchart 400, the device record managers can achieve reliable communication of port information among stackable switches 202(1)-202(M).
Starting with block 402, each device record manager 206(X) can create a device record for its host stackable switch 202(X). As part of this record creation process, device record manager 206(X) can set the device ID of the device record to an identifier of switch 202(X) (block 404), and can set the record and message record serial numbers to an initial value (e.g., 1) (block 406). Device record manager 206(X) can also add connection entries to the device record (one per stacking port of switch 202(X)) and can initialize the fields of each connection entry (block 408).
FIG. 5 depicts a flowchart 500 for initializing connection entries per block 408 of FIG. 4 according to an embodiment. At block 502 of FIG. 5, device record manager 206(X) can enter a loop for each newly added connection entry. Within the loop, device record manager 206(X) can populate the stacking port field of the current connection entry with information identifying a particular stacking port (e.g., port X/10) (block 504). Device record manager 206(X) can also set the port status field to the current status of the stacking port (e.g., UP or DOWN) (block 506).
At block 508, device record manager 206(X) can set the neighbor port field of the current connection entry to a NULL or empty value (since the identity of the neighbor port is not yet known).
Finally, at block 510, device record manager 206(X) can set the port age and neighbor age fields to 0, thereby completing the initialization of the current connection entry. The current loop iteration can then end (block 512), and device record manager 206(X) can repeat blocks 504-510 as needed in order to initialize additional connection entries.
Referring back to FIG. 4, once all of the connection entries for the device record have been added and initialized, device record manager 206(X) can store the device record in its local device record database 208(X) (block 410). In addition, device record manager 206(X) can create a “probe packet” that includes the device record (block 412), and can send out a copy the probe packet on each stacking port of stackable switch 202(X) (block 414). In this manner, device record manager 206(X) can communicate the newly created device record to every other switch in the system. As discussed in further detail below, in a particular embodiment each forwarded probe packet can include an indication of the egress stacking port from which it originated, which can be used by receiving switches to populate the neighbor port fields in their own device records.
After the probe packet transmission at block 414, device record manager 206(X) can enter a loop (denoted by reference numeral 416) in which it can continuously (1) update the device record created at block 402, (2) learn/ingest device records received from other stackable switches in stacking system 200, and (3) forward the latest versions of the device records in local device record database 208(X) out of its stacking ports to the other stackable switches. For instance, at block 418, device record manager 206(X) can monitor for local events that affect the port information maintained in switch 202(X)'s device record. To the extent that a particular event requires a modification to one or more fields of the device record, device record manager 206(X) can process the event and can update the device record accordingly.
By way of example, FIG. 6 depicts a flowchart 600 that can be performed as part of block 418 of FIG. 4 for detecting the expiration of an age timer and updating the port age and/or neighbor age fields of switch 202(X)'s device record according to an embodiment. At block 602 of FIG. 6, device record manager 206(X) can run an age timer associated with the port age and neighbor age fields. At block 604, device record manager 206(X) can check whether the age timer has reached a predefined threshold (i.e., has expired). If it has not, device record manager 206(X) can return to block 602.
If the age time has reached the predefined threshold at block 604, device record manager 206(X) can enter a loop for each connection entry of switch 202(X)'s device record (block 606). Within the loop, device record manager 206(X) can first update the port age field of the connection entry with a new age value that reflects the amount of time since the last port status change for the entry's stacking port (block 608).
Device record manager 206(X) can then check whether the port status field of the connection entry is UP and the neighbor port field is not NULL (indicating that the stacking port is currently connected to a known neighbor) (block 610). If not, device record manager 206(X) can increment the record serial number for the device record and the current loop iteration can end (block 616).
On the other hand, if the port status is determined to be UP and the neighbor port field is determined to be not NULL at block 610, device record manager 206(X) can update the neighbor age field with a new age value that reflects the amount of time since a probe packet was last received on the stacking port from the neighbor port (block 612). Device record manager 206(X) can then proceed to increment the record serial number as mentioned above (block 614) and the current loop iteration can end (block 616).
Blocks 608-614 can be repeated as many times as needed to process all of the connection entries in switch 202(X)'s device record. Finally, at block 618, device record manager 618 can reset the age timer and return to block 602 to begin the next round of age field updates.
In addition to monitoring the age timer and updating the port age and/or neighbor age fields of switch 202(X)'s device record per flowchart 600 of FIG. 6, device record manager 206(X) can, as part of block 418 of FIG. 4, also monitor for and process other events that affect other fields of the device record. FIG. 7 depicts a flowchart 700 of such a process. In various embodiments, flowchart 700 can be performed concurrently with flowchart 600 of FIG. 6.
At block 702 of FIG. 7, device record manager 206(X) can detect an event (other than the age timer expiration described with respect to FIG. 6) that affects the port information in switch 202(X)'s device record. At block 704, device record manager 206(X) can determine the event type. If the event is a port status change, device record manager 206(X) can find the connection entry in the device record corresponding to the affected stacking port (block 706), update the port status field of the connection entry with the current port status (block 708), and reset the port age field to 0 (block 710). Additionally, if the detected port status change is a change from DOWN to UP, device record manager 206(X) can clear the neighbor port field (block 712). Device record manager 206(X) can then increment the record serial number (block 714) and return to block 702 to detect additional events.
If the event detected at block 702 corresponds to the addition or removal of a stacking port from switch 202(X)'s configuration, device record manager 206(X) can either add a new connection entry to the device record (for the newly added stacking port) or remove an existing connection entry (for the deleted stacking port) as appropriate (blocks 716 and 718). Device record manager 206(X) can then increment the record serial number as mentioned above (block 714) and traverse back to block 702 to detect additional events.
Returning now to FIG. 4, the second step in loop 416 comprises monitoring for and processing probe packets received from other stackable switches in stacking system 200 (block 420)). By processing such probe packets, device record manager 206(X) can learn the device records of other switches in the system.
FIG. 8 depicts a flowchart 800 that can be performed by device record manager 206(X) for processing received probe packets per block 420 of FIG. 4 according to an embodiment. Starting with block 802, device record manager 206(X) can receive, on a stacking port S1 of switch 202(X), a probe packet from another stackable switch in stacking system 200.
In response, device record manager 206(X) can find a connection entry in switch 202(X)'s device record whose stacking port field identifies S1 (block 804).
At block 806, device record manager 206(X) can populate the neighbor port field of the connection entry found at block 804 with the identity of the egress port from which the probe packet originated. As discussed previously, this egress port information may be included in the probe packet as a separate packet field. Device record manager 206(X) can also clear the neighbor age field of the connection entry and increment the record serial number (blocks 808 and 810).
Then, device record manager 206(X) can extract all of the device records included in the probe packet and enter a loop 812 for each device record. Within the loop, device record manager 206(X) can first check whether a device record for the switch to which the record pertains already exists in local device record database 208(X). If not, device record manager 206(X) can store a copy of the device record in database 208(X) and move on to the next device record (blocks 818 and 820).
Otherwise, device record manager 206(X) can compare the record serial number of the device record from the received probe packet with the record serial number of the existing device record in local device record database 208(X) (block 816). If the record serial number of the device record from the received probe packet is greater, device record manager 206(X) can conclude that this device record is more up-to-date than the existing device record and thus can overwrite the existing device record with the received version in database 208(X) (block 818).
On the other hand, if the record serial number of the existing device record in local device record database 208(X) is greater, device record manager 206(X) can determine that the received device record is out-of-date, and thus can proceed directly to the end of the loop iteration (block 820) without modifying the existing device record. In either case, once the loop end has been reached, device record manager 206(X) can traverse back to block 812 and repeat blocks 814-818 until all of the device records in the probe packet have been processed.
Returning now to FIG. 4, as the final step in loop 416 (and flowchart 400), device record manager 206(X) can periodically transmit probe packets comprising the aggregated device records stored in local device record database 208(X) out of all of the stacking ports of switch 202(X). For instance, device record manager 206(X) can perform this transmission once every second, every 5 seconds, etc. In this manner, device record manager 206(X) can communicate the latest versions of all of the device records that it is aware of (i.e., the device record of switch 202(X), as well as the device records of other switches in stacking system 200 that have been learned per block 420) to every other switch. Eventually, once loop 416 has run long enough, every stackable switch 202(1)-202(M) in stacking system 200 will have the same set of device records in its local device record database 208(1)-208(M) (one device record per switch), where the set of device records reflects the current port connection and status information for the entirety of system 200.
Generally speaking, the time to reach this stable condition will depend on the maximum hop count in system 200's topology and packet loss rate. However, it should be noted that it is not necessary for stacking system 200 to reach a stable condition before the device records stored in local device record databases 208(1)-208(M) can provide useful information to their respective switches. For example, in an extreme case, system 200 may never reach a stable condition if, e.g., the status of a particular stacking port flaps up and down every second. Even in this scenario, the device records/connection entries stored in each device record database 208(1)-208(M) will provide correct port connection information, and thus the individual switches can identify, with some analysis, which port is experiencing issues.
Further, it should be noted that, as part of block 422 of FIG. 4, device record manager 206(X) can use every available stacking port of stackable switch 202(X) for sending out probe packets. As mentioned previously, unlike conventional L2 unicast/multicast/broadcast, this ensures that every possible stacking path of system 200 is used, thereby increasing the likelihood that the probe packets will reach the other switches in the face of one or more port/link failures.
Although not shown in FIGS. 4-8, in certain embodiments, when device record manager 206(X) detects a major change to any device record in its local device record database 208(X), device record manager 206(X) can setup a short timer (e.g., 100 milliseconds) to send out a probe packet containing all device records on all stacking ports. In these embodiments, a “major change” refers to a change to any device record field except port age, neighbor age, and record serial number. In a particular embodiment, this transmission is in addition to the periodic transmissions described at block 422 of flowchart 400. With this enhancement, major device record changes can be more quickly propagated throughout the system. One of ordinary skill in the art may recognize other variations, modifications, and alternatives for the processing of FIGS. 4-8.
4. Detecting Port/Link Problems
As mentioned previously, once flowchart 400 has run long enough, each stackable switch 202(1)-202(M) will have, in the form of the aggregated device records stored in device record databases 208(1)-208(M), a complete view of the stacking port connections and stacking port statuses throughout stacking system 200. Stackable switches 202(1)-202(M) can then leverage this system-wide port information in various ways. For example, in one set of embodiments, port analysis components 210(1)-210(M) of stackable switches 202(1)-202(M) can use these device records to automatically detect port/link problems within stacking system 200. As used herein, the term “port/link problem” refers to a situation where one or more stacking ports of a stacking link are in an UP status, but cannot send and/or receive packets. Because the statuses of these problematic ports are UP, their host switches will (without the detection techniques described below) continue to use the problematic ports in the system's forwarding path, potentially leading to packet mis-forwarding, packet black holes, and other similar conditions.
FIGS. 9A and 9B depict a flowchart 900 that can be performed by each port analysis component 210(X) of FIG. 2 for detecting port/link problems according to an embodiment. Flowchart 900 can enable port analysis component 210(X) to detect and distinguish between the following port/link problems:

    
    
        1. A stacking port completely loses communication with its neighbor port
        2. A stacking link (which is normally bidirectional) becomes unidirectional (e.g., only one end port of the link can send packets)
        3. One end port of a stacking link goes down while the other end port remains up
    
    


Flowchart 900 assumes that flowchart 400 of FIG. 4 has been (or is concurrently being) executed. In addition, flowchart 900 relies on the notion of a “stacking port state” and a “neighbor port state” for each connection entry of a device record. These states are defined as follows:

    
    
        The stacking port state of a connection entry is:
        
            “transit-up” if the port status field is UP and if the port age field is less than a first threshold (e.g., 10 seconds)
            “really-up” if the port status field is UP and port age field is greater than or equal to the first threshold
            “transit-down” if the port status field is DOWN and if port age field is less than a second threshold (e.g., 5 seconds)
            “really-down” if the port status field is DOWN and if port age field is greater than or equal to the second threshold
        
        
        The neighbor port state of a connection entry is:
        
            “aged-out” if the neighbor age field is greater than a third threshold (e.g., 40 seconds)
            “recently-refreshed” if the neighbor age field is less than a fourth threshold (e.g., 15 seconds)
            “transit-aged-out” if the neighbor age field is between the third and fourth thresholds
        
        
    
    


The stacking port and neighbor port states described above can be useful for avoiding “false positives” during the execution of flowchart 900 (i.e., detecting a port/link problem when no problem actually exists). In particular, when a port analysis component determines that a link is in a “transit” state (e.g., transit-up, transit-down, transit-aged-out), the component can skip any further problem detection processing for that link. Thus, this allows the port analysis component to account for scenarios where a given port may not have received any packets within a transit period (as defined by the first, second, third, and fourth thresholds above) due to issues other than a port failure (e.g., busy CPU, packet loss, etc.). Generally speaking, as the transit periods are increased, the likelihood of false positives will be reduced, but the time needed to detect port/link problems will be longer. The optimal lengths for the transit periods can be determined empirically on a per-deployment basis.
Starting with FIG. 9A, at block 902, port analysis component 210(X) of stackable switch 202(X) can enter a loop for each connection entry CE1 for switch 202(X)'s device record DR1. It is assumed that port analysis component 210(X) initiates this loop on a periodic basis (e.g., every second, every 10 seconds, etc).
At block 904, port analysis component 210(X) can check whether any port of CE1 is in a transit state (e.g., transit-up, transit-down, or transit-aged-out). This can comprise checking the stacking port, neighbor port, port status, port age, and neighbor age fields of CE1 and determining the states of the stacking port and the neighbor port in accordance with the definitions above. If either the stacking port or the neighbor port is in a transit state, port analysis component 210(X) can proceed directly to the end of the current loop iteration (block 914) and subsequently return to block 902 to process additional connection entries. As noted previously, this logic allows port analysis component 210(X) to avoid a false positive with respect to the connection entry due to, e.g., packet loss or a busy CPU.
On the other hand, if none of the ports of CE1 are in a transit state, port analysis component 210(X) can attempt to find another device record DR2 in local device record database 208(X) that has a connection entry CE2 with the neighbor port field identifying the stacking port of CE1. Device record DR2 corresponds to the stackable switch in system 200 that is directly connected to stackable switch 202(X) via the stacking port identified in CE1 (if such a neighbor exists).
If device record DR2 is found, flowchart 900 can proceed to FIG. 9B. At blocks 916 and 918 of FIG. 9B, port analysis component 210(X) can analyze the stacking port states of CE1 and CE2 and first check whether one stacking port state is “really-up” while the other stacking port state is “really-down.” If so, port analysis component 910(X) can determine that there is a one-side-up, one-side-down problem (block 920) and can proceed to the end of the current loop iteration at block 914 (thereby ending the processing for CE1).
Otherwise, port analysis component 210(X) can move on to checking whether both stacking port states are “really-down” (block 922). If so, port analysis component 910(X) can determine that the link between the two ports is faulty/broken (block 924) and can proceed to the end of the current loop iteration at block 914 (thereby ending the processing for CE1). This situation may occur if, e.g., the cable connecting the two ports is faulty, or if the system administrator has not connected any cable between the two ports at all. The latter case is not a problem if it is intentional.
Otherwise, port analysis component 210(X) can move on to checking whether the neighbor port field of CE1 is NULL or the neighbor port state is aged-out, and whether the neighbor port state of CE2 is recently-refreshed (block 926). If so, port analysis component 210(X) can determine that there is a unidirectional link from the stacking port to the neighbor port of CE1 (block 928) and can proceed to the end of the current loop iteration at block 914 (thereby ending the processing for CE1).
Otherwise, port analysis component 210(X) can move on to checking whether the neighbor port state of CE1 is recently-refreshed and the neighbor port state of CE2 is aged-out (block 930). If so, port analysis component 910(X) can determine that there is a unidirectional link from the neighbor port to the stacking port of CE1 (block 928) and can proceed to the end of the current loop iteration at block 914 (thereby ending the processing for CE1).
Finally, if none of the foregoing conditions are met, port analysis component 210(X) can check whether the neighbor port states for both CE1 and CE2 are aged-out (block 932). If so, port analysis component 210(X) can determine that there is no communication on this link (block 936). This is typically not due to a faulty/broken/unconnected cable as in block 924; instead, this situation may be due to a chip or firmware problem. Port analysis component 210(X) can then proceed to the end of the current loop iteration at block 914 (thereby ending the processing for CE1).
Returning now to FIG. 9A, if device record DR2 is not found at block 908, port analysis component 210(X) can check whether the neighbor port field of CE1 is NULL (block 910). If the neighbor port field is NULL, this case is considered to be normal and the current loop iteration can end (block 914).
On the other hand, if the neighbor port field is not NULL, port analysis component 210(X) can determine that there is a unidirectional link from the neighbor port to the stacking port of CE1 if the neighbor port state of CE1 is recently-refreshed and the stacking port state of CE1 is really-up (block 912). Finally, the current loop iteration can end (block 914) and port analysis component 210(X) can repeat loop 902 until all of the connection entries in DR1 have been processed.
With flowchart 900, each port analysis component 210(X) can correctly identify the three types of port/link problems described previously, as long as there is at least one path between any two stackable switches in stacking system 200 (so that every switch can know the port statuses of every other switch via the propagation of device records). If the port/link problem prevents communication between at least two stackable switches, then flowchart 900 may not be sufficient to accurately distinguish between the three types of problems because one switch may not have updated port status information for one or more of the other switches in the stacking system.
It should be appreciated that flowchart 900 of FIGS. 9A and 9B is illustrative and not intended to limit embodiments of the present invention. For example, in scenarios where detection of the one-end-up, one-end-down problem is not needed or desired, there is no need to check (or even maintain) the port age field in each connection entry. In these embodiments, the possible stacking port states can be reduced to “really-up” and “really-down.”
Further, in terms of the interaction between the problem detection algorithm of FIGS. 9A/9B and the previous flowcharts of FIGS. 4-8, in certain embodiments the record serial number for a device record may only be updated in response to a change to the port age or neighbor age fields (per block 614 of FIG. 6) if that change results in a change to stacking port or neighbor port state (e.g., from transit-up to really-up, etc.). This optimization can reduce the frequency with which the record serial number needs to be updated. In these embodiments, other events unrelated to the port age and neighbor age fields (e.g., adding/removing stacking ports, changing the message field, etc.) will still cause the record serial number to be incremented.
5. Resolving Port/Link Problems
Once port analysis component 210(X) for a given stackable switch 202(X) has detected a port/link problem per the algorithm of FIGS. 9A and 9B, component 210(X) can (depending on the nature of the problem) also take steps to resolve/correct the problem without requiring any human intervention. FIG. 10 depicts a flowchart 1000 of such a process according to an embodiment.
Starting with block 1002, port analysis component 210(X) can determine whether stackable switch 202(X) can reach the other switches of stacking system 200, without using the problematic ports that were identified via the detection algorithm of FIGS. 9A/9B. If so, port analysis component 210(X) can simply disable the problematic ports and flowchart 1000 can end. By disabling the problematic ports, port analysis component 210(X) can physically bring down those ports, causing the ports to transition to a DOWN status. This, in turn, will cause all of the switches in stacking system 200 will recalculate their forwarding paths in a manner that avoids use of the disabled ports.
If stackable switch 202(X) cannot reach all of the other switches using non-problematic ports, port analysis component 210(X) can check whether the problematic port is part of a unidirectional link (block 1006). If so, port analysis component 210(X) can cause the switch that cannot receive packets on the link to reload itself (block 1008). This action assumes that the port problem is a software issue (e.g., a port firmware bug, etc.) that will disappear after the reload. This action may not remedy the situation if the port problem is caused by a hardware issue (e.g., a faulty cable or hardware chip, etc.).
If the link is not unidirectional, port analysis component 210(X) can then move on to checking whether the link is completely nonfunctional (block 1010). If so, port analysis component 210(X) can cause the switches at both ends of the link to reload themselves (block 1012). As noted with respect to block 1008, this action may clear the problem if it was caused by a software issue, but may have no effect if it was caused by a hardware issue. Flowchart 1000 can subsequently end. If the problem is still not resolved at this point, port analysis component 210(X) may, e.g., generate an error or log entry indicating that the problem could not be automatically corrected.
Although not shown in FIG. 10, in scenarios where a switch needs to reload itself (e.g., in response to blocks 1008 and 1012), the switch can setup a timer to delay the reload for X number of seconds. The switch can then add a reload message to its device record (using, e.g., the general purpose message field), increment the record serial number, and send out a probe packet with the updated device record on all stacking ports. In this manner, the switch can inform the other switches in the stacking system that it is planning to reload. This is useful if, e.g., two switches need to reload at approximately the same time, since they can coordinate their reloads to overlap (and thereby avoid two rounds of such reloads). This can also allow the master switch in the stacking system to log information regarding the reload actions.
As noted above, the reload solution assumes that the detected port/link problem is a software issue and thus can be resolved by reloading the software of the switch. In cases where the port/link problem is actually a hardware issue, certain enhancements to flowchart 1000 of FIG. 10 can be implemented to avoid repeated reloading. For example, in one embodiment, port analysis components 210(1)-210(M) may require that each switch of the stacking system reach a stable/operational condition before being allowed to take the reload remedy at a later point in time (e.g., in response to a later detected port/link problem). This reduces the likelihood that the port/link problem is due to a hardware issue that cannot be resolved via a reload.
6. Exemplary Network Switch
FIG. 11 depicts a network switch 1100 according to an embodiment. Network switch 1100 can be used to implement any of the stackable switches/devices described in the foregoing disclosure, such as stackable switches 200(1)-200(M) of FIG. 2.
As shown, network switch 1100 includes a management module 1102, a switch fabric module 1104, and a number of I/O modules 1106(1)-1106(N). Management module 1102 represents the control plane of network switch 1100 and thus includes one or more management CPUs 1108 for managing/controlling the operation of the device. Each management CPU 1108 can be a general purpose processor, such as a PowerPC, Intel, AMD, or ARM-based processor, that operates under the control of software stored in an associated memory (not shown).
Switch fabric module 1104 and I/O modules 1106(1)-1106(N) collectively represent the data, or forwarding, plane of network switch 1100. Switch fabric module 1104 is configured to interconnect the various other modules of network switch 1100. Each I/O module 1106(1)-1106(N) can include one or more input/output ports 1110(1)-1110(N) that are used by network switch 1100 to send and receive data packets. As noted with respect to FIGS. 1A and 1B, ports 1110(1)-1110(N) can comprise data ports for communicating with hosts/other network devices, as well as stacking ports for communicating with other switches in the same stacking system. Each I/O module 1106(1)-1106(N) can also include a packet processor 1112(1)-1112(N). Packet processor 1112(1)-1112(N) is a hardware processing component (e.g., an FPGA or ASIC) that can make wire speed decisions on how to handle incoming or outgoing data packets.
It should be appreciated that network switch 1100 is illustrative and not intended to limit embodiments of the present invention. Many other configurations having more or fewer components than switch 1100 are possible.
The above description illustrates various embodiments of the present invention along with examples of how aspects of the present invention may be implemented. The above examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of the present invention as defined by the following claims. For example, although certain embodiments have been described with respect to particular process flows and steps, it should be apparent to those skilled in the art that the scope of the present invention is not strictly limited to the described flows and steps. Steps described as sequential may be executed in parallel, order of steps may be varied, and steps may be modified, combined, added, or omitted. As another example, although certain embodiments have been described using a particular combination of hardware and software, it should be recognized that other combinations of hardware and software are possible, and that specific operations described as being implemented in software can also be implemented in hardware and vice versa.
The specification and drawings are, accordingly, to be regarded in an illustrative rather than restrictive sense. Other arrangements, embodiments, implementations and equivalents will be evident to those skilled in the art and may be employed without departing from the spirit and scope of the invention as set forth in the following claims.

## Claims

1. A method performed by a device in a system of devices, the method comprising:
creating, by the device, a first record that includes port information pertaining to one or more ports of the device, wherein the one or more ports are usable for communicatively coupling the device to other devices in the system of devices, and wherein the first record includes, for each port in the one or more ports, a connection entry comprising a port identifier field and a neighbor port identifier field;
receiving, by the device, one or more second records from the other devices in the system of devices, the one or more second records including port information pertaining to ports of the other devices;
processing, by the device, each of the one or more second records by:
determining an identity of an egress port on which the second record was sent out;
determining an identity of an ingress port of the device on which the second record was received;
determining a first connection entry of the first record whose port identifier field matches the identity of the ingress port; and
populating the neighbor port identifier field of the first connection entry with the identity of the egress port, thereby recording, in the first connection entry, the egress port on which the second record was sent out as being a neighbor of the ingress port on which the second record was received;

storing, by the device, the first record and the one or more second records in a data store maintained locally on the device;
forwarding, by the device, copies of the first record and the one or more second records out of each of the one or more ports, the forwarding causing the copies of the first record and the one or more second records to be communicated to the other devices in the system of devices; and
detecting, based on the first record and the one or more second records stored in the data store, a problem associated with a port in the one or more ports, wherein the problem prevents the port, or a neighbor port of the port, from sending or receiving data packets.

2. The method of claim 1 where the port information included in the first record further comprises, for each port in the one or more ports:
a status of the port.

3. The method of claim 1 wherein the port information included in the first record further comprises, for each port in the one or more ports:
a port age indicating an amount of time since the status of the port last changed; and
a neighbor age indicating an amount of time since a record was last received from a neighbor port on the port.

4. The method of claim 1 wherein the first record further includes a message indicating an action that has been or will be performed by the device.

5. The method of claim 1 wherein storing the one more second records in the data store comprises, for each second record:
determining a record serial number associated with the second record;
determining a record serial number associated with a copy of the second record already stored in the data store, if such a stored copy exists; and
storing the second record in the data store if the record serial number associated with the second record is greater than the record serial number associated with the stored copy.

6. The method of claim 1 further comprising:
monitoring for events that affect the port information included in the first record; and
updating the first record in response to the events.

7. The method of claim 6 wherein the one or more events include:
a port status change,
an addition or removal of a port in the one or more ports; or
a passage of a predetermined time interval.

8. The method of claim of claim 1 wherein the detected problem is:
a problem where the port completely loses communication with its neighbor port;
a problem where a link between the port and its neighbor port becomes unidirectional; or
a problem where one end port of the link is up and the other end port of the link is down.

9. The method of claim 1 wherein the detecting takes into account a transit time for successfully transmitting packets between the devices in the system of devices.

10. The method of claim 1 further comprising:
resolving the detected problem without human intervention.

11. The method of claim 10 wherein resolving the detected problem without human intervention comprises:
determining if the device can communicate with the other devices in the system of devices via other, non-problematic ports; and
if so, disabling the port that is affected by the detected problem.

12. The method of claim 11 wherein resolving the detected problem without human intervention further comprises:
if the device cannot communicate with the other devices via other, non-problematic ports, causing one or more devices in the system of devices to automatically reload themselves.

13. The method of claim 1 wherein the device is a stackable switch, wherein the one or more ports are stacking ports of the stackable switch, and wherein the system of devices is a stacking system.

14. The method of claim 1 wherein, upon creation of the first record, the neighbor port identifier field is initialized with an empty or null value.

15. A device for use in a system of devices, the device comprising:
a processor;
one or more ports for communicatively coupling the device to other devices in the system of devices; and
a non-transitory computer readable medium having stored thereon program code which, when executed by the processor, causes the processor to:
create a first record that includes port information pertaining to the one or more ports, wherein the first record includes, for each port in the one or more ports, a connection entry comprising a port identifier field and a neighbor port identifier field;
receive one or more second records from the other devices in the system of devices, the one or more second records including port information pertaining to ports of the other devices;
process each of the one or more second records by:
determining an identity of an egress port on which the second record was sent out;
determining an identity of an ingress port of the device on which the second record was received;
determining a first connection entry of the first record whose port identifier field matches the identity of the ingress port; and
populating the neighbor port identifier field of the first connection entry with the identity of the egress port, thereby recording, in the first connection entry, the egress port on which the second record was sent out as being a neighbor of the ingress port on which the second record was received;

store the first record and the one or more second records in a data store maintained locally on the device;
forward copies of the first record and the one or more second records out of each of the one or more ports, the forwarding causing the copies of the first record and the one or more second records to be communicated to the other devices in the system of devices; and
detect, based on the first record and the one or more second records stored in the data store, a problem associated with a port in the one or more ports, wherein the problem prevents the port, or a neighbor port of the port, from sending or receiving data packets.

16. The device of claim 15 wherein the program code further causes the processor to:
resolve the detected problem without human intervention.

17. A non-transitory computer readable medium having stored thereon program code executable by a processor of a device for use in a system of devices, the program code comprising:
code that causes the processor to create a first record that includes port information pertaining to one or more ports of the device, wherein the plurality of ports are useable for communicatively coupling the device to other devices in the system of devices, and wherein the first record includes, for each port in the one or more ports, a connection entry comprising a port identifier field and a neighbor port identifier field;
code that causes the processor to receive one or more second records from the other devices in the system of devices, the one or more second records including port information pertaining to ports of the other devices;
code that causes the processor to process each of the one or more second records by:
determining an identity of an egress port on which the second record was sent out;
determining an identity of an ingress port of the device on which the second record was received;
determining a first connection entry of the first record whose port identifier field matches the identity of the ingress port; and
populating the neighbor port identifier field of the first connection entry with the identity of the egress port, thereby recording, in the first connection entry, the egress port on which the second record was sent out as being a neighbor of the ingress port on which the second record was received;

code that causes the processor to store the first record and the one or more second records in a data store maintained locally on the device;
code that causes the processor to forward copies of the first record and the one or more second records out of each of the one or more ports, the forwarding causing the copies of the first record and the one or more second records to be communicated to the other devices in the system of devices; and
code that causes the processor to detect, based on the first record and the one or more second records stored in the data store, a problem associated with a port in the one or more ports, wherein the problem prevents the port, or a neighbor port of the port, from sending or receiving data packets.

18. The non-transitory computer readable medium of claim 17 wherein the program code further comprises:
code that causes the processor to resolve the detected problem without human intervention.