Lines Matching refs:cif
281 #define CIF_LOCK_INIT(cif) mtx_init(&(cif)->cif_mtx, "carp_if", \ argument
283 #define CIF_LOCK_DESTROY(cif) mtx_destroy(&(cif)->cif_mtx) argument
284 #define CIF_LOCK_ASSERT(cif) mtx_assert(&(cif)->cif_mtx, MA_OWNED) argument
285 #define CIF_LOCK(cif) mtx_lock(&(cif)->cif_mtx) argument
286 #define CIF_UNLOCK(cif) mtx_unlock(&(cif)->cif_mtx) argument
287 #define CIF_FREE(cif) do { \ argument
288 CIF_LOCK(cif); \
289 if (TAILQ_EMPTY(&(cif)->cif_vrs)) \
290 carp_free_if(cif); \
292 CIF_UNLOCK(cif); \
1418 carp_multicast_setup(struct carp_if *cif, sa_family_t sa) in carp_multicast_setup() argument
1420 struct ifnet *ifp = cif->cif_ifp; in carp_multicast_setup()
1427 struct ip_moptions *imo = &cif->cif_imo; in carp_multicast_setup()
1455 struct ip6_moptions *im6o = &cif->cif_im6o; in carp_multicast_setup()
1518 carp_multicast_cleanup(struct carp_if *cif, sa_family_t sa) in carp_multicast_cleanup() argument
1521 struct ip_moptions *imo = &cif->cif_imo; in carp_multicast_cleanup()
1525 struct ip6_moptions *im6o = &cif->cif_im6o; in carp_multicast_cleanup()
1533 if (cif->cif_naddrs != 0) in carp_multicast_cleanup()
1545 if (cif->cif_naddrs6 != 0) in carp_multicast_cleanup()
1628 struct carp_if *cif; in carp_alloc() local
1632 if ((cif = ifp->if_carp) == NULL) in carp_alloc()
1633 cif = carp_alloc_if(ifp); in carp_alloc()
1659 CIF_LOCK(cif); in carp_alloc()
1660 TAILQ_INSERT_TAIL(&cif->cif_vrs, sc, sc_list); in carp_alloc()
1661 CIF_UNLOCK(cif); in carp_alloc()
1688 struct carp_if *cif = ifp->if_carp; in carp_destroy() local
1696 CIF_LOCK(cif); in carp_destroy()
1697 TAILQ_REMOVE(&cif->cif_vrs, sc, sc_list); in carp_destroy()
1698 CIF_UNLOCK(cif); in carp_destroy()
1720 struct carp_if *cif; in carp_alloc_if() local
1723 cif = malloc(sizeof(*cif), M_CARP, M_WAITOK|M_ZERO); in carp_alloc_if()
1729 cif->cif_flags |= CIF_PROMISC; in carp_alloc_if()
1731 CIF_LOCK_INIT(cif); in carp_alloc_if()
1732 cif->cif_ifp = ifp; in carp_alloc_if()
1733 TAILQ_INIT(&cif->cif_vrs); in carp_alloc_if()
1736 ifp->if_carp = cif; in carp_alloc_if()
1740 return (cif); in carp_alloc_if()
1744 carp_free_if(struct carp_if *cif) in carp_free_if() argument
1746 struct ifnet *ifp = cif->cif_ifp; in carp_free_if()
1748 CIF_LOCK_ASSERT(cif); in carp_free_if()
1749 KASSERT(TAILQ_EMPTY(&cif->cif_vrs), ("%s: softc list not empty", in carp_free_if()
1756 CIF_LOCK_DESTROY(cif); in carp_free_if()
1758 if (cif->cif_flags & CIF_PROMISC) in carp_free_if()
1762 free(cif, M_CARP); in carp_free_if()
1974 struct carp_if *cif = ifp->if_carp; in carp_attach() local
2006 error = carp_multicast_setup(cif, ifa->ifa_addr->sa_family); in carp_attach()
2008 CIF_FREE(cif); in carp_attach()
2020 cif->cif_naddrs++; in carp_attach()
2026 cif->cif_naddrs6++; in carp_attach()
2050 struct carp_if *cif = ifp->if_carp; in carp_detach() local
2072 cif->cif_naddrs--; in carp_detach()
2078 cif->cif_naddrs6--; in carp_detach()
2085 carp_multicast_cleanup(cif, ifa->ifa_addr->sa_family); in carp_detach()
2099 CIF_FREE(cif); in carp_detach()