Lines Matching refs:sch
138 static void syncache_timeout(struct syncache *sc, struct syncache_head *sch,
153 static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch,
226 #define SCH_LOCK(sch) mtx_lock(&(sch)->sch_mtx) argument
227 #define SCH_UNLOCK(sch) mtx_unlock(&(sch)->sch_mtx) argument
228 #define SCH_LOCK_ASSERT(sch) mtx_assert(&(sch)->sch_mtx, MA_OWNED) argument
322 struct syncache_head *sch; in syncache_destroy() local
342 sch = &V_tcp_syncache.hashbase[i]; in syncache_destroy()
343 callout_drain(&sch->sch_timer); in syncache_destroy()
345 SCH_LOCK(sch); in syncache_destroy()
346 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) in syncache_destroy()
347 syncache_drop(sc, sch); in syncache_destroy()
348 SCH_UNLOCK(sch); in syncache_destroy()
349 KASSERT(TAILQ_EMPTY(&sch->sch_bucket), in syncache_destroy()
351 KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0", in syncache_destroy()
352 __func__, sch->sch_length)); in syncache_destroy()
353 mtx_destroy(&sch->sch_mtx); in syncache_destroy()
371 syncache_insert(struct syncache *sc, struct syncache_head *sch) in syncache_insert() argument
375 SCH_LOCK(sch); in syncache_insert()
381 if (sch->sch_length >= V_tcp_syncache.bucket_limit) { in syncache_insert()
382 KASSERT(!TAILQ_EMPTY(&sch->sch_bucket), in syncache_insert()
385 sc2 = TAILQ_LAST(&sch->sch_bucket, sch_head); in syncache_insert()
386 sch->sch_last_overflow = time_uptime; in syncache_insert()
387 syncache_drop(sc2, sch); in syncache_insert()
391 TAILQ_INSERT_HEAD(&sch->sch_bucket, sc, sc_hash); in syncache_insert()
392 sch->sch_length++; in syncache_insert()
403 if (sch->sch_length == 1) in syncache_insert()
404 sch->sch_nextc = ticks + INT_MAX; in syncache_insert()
405 syncache_timeout(sc, sch, 1); in syncache_insert()
407 SCH_UNLOCK(sch); in syncache_insert()
418 syncache_drop(struct syncache *sc, struct syncache_head *sch) in syncache_drop() argument
421 SCH_LOCK_ASSERT(sch); in syncache_drop()
424 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_drop()
425 sch->sch_length--; in syncache_drop()
442 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) in syncache_timeout() argument
454 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { in syncache_timeout()
455 sch->sch_nextc = sc->sc_rxttime; in syncache_timeout()
457 callout_reset(&sch->sch_timer, sch->sch_nextc - ticks, in syncache_timeout()
458 syncache_timer, (void *)sch); in syncache_timeout()
470 struct syncache_head *sch = (struct syncache_head *)xsch; in syncache_timer() local
477 CURVNET_SET(sch->sch_sc->vnet); in syncache_timer()
480 SCH_LOCK_ASSERT(sch); in syncache_timer()
486 sch->sch_nextc = tick + INT_MAX; in syncache_timer()
496 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) { in syncache_timer()
498 syncache_drop(sc, sch); in syncache_timer()
510 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) in syncache_timer()
511 sch->sch_nextc = sc->sc_rxttime; in syncache_timer()
524 syncache_drop(sc, sch); in syncache_timer()
539 syncache_timeout(sc, sch, 0); in syncache_timer()
541 if (!TAILQ_EMPTY(&(sch)->sch_bucket)) in syncache_timer()
542 callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick, in syncache_timer()
543 syncache_timer, (void *)(sch)); in syncache_timer()
589 struct syncache_head *sch; in syncache_lookup() local
591 *schp = sch = syncache_hashbucket(inc); in syncache_lookup()
592 SCH_LOCK(sch); in syncache_lookup()
595 TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) in syncache_lookup()
614 struct syncache_head *sch; in syncache_chkrst() local
619 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_chkrst()
620 SCH_LOCK_ASSERT(sch); in syncache_chkrst()
692 syncache_drop(sc, sch); in syncache_chkrst()
723 SCH_UNLOCK(sch); in syncache_chkrst()
730 struct syncache_head *sch; in syncache_badack() local
734 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_badack()
735 SCH_LOCK_ASSERT(sch); in syncache_badack()
737 syncache_drop(sc, sch); in syncache_badack()
740 SCH_UNLOCK(sch); in syncache_badack()
747 struct syncache_head *sch; in syncache_unreach() local
751 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_unreach()
752 SCH_LOCK_ASSERT(sch); in syncache_unreach()
776 syncache_drop(sc, sch); in syncache_unreach()
779 SCH_UNLOCK(sch); in syncache_unreach()
1090 struct syncache_head *sch; in syncache_expand() local
1101 sch = syncache_hashbucket(inc); in syncache_expand()
1104 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_expand()
1106 SCH_LOCK_ASSERT(sch); in syncache_expand()
1115 syncookie_cmp(inc, sch, sc, th, to, *lsop, port); in syncache_expand()
1132 SCH_UNLOCK(sch); in syncache_expand()
1140 sch->sch_last_overflow < time_uptime - SYNCOOKIE_LIFETIME) { in syncache_expand()
1141 SCH_UNLOCK(sch); in syncache_expand()
1149 sc = syncookie_lookup(inc, sch, &scs, th, to, *lsop, port); in syncache_expand()
1151 SCH_UNLOCK(sch); in syncache_expand()
1177 SCH_UNLOCK(sch); in syncache_expand()
1191 SCH_UNLOCK(sch); in syncache_expand()
1203 SCH_UNLOCK(sch); in syncache_expand()
1225 SCH_UNLOCK(sch); in syncache_expand()
1270 SCH_UNLOCK(sch); in syncache_expand()
1292 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_expand()
1293 sch->sch_length--; in syncache_expand()
1301 SCH_UNLOCK(sch); in syncache_expand()
1402 struct syncache_head *sch; in syncache_add() local
1550 sch = syncache_hashbucket(inc); in syncache_add()
1553 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_add()
1555 SCH_LOCK_ASSERT(sch); in syncache_add()
1602 syncache_timeout(sc, sch, 1); in syncache_add()
1606 SCH_UNLOCK(sch); in syncache_add()
1632 if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL) { in syncache_add()
1633 sch->sch_last_overflow = time_uptime; in syncache_add()
1634 syncache_drop(sc, sch); in syncache_add()
1646 SCH_UNLOCK(sch); in syncache_add()
1750 sc->sc_iss = syncookie_generate(sch, sc); in syncache_add()
1763 SCH_UNLOCK(sch); in syncache_add()
1780 syncache_insert(sc, sch); /* locks and unlocks sch */ in syncache_add()
2241 syncookie_generate(struct syncache_head *sch, struct syncache *sc) in syncookie_generate() argument
2280 (uintptr_t)sch); in syncookie_generate()
2296 syncookie_lookup(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_lookup() argument
2322 hash = syncookie_mac(inc, seq, cookie.cookie, secbits, (uintptr_t)sch); in syncookie_lookup()
2392 syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_cmp() argument
2400 scx = syncookie_lookup(inc, sch, &scs, th, to, lso, port); in syncookie_cmp()
2564 struct syncache_head *sch; in syncache_pcblist() local
2576 sch = &V_tcp_syncache.hashbase[i]; in syncache_pcblist()
2577 SCH_LOCK(sch); in syncache_pcblist()
2578 TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) { in syncache_pcblist()
2590 SCH_UNLOCK(sch); in syncache_pcblist()
2594 SCH_UNLOCK(sch); in syncache_pcblist()