Lines Matching refs:sch

127 static void	 syncache_timeout(struct syncache *sc, struct syncache_head *sch,
142 static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch,
220 #define SCH_LOCK(sch) mtx_lock(&(sch)->sch_mtx) argument
221 #define SCH_UNLOCK(sch) mtx_unlock(&(sch)->sch_mtx) argument
222 #define SCH_LOCK_ASSERT(sch) mtx_assert(&(sch)->sch_mtx, MA_OWNED) argument
316 struct syncache_head *sch; in syncache_destroy() local
336 sch = &V_tcp_syncache.hashbase[i]; in syncache_destroy()
337 callout_drain(&sch->sch_timer); in syncache_destroy()
339 SCH_LOCK(sch); in syncache_destroy()
340 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) in syncache_destroy()
341 syncache_drop(sc, sch); in syncache_destroy()
342 SCH_UNLOCK(sch); in syncache_destroy()
343 KASSERT(TAILQ_EMPTY(&sch->sch_bucket), in syncache_destroy()
345 KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0", in syncache_destroy()
346 __func__, sch->sch_length)); in syncache_destroy()
347 mtx_destroy(&sch->sch_mtx); in syncache_destroy()
365 syncache_insert(struct syncache *sc, struct syncache_head *sch) in syncache_insert() argument
369 SCH_LOCK(sch); in syncache_insert()
375 if (sch->sch_length >= V_tcp_syncache.bucket_limit) { in syncache_insert()
376 KASSERT(!TAILQ_EMPTY(&sch->sch_bucket), in syncache_insert()
379 sc2 = TAILQ_LAST(&sch->sch_bucket, sch_head); in syncache_insert()
380 sch->sch_last_overflow = time_uptime; in syncache_insert()
381 syncache_drop(sc2, sch); in syncache_insert()
385 TAILQ_INSERT_HEAD(&sch->sch_bucket, sc, sc_hash); in syncache_insert()
386 sch->sch_length++; in syncache_insert()
397 if (sch->sch_length == 1) in syncache_insert()
398 sch->sch_nextc = ticks + INT_MAX; in syncache_insert()
399 syncache_timeout(sc, sch, 1); in syncache_insert()
401 SCH_UNLOCK(sch); in syncache_insert()
412 syncache_drop(struct syncache *sc, struct syncache_head *sch) in syncache_drop() argument
415 SCH_LOCK_ASSERT(sch); in syncache_drop()
418 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_drop()
419 sch->sch_length--; in syncache_drop()
436 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) in syncache_timeout() argument
448 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { in syncache_timeout()
449 sch->sch_nextc = sc->sc_rxttime; in syncache_timeout()
451 callout_reset(&sch->sch_timer, sch->sch_nextc - ticks, in syncache_timeout()
452 syncache_timer, (void *)sch); in syncache_timeout()
464 struct syncache_head *sch = (struct syncache_head *)xsch; in syncache_timer() local
471 CURVNET_SET(sch->sch_sc->vnet); in syncache_timer()
474 SCH_LOCK_ASSERT(sch); in syncache_timer()
480 sch->sch_nextc = tick + INT_MAX; in syncache_timer()
490 TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) { in syncache_timer()
492 syncache_drop(sc, sch); in syncache_timer()
504 if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) in syncache_timer()
505 sch->sch_nextc = sc->sc_rxttime; in syncache_timer()
518 syncache_drop(sc, sch); in syncache_timer()
531 syncache_timeout(sc, sch, 0); in syncache_timer()
536 syncache_drop(sc, sch); 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()
680 syncache_drop(sc, sch); in syncache_chkrst()
701 syncache_drop(sc, sch); in syncache_chkrst()
717 SCH_UNLOCK(sch); in syncache_chkrst()
724 struct syncache_head *sch; in syncache_badack() local
728 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_badack()
729 SCH_LOCK_ASSERT(sch); in syncache_badack()
731 syncache_drop(sc, sch); in syncache_badack()
734 SCH_UNLOCK(sch); in syncache_badack()
741 struct syncache_head *sch; in syncache_unreach() local
745 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_unreach()
746 SCH_LOCK_ASSERT(sch); in syncache_unreach()
770 syncache_drop(sc, sch); in syncache_unreach()
773 SCH_UNLOCK(sch); in syncache_unreach()
1056 struct syncache_head *sch; in syncache_expand() local
1067 sch = syncache_hashbucket(inc); in syncache_expand()
1070 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_expand()
1072 SCH_LOCK_ASSERT(sch); in syncache_expand()
1081 syncookie_cmp(inc, sch, sc, th, to, *lsop, port); in syncache_expand()
1098 SCH_UNLOCK(sch); in syncache_expand()
1106 sch->sch_last_overflow < time_uptime - SYNCOOKIE_LIFETIME) { in syncache_expand()
1107 SCH_UNLOCK(sch); in syncache_expand()
1115 sc = syncookie_lookup(inc, sch, &scs, th, to, *lsop, port); in syncache_expand()
1117 SCH_UNLOCK(sch); in syncache_expand()
1144 SCH_UNLOCK(sch); in syncache_expand()
1158 SCH_UNLOCK(sch); in syncache_expand()
1170 SCH_UNLOCK(sch); in syncache_expand()
1192 SCH_UNLOCK(sch); in syncache_expand()
1237 SCH_UNLOCK(sch); in syncache_expand()
1248 TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); in syncache_expand()
1249 sch->sch_length--; in syncache_expand()
1257 SCH_UNLOCK(sch); in syncache_expand()
1366 struct syncache_head *sch; in syncache_add() local
1506 sch = syncache_hashbucket(inc); in syncache_add()
1509 sc = syncache_lookup(inc, &sch); /* returns locked sch */ in syncache_add()
1511 SCH_LOCK_ASSERT(sch); in syncache_add()
1559 syncache_timeout(sc, sch, 1); in syncache_add()
1563 syncache_drop(sc, sch); in syncache_add()
1566 SCH_UNLOCK(sch); in syncache_add()
1587 sc = TAILQ_LAST(&sch->sch_bucket, sch_head); in syncache_add()
1589 sch->sch_last_overflow = time_uptime; in syncache_add()
1590 syncache_drop(sc, sch); in syncache_add()
1602 SCH_UNLOCK(sch); in syncache_add()
1717 sc->sc_iss = syncookie_generate(sch, sc); in syncache_add()
1730 SCH_UNLOCK(sch); in syncache_add()
1744 syncache_insert(sc, sch); /* locks and unlocks sch */ in syncache_add()
2200 syncookie_generate(struct syncache_head *sch, struct syncache *sc) in syncookie_generate() argument
2239 (uintptr_t)sch); in syncookie_generate()
2255 syncookie_lookup(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_lookup() argument
2281 hash = syncookie_mac(inc, seq, cookie.cookie, secbits, (uintptr_t)sch); in syncookie_lookup()
2351 syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, in syncookie_cmp() argument
2359 scx = syncookie_lookup(inc, sch, &scs, th, to, lso, port); in syncookie_cmp()
2523 struct syncache_head *sch; in syncache_pcblist() local
2535 sch = &V_tcp_syncache.hashbase[i]; in syncache_pcblist()
2536 SCH_LOCK(sch); in syncache_pcblist()
2537 TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) { in syncache_pcblist()
2550 SCH_UNLOCK(sch); in syncache_pcblist()
2554 SCH_UNLOCK(sch); in syncache_pcblist()