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

Function ktls_work_thread

freebsd/kern/uipc_ktls.c:2131–2177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129}
2130
2131static void
2132ktls_work_thread(void *ctx)
2133{
2134 struct ktls_wq *wq = ctx;
2135 struct mbuf *m, *n;
2136 struct socket *so, *son;
2137 STAILQ_HEAD(, mbuf) local_m_head;
2138 STAILQ_HEAD(, socket) local_so_head;
2139
2140 if (ktls_bind_threads > 1) {
2141 curthread->td_domain.dr_policy =
2142 DOMAINSET_PREF(PCPU_GET(domain));
2143 }
2144#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__)
2145 fpu_kern_thread(0);
2146#endif
2147 for (;;) {
2148 mtx_lock(&wq->mtx);
2149 while (STAILQ_EMPTY(&wq->m_head) &&
2150 STAILQ_EMPTY(&wq->so_head)) {
2151 wq->running = false;
2152 mtx_sleep(wq, &wq->mtx, 0, "-", 0);
2153 wq->running = true;
2154 }
2155
2156 STAILQ_INIT(&local_m_head);
2157 STAILQ_CONCAT(&local_m_head, &wq->m_head);
2158 STAILQ_INIT(&local_so_head);
2159 STAILQ_CONCAT(&local_so_head, &wq->so_head);
2160 mtx_unlock(&wq->mtx);
2161
2162 STAILQ_FOREACH_SAFE(m, &local_m_head, m_epg_stailq, n) {
2163 if (m->m_epg_flags & EPG_FLAG_2FREE) {
2164 ktls_free(m->m_epg_tls);
2165 uma_zfree(zone_mbuf, m);
2166 } else {
2167 ktls_encrypt(m);
2168 counter_u64_add(ktls_cnt_tx_queued, -1);
2169 }
2170 }
2171
2172 STAILQ_FOREACH_SAFE(so, &local_so_head, so_ktls_rx_list, son) {
2173 ktls_decrypt(so);
2174 counter_u64_add(ktls_cnt_rx_queued, -1);
2175 }
2176 }
2177}

Callers

nothing calls this directly

Calls 8

ktls_freeFunction · 0.85
ktls_encryptFunction · 0.85
ktls_decryptFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
fpu_kern_threadFunction · 0.50
uma_zfreeFunction · 0.50
counter_u64_addFunction · 0.50

Tested by

no test coverage detected