Lines Matching refs:hsh

322 hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r,  in hash_insert()  argument
327 mtx_assert(&hsh->mtx, MA_OWNED); in hash_insert()
391 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in hash_insert()
479 struct flow_hash_entry *hsh; in ng_netflow_cache_init() local
499 for (i = 0, hsh = priv->hash; i < NBUCKETS; i++, hsh++) { in ng_netflow_cache_init()
500 mtx_init(&hsh->mtx, "hash mutex", NULL, MTX_DEF); in ng_netflow_cache_init()
501 TAILQ_INIT(&hsh->head); in ng_netflow_cache_init()
510 for (i = 0, hsh = priv->hash6; i < NBUCKETS; i++, hsh++) { in ng_netflow_cache_init()
511 mtx_init(&hsh->mtx, "hash mutex", NULL, MTX_DEF); in ng_netflow_cache_init()
512 TAILQ_INIT(&hsh->head); in ng_netflow_cache_init()
574 struct flow_hash_entry *hsh; in ng_netflow_cache_flush() local
586 for (hsh = priv->hash, i = 0; i < NBUCKETS; hsh++, i++) in ng_netflow_cache_flush()
587 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
588 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
593 for (hsh = priv->hash6, i = 0; i < NBUCKETS; hsh++, i++) in ng_netflow_cache_flush()
594 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
595 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
603 for (i = 0, hsh = priv->hash; i < NBUCKETS; i++, hsh++) in ng_netflow_cache_flush()
604 mtx_destroy(&hsh->mtx); in ng_netflow_cache_flush()
612 for (i = 0, hsh = priv->hash6; i < NBUCKETS; i++, hsh++) in ng_netflow_cache_flush()
613 mtx_destroy(&hsh->mtx); in ng_netflow_cache_flush()
658 struct flow_hash_entry *hsh; in ng_netflow_flow_add() local
717 hsh = &priv->hash[ip_hash(&r)]; in ng_netflow_flow_add()
719 mtx_lock(&hsh->mtx); in ng_netflow_flow_add()
727 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow_add()
731 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
753 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
763 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow_add()
764 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
765 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
769 error = hash_insert(priv, hsh, &r, plen, flags, tcp_flags); in ng_netflow_flow_add()
771 mtx_unlock(&hsh->mtx); in ng_netflow_flow_add()
786 struct flow_hash_entry *hsh; in ng_netflow_flow6_add() local
836 hsh = &priv->hash6[ip6_hash(&r)]; in ng_netflow_flow6_add()
838 mtx_lock(&hsh->mtx); in ng_netflow_flow6_add()
846 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow6_add()
853 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
876 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
886 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow6_add()
887 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
888 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
892 error = hash6_insert(priv, hsh, &r, plen, flags, tcp_flags); in ng_netflow_flow6_add()
894 mtx_unlock(&hsh->mtx); in ng_netflow_flow6_add()
909 struct flow_hash_entry *hsh; in ng_netflow_flow_show() local
924 hsh = priv->hash6 + i; in ng_netflow_flow_show()
930 hsh = priv->hash + i; in ng_netflow_flow_show()
947 for (; i < NBUCKETS; hsh++, i++) { in ng_netflow_flow_show()
950 if (mtx_trylock(&hsh->mtx) == 0) { in ng_netflow_flow_show()
962 TAILQ_FOREACH(fle, &hsh->head, fle_hash) { in ng_netflow_flow_show()
963 if (hsh->mtx.mtx_lock & MTX_CONTESTED) { in ng_netflow_flow_show()
966 mtx_unlock(&hsh->mtx); in ng_netflow_flow_show()
998 mtx_unlock(&hsh->mtx); in ng_netflow_flow_show()
1002 mtx_unlock(&hsh->mtx); in ng_netflow_flow_show()
1094 struct flow_hash_entry *hsh; in ng_netflow_expire() local
1102 for (hsh = priv->hash, i = 0; i < NBUCKETS; hsh++, i++) { in ng_netflow_expire()
1106 if (mtx_trylock(&hsh->mtx) == 0) in ng_netflow_expire()
1109 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1114 if (hsh->mtx.mtx_lock & MTX_CONTESTED) in ng_netflow_expire()
1126 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1133 mtx_unlock(&hsh->mtx); in ng_netflow_expire()
1138 for (hsh = priv->hash6, i = 0; i < NBUCKETS; hsh++, i++) { in ng_netflow_expire()
1144 if (mtx_trylock(&hsh->mtx) == 0) in ng_netflow_expire()
1147 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1153 if (hsh->mtx.mtx_lock & MTX_CONTESTED) in ng_netflow_expire()
1165 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1172 mtx_unlock(&hsh->mtx); in ng_netflow_expire()