Lines Matching refs:tlb
218 #define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) argument
219 #define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) argument
220 #define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) argument
221 #define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) argument
222 #define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) argument
223 #define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) argument
225 #define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) argument
226 #define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) argument
324 tcp_log_remove_bucket(struct tcp_log_id_bucket *tlb) in tcp_log_remove_bucket() argument
328 KASSERT(SLIST_EMPTY(&tlb->tlb_head), in tcp_log_remove_bucket()
330 if (RB_REMOVE(tcp_log_id_tree, &tcp_log_id_head, tlb) == NULL) { in tcp_log_remove_bucket()
336 TCPID_BUCKET_LOCK_DESTROY(tlb); in tcp_log_remove_bucket()
337 uma_zfree(tcp_log_id_bucket_zone, tlb); in tcp_log_remove_bucket()
351 tcp_log_unref_bucket(struct tcp_log_id_bucket *tlb, int *tree_locked, in tcp_log_unref_bucket() argument
355 KASSERT(tlb != NULL, ("%s: called with NULL tlb", __func__)); in tcp_log_unref_bucket()
367 while (TCPID_BUCKET_UNREF(tlb)) { in tcp_log_unref_bucket()
379 TCPID_BUCKET_REF(tlb); in tcp_log_unref_bucket()
382 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_unref_bucket()
387 TCPID_BUCKET_LOCK(tlb); in tcp_log_unref_bucket()
397 tcp_log_remove_bucket(tlb); in tcp_log_unref_bucket()
424 struct tcp_log_id_bucket *tlb, struct tcp_log_id_node *tln, in tcp_log_remove_id_node() argument
429 KASSERT(tp != NULL || (tlb != NULL && tln != NULL), in tcp_log_remove_id_node()
431 tp, tlb, tln)); in tcp_log_remove_id_node()
436 tlb = tp->t_lib; in tcp_log_remove_id_node()
438 KASSERT(tlb != NULL, ("%s: unexpectedly NULL tlb", __func__)); in tcp_log_remove_id_node()
443 TCPID_BUCKET_LOCK_ASSERT(tlb); in tcp_log_remove_id_node()
450 SLIST_REMOVE(&tlb->tlb_head, tln, tcp_log_id_node, tln_list); in tcp_log_remove_id_node()
456 if (!tcp_log_unref_bucket(tlb, tree_locked, inp)) in tcp_log_remove_id_node()
457 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_remove_id_node()
491 struct tcp_log_id_bucket *tlb, *tmp_tlb; in tcp_log_set_id() local
497 tlb = NULL; in tcp_log_set_id()
523 tlb = tp->t_lib; in tcp_log_set_id()
524 TCPID_BUCKET_REF(tlb); in tcp_log_set_id()
531 TCPID_BUCKET_LOCK(tlb); in tcp_log_set_id()
539 if (tcp_log_unref_bucket(tlb, &tree_locked, inp)) { in tcp_log_set_id()
541 tlb = NULL; in tcp_log_set_id()
561 if (tlb == NULL || tp->t_lib != tlb) { in tcp_log_set_id()
562 KASSERT(bucket_locked || tlb == NULL, in tcp_log_set_id()
564 "inconsistent", __func__, bucket_locked, tlb)); in tcp_log_set_id()
567 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_set_id()
569 tlb = NULL; in tcp_log_set_id()
587 tlb = NULL; in tcp_log_set_id()
646 KASSERT(tlb == NULL, ("%s:%d tlb unexpectedly non-NULL", in tcp_log_set_id()
673 tlb = uma_zalloc(tcp_log_id_bucket_zone, M_NOWAIT); in tcp_log_set_id()
674 if (tlb == NULL) { in tcp_log_set_id()
688 strncpy(tlb->tlb_id, id, TCP_LOG_ID_LEN - 1); in tcp_log_set_id()
689 tlb->tlb_id[TCP_LOG_ID_LEN - 1] = '\0'; in tcp_log_set_id()
698 SLIST_INIT(&tlb->tlb_head); in tcp_log_set_id()
699 refcount_init(&tlb->tlb_refcnt, 1); in tcp_log_set_id()
700 memset(&tlb->tlb_mtx, 0, sizeof(struct mtx)); in tcp_log_set_id()
701 TCPID_BUCKET_LOCK_INIT(tlb); in tcp_log_set_id()
702 TCPID_BUCKET_LOCK(tlb); in tcp_log_set_id()
706 TCPID_BUCKET_LOCK_DESTROY(tlb); \ in tcp_log_set_id()
707 uma_zfree(tcp_log_id_bucket_zone, tlb); \ in tcp_log_set_id()
709 tlb = NULL; \ in tcp_log_set_id()
724 tlb); in tcp_log_set_id()
727 "adding new bucket (%p)", __func__, tmp_tlb, tlb)); in tcp_log_set_id()
743 tlb = tmp_tlb; in tcp_log_set_id()
744 TCPID_BUCKET_LOCK(tlb); in tcp_log_set_id()
755 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_set_id()
756 tlb = NULL; in tcp_log_set_id()
761 TCPID_BUCKET_REF(tlb); in tcp_log_set_id()
764 tcp_log_grow_tlb(tlb->tlb_id, tp); in tcp_log_set_id()
767 SLIST_INSERT_HEAD(&tlb->tlb_head, tln, tln_list); in tcp_log_set_id()
768 tp->t_lib = tlb; in tcp_log_set_id()
781 TCPID_BUCKET_LOCK_ASSERT(tlb); in tcp_log_set_id()
782 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_set_id()
783 } else if (tlb != NULL) in tcp_log_set_id()
784 TCPID_BUCKET_UNLOCK_ASSERT(tlb); in tcp_log_set_id()
1034 struct tcp_log_id_bucket *tlb; in tcp_log_expire() local
1076 tlb = tln->tln_bucket; in tcp_log_expire()
1077 TCPID_BUCKET_LOCK(tlb); in tcp_log_expire()
1078 if (tcp_log_remove_id_node(NULL, NULL, tlb, tln, &tree_locked)) { in tcp_log_expire()
2081 struct tcp_log_id_bucket *tlb; in tcp_log_dump_node_logbuf() local
2083 tlb = tln->tln_bucket; in tcp_log_dump_node_logbuf()
2084 TCPID_BUCKET_LOCK_ASSERT(tlb); in tcp_log_dump_node_logbuf()
2085 KASSERT(tlb->tlb_refcnt > 0, in tcp_log_dump_node_logbuf()
2087 __func__, __LINE__, tln, tlb)); in tcp_log_dump_node_logbuf()
2106 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_dump_node_logbuf()
2109 TCPID_BUCKET_LOCK(tlb); in tcp_log_dump_node_logbuf()
2118 strlcpy(entry->tldl_id, tlb->tlb_id, TCP_LOG_ID_LEN); in tcp_log_dump_node_logbuf()
2145 tcp_log_dumpbucketlogs(struct tcp_log_id_bucket *tlb, char *reason) in tcp_log_dumpbucketlogs() argument
2154 TCPID_BUCKET_LOCK_ASSERT(tlb); in tcp_log_dumpbucketlogs()
2160 TCPID_BUCKET_REF(tlb); in tcp_log_dumpbucketlogs()
2174 SLIST_FOREACH_SAFE(cur_tln, &tlb->tlb_head, tln_list, tmp_tln) { in tcp_log_dumpbucketlogs()
2213 SLIST_REMOVE_HEAD(&tlb->tlb_head, tln_list); in tcp_log_dumpbucketlogs()
2228 if (tcp_log_unref_bucket(tlb, &tree_locked, NULL)) { in tcp_log_dumpbucketlogs()
2314 tlb, ("%s: %d: bucket mismatch for node %p", in tcp_log_dumpbucketlogs()
2355 if (!tcp_log_unref_bucket(tlb, &tree_locked, NULL)) in tcp_log_dumpbucketlogs()
2356 TCPID_BUCKET_UNLOCK(tlb); in tcp_log_dumpbucketlogs()
2384 struct tcp_log_id_bucket *tlb; in tcp_log_dump_tp_bucket_logbufs() local
2389 tlb = tp->t_lib; in tcp_log_dump_tp_bucket_logbufs()
2390 if (tlb == NULL) { in tcp_log_dump_tp_bucket_logbufs()
2399 TCPID_BUCKET_REF(tlb); in tcp_log_dump_tp_bucket_logbufs()
2401 TCPID_BUCKET_LOCK(tlb); in tcp_log_dump_tp_bucket_logbufs()
2405 if (tcp_log_unref_bucket(tlb, &tree_locked, NULL)) { in tcp_log_dump_tp_bucket_logbufs()
2418 tcp_log_dumpbucketlogs(tlb, reason); in tcp_log_dump_tp_bucket_logbufs()