Lines Matching defs:cif

252 #define	CIF_LOCK_INIT(cif)	mtx_init(&(cif)->cif_mtx, "carp_if",   \
254 #define CIF_LOCK_DESTROY(cif) mtx_destroy(&(cif)->cif_mtx)
255 #define CIF_LOCK_ASSERT(cif) mtx_assert(&(cif)->cif_mtx, MA_OWNED)
256 #define CIF_LOCK(cif) mtx_lock(&(cif)->cif_mtx)
257 #define CIF_UNLOCK(cif) mtx_unlock(&(cif)->cif_mtx)
258 #define CIF_FREE(cif) do { \
259 CIF_LOCK(cif); \
260 if (TAILQ_EMPTY(&(cif)->cif_vrs)) \
261 carp_free_if(cif); \
263 CIF_UNLOCK(cif); \
1251 carp_multicast_setup(struct carp_if *cif, sa_family_t sa)
1253 struct ifnet *ifp = cif->cif_ifp;
1260 struct ip_moptions *imo = &cif->cif_imo;
1289 struct ip6_moptions *im6o = &cif->cif_im6o;
1352 carp_multicast_cleanup(struct carp_if *cif, sa_family_t sa)
1360 if (cif->cif_naddrs == 0) {
1361 struct ip_moptions *imo = &cif->cif_imo;
1374 if (cif->cif_naddrs6 == 0) {
1375 struct ip6_moptions *im6o = &cif->cif_im6o;
1469 struct carp_if *cif;
1471 if ((cif = ifp->if_carp) == NULL)
1472 cif = carp_alloc_if(ifp);
1494 CIF_LOCK(cif);
1495 TAILQ_INSERT_TAIL(&cif->cif_vrs, sc, sc_list);
1496 CIF_UNLOCK(cif);
1523 struct carp_if *cif = ifp->if_carp;
1531 CIF_LOCK(cif);
1532 TAILQ_REMOVE(&cif->cif_vrs, sc, sc_list);
1533 CIF_UNLOCK(cif);
1555 struct carp_if *cif;
1558 cif = malloc(sizeof(*cif), M_CARP, M_WAITOK|M_ZERO);
1564 cif->cif_flags |= CIF_PROMISC;
1566 CIF_LOCK_INIT(cif);
1567 cif->cif_ifp = ifp;
1568 TAILQ_INIT(&cif->cif_vrs);
1571 ifp->if_carp = cif;
1575 return (cif);
1579 carp_free_if(struct carp_if *cif)
1581 struct ifnet *ifp = cif->cif_ifp;
1583 CIF_LOCK_ASSERT(cif);
1584 KASSERT(TAILQ_EMPTY(&cif->cif_vrs), ("%s: softc list not empty",
1591 CIF_LOCK_DESTROY(cif);
1593 if (cif->cif_flags & CIF_PROMISC)
1597 free(cif, M_CARP);
1803 struct carp_if *cif = ifp->if_carp;
1827 CIF_LOCK(cif);
1831 CIF_UNLOCK(cif);
1837 error = carp_multicast_setup(cif, ifa->ifa_addr->sa_family);
1839 CIF_FREE(cif);
1851 cif->cif_naddrs++;
1857 cif->cif_naddrs6++;
1881 struct carp_if *cif = ifp->if_carp;
1903 cif->cif_naddrs--;
1909 cif->cif_naddrs6--;
1916 carp_multicast_cleanup(cif, ifa->ifa_addr->sa_family);
1929 CIF_FREE(cif);