| 352 | #endif |
| 353 | |
| 354 | static void |
| 355 | ktls_init(void *dummy __unused) |
| 356 | { |
| 357 | struct thread *td; |
| 358 | struct pcpu *pc; |
| 359 | cpuset_t mask; |
| 360 | int count, domain, error, i; |
| 361 | |
| 362 | ktls_tasks_active = counter_u64_alloc(M_WAITOK); |
| 363 | ktls_cnt_tx_queued = counter_u64_alloc(M_WAITOK); |
| 364 | ktls_cnt_rx_queued = counter_u64_alloc(M_WAITOK); |
| 365 | ktls_offload_total = counter_u64_alloc(M_WAITOK); |
| 366 | ktls_offload_enable_calls = counter_u64_alloc(M_WAITOK); |
| 367 | ktls_offload_active = counter_u64_alloc(M_WAITOK); |
| 368 | ktls_offload_corrupted_records = counter_u64_alloc(M_WAITOK); |
| 369 | ktls_offload_failed_crypto = counter_u64_alloc(M_WAITOK); |
| 370 | ktls_switch_to_ifnet = counter_u64_alloc(M_WAITOK); |
| 371 | ktls_switch_to_sw = counter_u64_alloc(M_WAITOK); |
| 372 | ktls_switch_failed = counter_u64_alloc(M_WAITOK); |
| 373 | ktls_sw_cbc = counter_u64_alloc(M_WAITOK); |
| 374 | ktls_sw_gcm = counter_u64_alloc(M_WAITOK); |
| 375 | ktls_ifnet_cbc = counter_u64_alloc(M_WAITOK); |
| 376 | ktls_ifnet_gcm = counter_u64_alloc(M_WAITOK); |
| 377 | ktls_ifnet_reset = counter_u64_alloc(M_WAITOK); |
| 378 | ktls_ifnet_reset_dropped = counter_u64_alloc(M_WAITOK); |
| 379 | ktls_ifnet_reset_failed = counter_u64_alloc(M_WAITOK); |
| 380 | #ifdef TCP_OFFLOAD |
| 381 | ktls_toe_cbc = counter_u64_alloc(M_WAITOK); |
| 382 | ktls_toe_gcm = counter_u64_alloc(M_WAITOK); |
| 383 | #endif |
| 384 | |
| 385 | rm_init(&ktls_backends_lock, "ktls backends"); |
| 386 | LIST_INIT(&ktls_backends); |
| 387 | |
| 388 | ktls_wq = malloc(sizeof(*ktls_wq) * (mp_maxid + 1), M_KTLS, |
| 389 | M_WAITOK | M_ZERO); |
| 390 | |
| 391 | ktls_session_zone = uma_zcreate("ktls_session", |
| 392 | sizeof(struct ktls_session), |
| 393 | NULL, NULL, NULL, NULL, |
| 394 | UMA_ALIGN_CACHE, 0); |
| 395 | |
| 396 | /* |
| 397 | * Initialize the workqueues to run the TLS work. We create a |
| 398 | * work queue for each CPU. |
| 399 | */ |
| 400 | CPU_FOREACH(i) { |
| 401 | STAILQ_INIT(&ktls_wq[i].m_head); |
| 402 | STAILQ_INIT(&ktls_wq[i].so_head); |
| 403 | mtx_init(&ktls_wq[i].mtx, "ktls work queue", NULL, MTX_DEF); |
| 404 | error = kproc_kthread_add(ktls_work_thread, &ktls_wq[i], |
| 405 | &ktls_proc, &td, 0, 0, "KTLS", "thr_%d", i); |
| 406 | if (error) |
| 407 | panic("Can't add KTLS thread %d error %d", i, error); |
| 408 | |
| 409 | /* |
| 410 | * Bind threads to cores. If ktls_bind_threads is > |
| 411 | * 1, then we bind to the NUMA domain. |
nothing calls this directly
no test coverage detected