* Similar to rss_m2cpuid, but designed to be used by the IP NETISR * on incoming frames. * * If an existing RSS hash exists and it matches what the configured * hashing is, then use it. * * If there's an existing RSS hash but the desired hash is different, * or if there's no useful RSS hash, then calculate it via * the software path. * * XXX TODO: definitely want statistics here! */
| 374 | * XXX TODO: definitely want statistics here! |
| 375 | */ |
| 376 | struct mbuf * |
| 377 | rss_soft_m2cpuid_v4(struct mbuf *m, uintptr_t source, u_int *cpuid) |
| 378 | { |
| 379 | uint32_t hash_val, hash_type; |
| 380 | int ret; |
| 381 | |
| 382 | M_ASSERTPKTHDR(m); |
| 383 | |
| 384 | ret = rss_mbuf_software_hash_v4(m, RSS_HASH_PKT_INGRESS, |
| 385 | &hash_val, &hash_type); |
| 386 | if (ret > 0) { |
| 387 | /* mbuf has a valid hash already; don't need to modify it */ |
| 388 | *cpuid = rss_hash2cpuid(m->m_pkthdr.flowid, M_HASHTYPE_GET(m)); |
| 389 | } else if (ret == 0) { |
| 390 | /* hash was done; update */ |
| 391 | m->m_pkthdr.flowid = hash_val; |
| 392 | M_HASHTYPE_SET(m, hash_type); |
| 393 | *cpuid = rss_hash2cpuid(m->m_pkthdr.flowid, M_HASHTYPE_GET(m)); |
| 394 | } else { /* ret < 0 */ |
| 395 | /* no hash was done */ |
| 396 | *cpuid = NETISR_CPUID_NONE; |
| 397 | } |
| 398 | return (m); |
| 399 | } |
nothing calls this directly
no test coverage detected