| 2129 | } |
| 2130 | |
| 2131 | static void |
| 2132 | ktls_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 | } |
nothing calls this directly
no test coverage detected