MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_fastopen_ccache_bucket_trim

Function tcp_fastopen_ccache_bucket_trim

freebsd/netinet/tcp_fastopen.c:1112–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112static void
1113tcp_fastopen_ccache_bucket_trim(struct tcp_fastopen_ccache_bucket *ccb,
1114 unsigned int limit)
1115{
1116 struct tcp_fastopen_ccache_entry *cce, *cce_tmp;
1117 unsigned int entries;
1118
1119 CCB_LOCK(ccb);
1120 entries = 0;
1121 TAILQ_FOREACH_SAFE(cce, &ccb->ccb_entries, cce_link, cce_tmp) {
1122 entries++;
1123 if (entries > limit)
1124 tcp_fastopen_ccache_entry_drop(cce, ccb);
1125 }
1126 KASSERT(ccb->ccb_num_entries <= (int)limit,
1127 ("%s: ccb->ccb_num_entries %d exceeds limit %d", __func__,
1128 ccb->ccb_num_entries, limit));
1129 if (limit == 0) {
1130 KASSERT(TAILQ_EMPTY(&ccb->ccb_entries),
1131 ("%s: ccb->ccb_entries not empty", __func__));
1132 ccb->ccb_num_entries = -1; /* disable bucket */
1133 }
1134 CCB_UNLOCK(ccb);
1135}
1136
1137static void
1138tcp_fastopen_ccache_entry_drop(struct tcp_fastopen_ccache_entry *cce,

Calls 1

Tested by

no test coverage detected