Lines Matching refs:V_tcp_hostcache
145 #define V_tcp_hostcache VNET(tcp_hostcache) macro
216 V_tcp_hostcache.hashsalt) & V_tcp_hostcache.hashmask) \
219 V_tcp_hostcache.hashsalt) & V_tcp_hostcache.hashmask)
233 atomic_store_int(&V_tcp_hostcache.cache_count, 0); in tcp_hc_init()
234 V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; in tcp_hc_init()
235 V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; in tcp_hc_init()
236 V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; in tcp_hc_init()
237 V_tcp_hostcache.prune = TCP_HOSTCACHE_PRUNE; in tcp_hc_init()
238 V_tcp_hostcache.hashsalt = arc4random(); in tcp_hc_init()
241 &V_tcp_hostcache.hashsize); in tcp_hc_init()
242 if (!powerof2(V_tcp_hostcache.hashsize)) { in tcp_hc_init()
244 V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; /* default */ in tcp_hc_init()
246 V_tcp_hostcache.hashmask = V_tcp_hostcache.hashsize - 1; in tcp_hc_init()
249 &V_tcp_hostcache.bucket_limit); in tcp_hc_init()
251 cache_limit = V_tcp_hostcache.hashsize * V_tcp_hostcache.bucket_limit; in tcp_hc_init()
252 V_tcp_hostcache.cache_limit = cache_limit; in tcp_hc_init()
254 &V_tcp_hostcache.cache_limit); in tcp_hc_init()
255 if (V_tcp_hostcache.cache_limit > cache_limit) in tcp_hc_init()
256 V_tcp_hostcache.cache_limit = cache_limit; in tcp_hc_init()
261 V_tcp_hostcache.hashbase = (struct hc_head *) in tcp_hc_init()
262 malloc(V_tcp_hostcache.hashsize * sizeof(struct hc_head), in tcp_hc_init()
268 for (i = 0; i < V_tcp_hostcache.hashsize; i++) { in tcp_hc_init()
269 CK_SLIST_INIT(&V_tcp_hostcache.hashbase[i].hch_bucket); in tcp_hc_init()
270 V_tcp_hostcache.hashbase[i].hch_length = 0; in tcp_hc_init()
271 mtx_init(&V_tcp_hostcache.hashbase[i].hch_mtx, "tcp_hc_entry", in tcp_hc_init()
278 V_tcp_hostcache.zone = in tcp_hc_init()
281 uma_zone_set_max(V_tcp_hostcache.zone, V_tcp_hostcache.cache_limit); in tcp_hc_init()
282 V_tcp_hostcache.smr = uma_zone_get_smr(V_tcp_hostcache.zone); in tcp_hc_init()
288 callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz, in tcp_hc_init()
304 uma_zdestroy(V_tcp_hostcache.zone); in tcp_hc_destroy()
306 for (i = 0; i < V_tcp_hostcache.hashsize; i++) in tcp_hc_destroy()
307 mtx_destroy(&V_tcp_hostcache.hashbase[i].hch_mtx); in tcp_hc_destroy()
308 free(V_tcp_hostcache.hashbase, M_HOSTCACHE); in tcp_hc_destroy()
345 hc_head = &V_tcp_hostcache.hashbase[HOSTCACHE_HASH(inc)]; in tcp_hc_lookup()
350 smr_enter(V_tcp_hostcache.smr); in tcp_hc_lookup()
357 V_tcp_hostcache.expire) in tcp_hc_lookup()
359 V_tcp_hostcache.expire); in tcp_hc_lookup()
364 smr_exit(V_tcp_hostcache.smr); in tcp_hc_lookup()
405 smr_exit(V_tcp_hostcache.smr); in tcp_hc_get()
428 smr_exit(V_tcp_hostcache.smr); in tcp_hc_getmtu()
460 hc_head = &V_tcp_hostcache.hashbase[HOSTCACHE_HASH(inc)]; in tcp_hc_update()
473 V_tcp_hostcache.expire) in tcp_hc_update()
475 V_tcp_hostcache.expire); in tcp_hc_update()
491 if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || in tcp_hc_update()
492 atomic_load_int(&V_tcp_hostcache.cache_count) >= in tcp_hc_update()
493 V_tcp_hostcache.cache_limit) { in tcp_hc_update()
512 hc_head->hch_length <= V_tcp_hostcache.bucket_limit, in tcp_hc_update()
516 atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); in tcp_hc_update()
518 uma_zfree_smr(V_tcp_hostcache.zone, hc_entry); in tcp_hc_update()
524 hc_entry = uma_zalloc_smr(V_tcp_hostcache.zone, M_NOWAIT); in tcp_hc_update()
539 hc_entry->rmx_expire = V_tcp_hostcache.expire; in tcp_hc_update()
610 KASSERT(hc_head->hch_length <= V_tcp_hostcache.bucket_limit, in tcp_hc_update()
612 atomic_add_int(&V_tcp_hostcache.cache_count, 1); in tcp_hc_update()
644 len = (atomic_load_int(&V_tcp_hostcache.cache_count) + 1) * in sysctl_tcp_hc_list()
655 sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * in sysctl_tcp_hc_list()
668 for (i = 0; i < V_tcp_hostcache.hashsize; i++) { in sysctl_tcp_hc_list()
669 THC_LOCK(&V_tcp_hostcache.hashbase[i]); in sysctl_tcp_hc_list()
671 &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { in sysctl_tcp_hc_list()
700 THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); in sysctl_tcp_hc_list()
725 histo = (int *)malloc(sizeof(int) * (V_tcp_hostcache.bucket_limit + 1), in sysctl_tcp_hc_histo()
730 for (i = 0; i < V_tcp_hostcache.hashsize; i++) { in sysctl_tcp_hc_histo()
731 hch_length = V_tcp_hostcache.hashbase[i].hch_length; in sysctl_tcp_hc_histo()
732 KASSERT(hch_length <= V_tcp_hostcache.bucket_limit, in sysctl_tcp_hc_histo()
742 for (i = 0; i <= V_tcp_hostcache.bucket_limit; i++) { in sysctl_tcp_hc_histo()
761 for (i = 0; i < V_tcp_hostcache.hashsize; i++) { in tcp_hc_purge_internal()
762 head = &V_tcp_hostcache.hashbase[i]; in tcp_hc_purge_internal()
768 V_tcp_hostcache.bucket_limit, ("tcp_hostcache: " in tcp_hc_purge_internal()
787 uma_zfree_smr(V_tcp_hostcache.zone, hc_entry); in tcp_hc_purge_internal()
789 atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); in tcp_hc_purge_internal()
792 V_tcp_hostcache.prune); in tcp_hc_purge_internal()
810 if (V_tcp_hostcache.purgeall) { in tcp_hc_purge()
811 if (V_tcp_hostcache.purgeall == 2) in tcp_hc_purge()
812 V_tcp_hostcache.hashsalt = arc4random(); in tcp_hc_purge()
814 V_tcp_hostcache.purgeall = 0; in tcp_hc_purge()
819 callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz, in tcp_hc_purge()
838 V_tcp_hostcache.hashsalt = arc4random(); in sysctl_tcp_hc_purgenow()
841 callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz, in sysctl_tcp_hc_purgenow()