* Caller has to make sure the curvnet is set properly. */
| 687 | * Caller has to make sure the curvnet is set properly. |
| 688 | */ |
| 689 | static void |
| 690 | tcp_hc_purge_internal(int all) |
| 691 | { |
| 692 | struct hc_metrics *hc_entry, *hc_next; |
| 693 | int i; |
| 694 | |
| 695 | for (i = 0; i < V_tcp_hostcache.hashsize; i++) { |
| 696 | THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); |
| 697 | TAILQ_FOREACH_SAFE(hc_entry, |
| 698 | &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { |
| 699 | if (all || hc_entry->rmx_expire <= 0) { |
| 700 | TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket, |
| 701 | hc_entry, rmx_q); |
| 702 | uma_zfree(V_tcp_hostcache.zone, hc_entry); |
| 703 | V_tcp_hostcache.hashbase[i].hch_length--; |
| 704 | V_tcp_hostcache.cache_count--; |
| 705 | } else |
| 706 | hc_entry->rmx_expire -= V_tcp_hostcache.prune; |
| 707 | } |
| 708 | THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | /* |
| 713 | * Expire and purge (old|all) entries in the tcp_hostcache. Runs |
no test coverage detected