| 320 | |
| 321 | #if defined(INET) || defined(INET6) |
| 322 | static u_int |
| 323 | ktls_get_cpu(struct socket *so) |
| 324 | { |
| 325 | struct inpcb *inp; |
| 326 | #ifdef NUMA |
| 327 | struct ktls_domain_info *di; |
| 328 | #endif |
| 329 | u_int cpuid; |
| 330 | |
| 331 | inp = sotoinpcb(so); |
| 332 | #ifdef RSS |
| 333 | cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype); |
| 334 | if (cpuid != NETISR_CPUID_NONE) |
| 335 | return (cpuid); |
| 336 | #endif |
| 337 | /* |
| 338 | * Just use the flowid to shard connections in a repeatable |
| 339 | * fashion. Note that some crypto backends rely on the |
| 340 | * serialization provided by having the same connection use |
| 341 | * the same queue. |
| 342 | */ |
| 343 | #ifdef NUMA |
| 344 | if (ktls_bind_threads > 1 && inp->inp_numa_domain != M_NODOM) { |
| 345 | di = &ktls_domains[inp->inp_numa_domain]; |
| 346 | cpuid = di->cpu[inp->inp_flowid % di->count]; |
| 347 | } else |
| 348 | #endif |
| 349 | cpuid = ktls_cpuid_lookup[inp->inp_flowid % ktls_number_threads]; |
| 350 | return (cpuid); |
| 351 | } |
| 352 | #endif |
| 353 | |
| 354 | static void |
no test coverage detected