| 1788 | } |
| 1789 | |
| 1790 | static void |
| 1791 | vxlan_teardown_locked(struct vxlan_softc *sc) |
| 1792 | { |
| 1793 | struct ifnet *ifp; |
| 1794 | struct vxlan_socket *vso; |
| 1795 | |
| 1796 | sx_assert(&vxlan_sx, SA_XLOCKED); |
| 1797 | VXLAN_LOCK_WASSERT(sc); |
| 1798 | MPASS(sc->vxl_flags & VXLAN_FLAG_TEARDOWN); |
| 1799 | |
| 1800 | ifp = sc->vxl_ifp; |
| 1801 | ifp->if_flags &= ~IFF_UP; |
| 1802 | ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
| 1803 | callout_stop(&sc->vxl_callout); |
| 1804 | vso = sc->vxl_sock; |
| 1805 | sc->vxl_sock = NULL; |
| 1806 | |
| 1807 | VXLAN_WUNLOCK(sc); |
| 1808 | if_link_state_change(ifp, LINK_STATE_DOWN); |
| 1809 | EVENTHANDLER_INVOKE(vxlan_stop, ifp, sc->vxl_src_addr.in4.sin_family, |
| 1810 | ntohs(sc->vxl_src_addr.in4.sin_port)); |
| 1811 | |
| 1812 | if (vso != NULL) { |
| 1813 | vxlan_socket_remove_softc(vso, sc); |
| 1814 | |
| 1815 | if (sc->vxl_vso_mc_index != -1) { |
| 1816 | vxlan_socket_mc_release_group_by_idx(vso, |
| 1817 | sc->vxl_vso_mc_index); |
| 1818 | sc->vxl_vso_mc_index = -1; |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | VXLAN_WLOCK(sc); |
| 1823 | while (sc->vxl_refcnt != 0) |
| 1824 | rm_sleep(sc, &sc->vxl_lock, 0, "vxldrn", hz); |
| 1825 | VXLAN_WUNLOCK(sc); |
| 1826 | |
| 1827 | callout_drain(&sc->vxl_callout); |
| 1828 | |
| 1829 | vxlan_free_multicast(sc); |
| 1830 | if (vso != NULL) |
| 1831 | vxlan_socket_release(vso); |
| 1832 | |
| 1833 | vxlan_teardown_complete(sc); |
| 1834 | } |
| 1835 | |
| 1836 | static void |
| 1837 | vxlan_teardown(struct vxlan_softc *sc) |
no test coverage detected