ECMP operation consists of an initial hash based on the system IP address, then on the global port number if the use-ingress-port option is enabled.
Each label in the stack is then hashed separately with the result of the previous hash, up to a maximum of 16 labels. The net result is used to select which LDP FEC next hop to send the packet to using a threshold hashing operation of the net result with the number of next hops. Threshold hashing is described in RFC 2992, Analysis of an Equal-Cost Multi-Path Algorithm.
If an ELI is found in the label stack, the entropy label replaces the MPLS label stack hashing result and hashing continues.
If the selected LDP FEC or LSP has its NHLFE programmed with a LAG interface, a second round of hashing is needed, using the net result of the first round of hashing as the hashing input.