| 3653 | } |
| 3654 | |
| 3655 | static void |
| 3656 | bridge_linkcheck(struct bridge_softc *sc) |
| 3657 | { |
| 3658 | struct bridge_iflist *bif; |
| 3659 | int new_link, hasls; |
| 3660 | |
| 3661 | BRIDGE_LOCK_OR_NET_EPOCH_ASSERT(sc); |
| 3662 | |
| 3663 | new_link = LINK_STATE_DOWN; |
| 3664 | hasls = 0; |
| 3665 | /* Our link is considered up if at least one of our ports is active */ |
| 3666 | CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { |
| 3667 | if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE) |
| 3668 | hasls++; |
| 3669 | if (bif->bif_ifp->if_link_state == LINK_STATE_UP) { |
| 3670 | new_link = LINK_STATE_UP; |
| 3671 | break; |
| 3672 | } |
| 3673 | } |
| 3674 | if (!CK_LIST_EMPTY(&sc->sc_iflist) && !hasls) { |
| 3675 | /* If no interfaces support link-state then we default to up */ |
| 3676 | new_link = LINK_STATE_UP; |
| 3677 | } |
| 3678 | if_link_state_change(sc->sc_ifp, new_link); |
| 3679 | } |
no test coverage detected