stp - avoid links with packet loss

We have a set of devices connected in a ring, that are using stp (using https://github.com/mstpd/mstpd at the moment) to avoid issues with the loop. What we have seen, is that while stp can adapt the network when a link is fully broken, it ignores a situation where one of the links sees high packet loss.

Is this something stp supports? that is, to consider the packet loss in network links in the cost associated to a given interface and adapt the network based on that? If not, are there any good alternatives?

The way we ran into that, is because there were some usb to eth adapters that failed in some cases after rebooting or after a manual reconnection of the eth cable. While the issue is likely some driver/os related issue, it showed very well that stp still chooses the partially failing link, ending in a permanent 50% packet loss instead of the 0% of avoiding that link.


Solution 1:

What we have seen, is that while stp can adapt the network when a link is fully broken, it ignores a situation where one of the links sees high packet loss. Is this something stp supports?

Link quality is nothing STP cares about nor is designed to handle.

STP runs between switches. If more than just a very few packets are lost the link's bad and needs to be fixed.

The only way to avoid those bad links would be some monitoring and shutting down the port at a certain error rate. Since links are normally practically error-free, that's nothing you'd commonly find in a switch.

As a workaround, you could use port priorities to have STP avoid a known-bad link while still keeping it as a fail-over.