Lines Matching refs:sch
135 static void syncache_timeout(struct syncache *sc, struct syncache_head *sch,
150 static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch,
228 #define SCH_LOCK(sch) mtx_lock(&(sch)->sch_mtx) argument
229 #define SCH_UNLOCK(sch) mtx_unlock(&(sch)->sch_mtx) argument
230 #define SCH_LOCK_ASSERT(sch) mtx_assert(&(sch)->sch_mtx, MA_OWNED) argument
324 struct syncache_head *sch; in syncache_destroy() local
344 sch = &V_tcp_syncache.hashbase[i]; in syncache_destroy()
345 callout_drain(&sch->sch_timer); in syncache_destroy()
347 SCH_LOCK(sch); in syncache_destroy()
348 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) in syncache_destroy()
349 syncache_drop(sc, sch); in syncache_destroy()
350 SCH_UNLOCK(sch); in syncache_destroy()
351 KASSERT(TAILQ_EMPTY(&sch->sch_bucket), in syncache_destroy()
353 KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0", in syncache_destroy()
354 __func__, sch->sch_length)); in syncache_destroy()
355 mtx_destroy(&sch->sch_mtx); in syncache_destroy()
373 syncache_insert(struct syncache *sc, struct syncache_head *sch) in syncache_insert() argument
377 SCH_LOCK(sch); in syncache_insert()
383 if (sch->sch_length >= V_tcp_syncache.bucket_limit) { in syncache_insert()
384 KASSERT(!TAILQ_EMPTY(&sch->sch_bucket), in syncache_insert()
387 sc2 = TAILQ_LAST(&sch->sch_bucket, sch_head); in syncache_insert()
388 sch->sch_last_overflow = time_uptime; in syncache_insert()
389 syncache_drop(sc2, sch); in syncache_insert()
393 TAILQ_INSERT_HEAD(&sch->sch_bucket, sc, sc_hash); in syncache_insert()
394 sch->sch_length++; in syncache_insert()
405 if (sch->sch_length == 1) in syncache_insert()
406 sch->sch_nextc = ticks + INT_MAX; in syncache_insert()
407 syncache_timeout(sc, sch, 1); in syncache_insert()
409 SCH_UNLOCK(sch); in syncache_insert()
420 syncache_drop(struct syncache *sc, struct syncache_head *sch) in syncache_drop() argument
423 SCH_LOCK_ASSERT(sch); in syncache_drop()
426 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_drop()
427 sch->sch_length--; in syncache_drop()
444 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) in syncache_timeout() argument
456 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { in syncache_timeout()
457 sch->sch_nextc = sc->sc_rxttime; in syncache_timeout()
459 callout_reset(&sch->sch_timer, sch->sch_nextc - ticks, in syncache_timeout()
460 syncache_timer, (void *)sch); in syncache_timeout()
472 struct syncache_head *sch = (struct syncache_head *)xsch; in syncache_timer() local
479 CURVNET_SET(sch->sch_sc->vnet); in syncache_timer()
482 SCH_LOCK_ASSERT(sch); in syncache_timer()
488 sch->sch_nextc = tick + INT_MAX; in syncache_timer()
498 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) { in syncache_timer()
500 syncache_drop(sc, sch); in syncache_timer()
512 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) in syncache_timer()
513 sch->sch_nextc = sc->sc_rxttime; in syncache_timer()
526 syncache_drop(sc, sch); in syncache_timer()
539 syncache_timeout(sc, sch, 0); in syncache_timer()
544 syncache_drop(sc, sch); in syncache_timer()
549 if (!TAILQ_EMPTY(&(sch)->sch_bucket)) in syncache_timer()
550 callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick, in syncache_timer()
551 syncache_timer, (void *)(sch)); in syncache_timer()
597 struct syncache_head *sch; in syncache_lookup() local
599 *schp = sch = syncache_hashbucket(inc); in syncache_lookup()
600 SCH_LOCK(sch); in syncache_lookup()
603 TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) in syncache_lookup()
622 struct syncache_head *sch; in syncache_chkrst() local
627 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_chkrst()
628 SCH_LOCK_ASSERT(sch); in syncache_chkrst()
688 syncache_drop(sc, sch); in syncache_chkrst()
709 syncache_drop(sc, sch); in syncache_chkrst()
725 SCH_UNLOCK(sch); in syncache_chkrst()
732 struct syncache_head *sch; in syncache_badack() local
736 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_badack()
737 SCH_LOCK_ASSERT(sch); in syncache_badack()
739 syncache_drop(sc, sch); in syncache_badack()
742 SCH_UNLOCK(sch); in syncache_badack()
749 struct syncache_head *sch; in syncache_unreach() local
753 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_unreach()
754 SCH_LOCK_ASSERT(sch); in syncache_unreach()
778 syncache_drop(sc, sch); in syncache_unreach()
781 SCH_UNLOCK(sch); in syncache_unreach()
1066 struct syncache_head *sch; in syncache_expand() local
1077 sch = syncache_hashbucket(inc); in syncache_expand()
1080 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_expand()
1082 SCH_LOCK_ASSERT(sch); in syncache_expand()
1091 syncookie_cmp(inc, sch, sc, th, to, *lsop, port); in syncache_expand()
1108 SCH_UNLOCK(sch); in syncache_expand()
1116 sch->sch_last_overflow < time_uptime - SYNCOOKIE_LIFETIME) { in syncache_expand()
1117 SCH_UNLOCK(sch); in syncache_expand()
1125 sc = syncookie_lookup(inc, sch, &scs, th, to, *lsop, port); in syncache_expand()
1127 SCH_UNLOCK(sch); in syncache_expand()
1154 SCH_UNLOCK(sch); in syncache_expand()
1168 SCH_UNLOCK(sch); in syncache_expand()
1180 SCH_UNLOCK(sch); in syncache_expand()
1202 SCH_UNLOCK(sch); in syncache_expand()
1247 SCH_UNLOCK(sch); in syncache_expand()
1258 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_expand()
1259 sch->sch_length--; in syncache_expand()
1267 SCH_UNLOCK(sch); in syncache_expand()
1376 struct syncache_head *sch; in syncache_add() local
1516 sch = syncache_hashbucket(inc); in syncache_add()
1519 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_add()
1521 SCH_LOCK_ASSERT(sch); in syncache_add()
1569 syncache_timeout(sc, sch, 1); in syncache_add()
1573 syncache_drop(sc, sch); in syncache_add()
1576 SCH_UNLOCK(sch); in syncache_add()
1597 sc = TAILQ_LAST(&sch->sch_bucket, sch_head); in syncache_add()
1599 sch->sch_last_overflow = time_uptime; in syncache_add()
1600 syncache_drop(sc, sch); in syncache_add()
1612 SCH_UNLOCK(sch); in syncache_add()
1727 sc->sc_iss = syncookie_generate(sch, sc); in syncache_add()
1740 SCH_UNLOCK(sch); in syncache_add()
1754 syncache_insert(sc, sch); /* locks and unlocks sch */ in syncache_add()
2210 syncookie_generate(struct syncache_head *sch, struct syncache *sc) in syncookie_generate() argument
2249 (uintptr_t)sch); in syncookie_generate()
2265 syncookie_lookup(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_lookup() argument
2291 hash = syncookie_mac(inc, seq, cookie.cookie, secbits, (uintptr_t)sch); in syncookie_lookup()
2361 syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_cmp() argument
2369 scx = syncookie_lookup(inc, sch, &scs, th, to, lso, port); in syncookie_cmp()
2533 struct syncache_head *sch; in syncache_pcblist() local
2545 sch = &V_tcp_syncache.hashbase[i]; in syncache_pcblist()
2546 SCH_LOCK(sch); in syncache_pcblist()
2547 TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) { in syncache_pcblist()
2560 SCH_UNLOCK(sch); in syncache_pcblist()
2564 SCH_UNLOCK(sch); in syncache_pcblist()