Lines Matching refs:ro

2014 _rtcache_init(struct route *ro, int flag)  in _rtcache_init()  argument
2018 rtcache_invariants(ro); in _rtcache_init()
2019 KASSERT(ro->_ro_rt == NULL); in _rtcache_init()
2021 if (rtcache_getdst(ro) == NULL) in _rtcache_init()
2023 rt = rtalloc1(rtcache_getdst(ro), flag); in _rtcache_init()
2027 ro->_ro_rt = rt; in _rtcache_init()
2028 ro->ro_rtcache_generation = rtcache_generation; in _rtcache_init()
2029 rtcache_ref(rt, ro); in _rtcache_init()
2035 rtcache_invariants(ro); in _rtcache_init()
2036 return ro->_ro_rt; in _rtcache_init()
2040 rtcache_init(struct route *ro) in rtcache_init() argument
2043 return _rtcache_init(ro, 1); in rtcache_init()
2047 rtcache_init_noclone(struct route *ro) in rtcache_init_noclone() argument
2050 return _rtcache_init(ro, 0); in rtcache_init_noclone()
2054 rtcache_update(struct route *ro, int clone) in rtcache_update() argument
2057 ro->_ro_rt = NULL; in rtcache_update()
2058 return _rtcache_init(ro, clone); in rtcache_update()
2091 rtcache_trace(const char *func, struct rtentry *rt, struct route *ro) in rtcache_trace() argument
2095 sockaddr_format(ro->ro_sa, dst, 64); in rtcache_trace()
2097 cpu_index(curcpu()), curlwp, &ro->ro_psref, &rt->rt_psref); in rtcache_trace()
2099 #define RTCACHE_PSREF_TRACE(rt, ro) rtcache_trace(__func__, (rt), (ro)) argument
2101 #define RTCACHE_PSREF_TRACE(rt, ro) do {} while (0) argument
2105 rtcache_ref(struct rtentry *rt, struct route *ro) in rtcache_ref() argument
2111 RTCACHE_PSREF_TRACE(rt, ro); in rtcache_ref()
2112 ro->ro_bound = curlwp_bind(); in rtcache_ref()
2114 PSREF_DEBUG_FILL_RETURN_ADDRESS(&ro->ro_psref); in rtcache_ref()
2115 psref_acquire(&ro->ro_psref, &rt->rt_psref, rt_psref_class); in rtcache_ref()
2120 rtcache_unref(struct rtentry *rt, struct route *ro) in rtcache_unref() argument
2127 psref_release(&ro->ro_psref, &rt->rt_psref, rt_psref_class); in rtcache_unref()
2128 curlwp_bindx(ro->ro_bound); in rtcache_unref()
2129 RTCACHE_PSREF_TRACE(rt, ro); in rtcache_unref()
2134 rtcache_validate(struct route *ro) in rtcache_validate() argument
2141 rtcache_invariants(ro); in rtcache_validate()
2143 if (ro->ro_rtcache_generation != rtcache_generation) { in rtcache_validate()
2149 rt = ro->_ro_rt; in rtcache_validate()
2170 rtcache_ref(rt, ro); in rtcache_validate()
2177 rtcache_lookup2(struct route *ro, const struct sockaddr *dst, in rtcache_lookup2() argument
2183 odst = rtcache_getdst(ro); in rtcache_lookup2()
2188 rtcache_free(ro); in rtcache_lookup2()
2192 rt = rtcache_validate(ro); in rtcache_lookup2()
2194 ro->_ro_rt = NULL; in rtcache_lookup2()
2198 rtcache_invariants(ro); in rtcache_lookup2()
2206 if (rtcache_setdst(ro, dst) == 0) in rtcache_lookup2()
2207 rt = _rtcache_init(ro, clone); in rtcache_lookup2()
2209 rtcache_invariants(ro); in rtcache_lookup2()
2215 rtcache_free(struct route *ro) in rtcache_free() argument
2218 ro->_ro_rt = NULL; in rtcache_free()
2219 if (ro->ro_sa != NULL) { in rtcache_free()
2220 sockaddr_free(ro->ro_sa); in rtcache_free()
2221 ro->ro_sa = NULL; in rtcache_free()
2223 rtcache_invariants(ro); in rtcache_free()
2227 rtcache_setdst(struct route *ro, const struct sockaddr *sa) in rtcache_setdst() argument
2231 rtcache_invariants(ro); in rtcache_setdst()
2232 if (ro->ro_sa != NULL) { in rtcache_setdst()
2233 if (ro->ro_sa->sa_family == sa->sa_family) { in rtcache_setdst()
2234 ro->_ro_rt = NULL; in rtcache_setdst()
2235 sockaddr_copy(ro->ro_sa, ro->ro_sa->sa_len, sa); in rtcache_setdst()
2236 rtcache_invariants(ro); in rtcache_setdst()
2240 rtcache_free(ro); in rtcache_setdst()
2243 KASSERT(ro->_ro_rt == NULL); in rtcache_setdst()
2245 if ((ro->ro_sa = sockaddr_dup(sa, M_ZERO | M_NOWAIT)) == NULL) { in rtcache_setdst()
2246 rtcache_invariants(ro); in rtcache_setdst()
2249 rtcache_invariants(ro); in rtcache_setdst()