Patent ID: 8693341

Claim:
A method for forwarding network data through a stacked switch, comprising: identifying a relative cost to forward network data from an ingress switch to each of a plurality of egress switches that are coupled together and to the ingress switch through stacking links, and storing the plurality of identified relative costs, wherein each identified relative cost represents a number of the stacking links over which network data ingressing to the ingress switch is forwarded before egressing the egress switch associated with that identified relative cost; receiving network data on the ingress switch that includes the identity of a link aggregation group (LAG) associated with the stacked switch, performing a hashing operation on information included in the network data to calculate a next hop value that is associated with a first egress switch of the plurality of egress switches for forwarding the network data out of the stacked switch, wherein the first egress switch is associated with a first identified cost of the plurality of identified costs; determining that the calculated next hop value maps to a LAG port that is not located on the ingress switch and, in response, calculating a reduced relative cost that corresponds to a second identified relative cost of the plurality of identified costs that is less than the first identified relative cost; and transmitting the network data over a second egress switch of the plurality of egress switches that is associated with the second identified relative cost if an egress port on the second egress switch is a member of the LAG.