Lines Matching refs:dp

1541 	struct dadq *dp;
1544 for (dp = dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) {
1545 DAD_LOCK_SPIN(dp);
1546 if (dp->dad_ifa == ifa) {
1547 DAD_ADDREF_LOCKED(dp);
1548 DAD_UNLOCK(dp);
1550 return (dp);
1552 DAD_UNLOCK(dp);
1575 struct dadq *dp;
1605 if ((dp = nd6_dad_find(ifa)) != NULL) {
1606 DAD_REMREF(dp);
1611 dp = zalloc(dad_zone);
1612 if (dp == NULL) {
1619 bzero(dp, dad_size);
1620 lck_mtx_init(&dp->dad_lock, ifa_mtx_grp, ifa_mtx_attr);
1623 dp = nd6_dad_attach(dp, ifa);
1640 nd6_dad_ns_output(dp, ifa);
1661 DAD_REMREF(dp); /* drop our reference */
1665 nd6_dad_attach(struct dadq *dp, struct ifaddr *ifa)
1668 DAD_LOCK(dp);
1669 dp->dad_ifa = ifa;
1671 dp->dad_count = ip6_dad_count;
1672 dp->dad_ns_icount = dp->dad_na_icount = 0;
1673 dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
1674 dp->dad_na_ixcount = 0;
1675 VERIFY(!dp->dad_attached);
1676 dp->dad_attached = 1;
1677 DAD_ADDREF_LOCKED(dp); /* for caller */
1678 DAD_ADDREF_LOCKED(dp); /* for dadq_head list */
1679 TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list);
1680 DAD_UNLOCK(dp);
1683 return (dp);
1687 nd6_dad_detach(struct dadq *dp, struct ifaddr *ifa)
1692 DAD_LOCK(dp);
1693 if ((detached = dp->dad_attached)) {
1694 VERIFY(dp->dad_ifa == ifa);
1695 TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list);
1696 dp->dad_list.tqe_next = NULL;
1697 dp->dad_list.tqe_prev = NULL;
1698 dp->dad_attached = 0;
1700 DAD_UNLOCK(dp);
1703 DAD_REMREF(dp); /* drop dadq_head reference */
1713 struct dadq *dp;
1715 dp = nd6_dad_find(ifa);
1716 if (!dp) {
1723 nd6_dad_detach(dp, ifa);
1724 DAD_REMREF(dp); /* drop our reference */
1759 struct dadq *dp = NULL;
1766 dp = nd6_dad_find(ifa);
1767 if (dp == NULL) {
1791 DAD_LOCK(dp);
1792 if (dp->dad_ns_tcount > dad_maxtry) {
1793 DAD_UNLOCK(dp);
1797 nd6_dad_detach(dp, ifa);
1802 if (dp->dad_ns_ocount < dp->dad_count) {
1806 DAD_UNLOCK(dp);
1810 nd6_dad_ns_output(dp, ifa);
1828 if (dp->dad_na_icount) {
1836 if (dp->dad_ns_icount) {
1840 DAD_UNLOCK(dp);
1843 /* (*dp) will be freed in nd6_dad_duplicated() */
1865 nd6_dad_detach(dp, ifa);
1870 if (dp != NULL)
1871 DAD_REMREF(dp); /* drop our reference */
1878 struct dadq *dp;
1882 dp = nd6_dad_find(ifa);
1883 if (dp == NULL) {
1889 DAD_LOCK(dp);
1893 dp->dad_ns_icount, dp->dad_ns_ocount, dp->dad_na_icount,
1894 dp->dad_na_ixcount);
1895 hwdupposs = dp->dad_na_ixcount;
1896 DAD_UNLOCK(dp);
1927 nd6_dad_detach(dp, ifa);
1928 DAD_REMREF(dp); /* drop our reference */
1932 nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa)
1938 DAD_LOCK(dp);
1939 dp->dad_ns_tcount++;
1941 DAD_UNLOCK(dp);
1945 DAD_UNLOCK(dp);
1949 dp->dad_ns_ocount++;
1950 DAD_UNLOCK(dp);
1960 struct dadq *dp;
1969 dp = nd6_dad_find(ifa);
1987 if (dp != NULL)
1988 DAD_LOCK(dp);
1989 if (dp == NULL || dp->dad_ns_ocount == 0)
1995 if (dp != NULL) {
1996 DAD_UNLOCK(dp);
1997 DAD_REMREF(dp);
1998 dp = NULL;
2001 } else if (dp != NULL) {
2006 dp->dad_ns_icount++;
2007 DAD_UNLOCK(dp);
2008 DAD_REMREF(dp);
2016 struct dadq *dp;
2022 dp = nd6_dad_find(ifa);
2023 if (dp == NULL) {
2103 DAD_LOCK_SPIN(dp);
2104 dp->dad_na_icount++;
2106 dp->dad_na_ixcount++;
2107 DAD_UNLOCK(dp);
2108 DAD_REMREF(dp);
2115 dad_addref(struct dadq *dp, int locked)
2118 DAD_LOCK_SPIN(dp);
2120 DAD_LOCK_ASSERT_HELD(dp);
2122 if (++dp->dad_refcount == 0) {
2123 panic("%s: dad %p wraparound refcnt\n", __func__, dp);
2127 DAD_UNLOCK(dp);
2131 dad_remref(struct dadq *dp)
2135 DAD_LOCK_SPIN(dp);
2136 if (dp->dad_refcount == 0)
2137 panic("%s: dad %p negative refcnt\n", __func__, dp);
2138 --dp->dad_refcount;
2139 if (dp->dad_refcount > 0) {
2140 DAD_UNLOCK(dp);
2143 DAD_UNLOCK(dp);
2145 if (dp->dad_attached ||
2146 dp->dad_list.tqe_next != NULL || dp->dad_list.tqe_prev != NULL) {
2147 panic("%s: attached dad=%p is being freed", __func__, dp);
2151 if ((ifa = dp->dad_ifa) != NULL) {
2153 dp->dad_ifa = NULL;
2156 lck_mtx_destroy(&dp->dad_lock, ifa_mtx_grp);
2157 zfree(dad_zone, dp);