* Public inpcb lookup routines, accepting a 4-tuple, and optionally, an mbuf * from which a pre-calculated hash value may be extracted. * * Possibly more of this logic should be in in_pcbgroup.c. */
| 2658 | * Possibly more of this logic should be in in_pcbgroup.c. |
| 2659 | */ |
| 2660 | struct inpcb * |
| 2661 | in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, |
| 2662 | struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) |
| 2663 | { |
| 2664 | #if defined(PCBGROUP) && !defined(RSS) |
| 2665 | struct inpcbgroup *pcbgroup; |
| 2666 | #endif |
| 2667 | |
| 2668 | KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, |
| 2669 | ("%s: invalid lookup flags %d", __func__, lookupflags)); |
| 2670 | KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, |
| 2671 | ("%s: LOCKPCB not set", __func__)); |
| 2672 | |
| 2673 | /* |
| 2674 | * When not using RSS, use connection groups in preference to the |
| 2675 | * reservation table when looking up 4-tuples. When using RSS, just |
| 2676 | * use the reservation table, due to the cost of the Toeplitz hash |
| 2677 | * in software. |
| 2678 | * |
| 2679 | * XXXRW: This policy belongs in the pcbgroup code, as in principle |
| 2680 | * we could be doing RSS with a non-Toeplitz hash that is affordable |
| 2681 | * in software. |
| 2682 | */ |
| 2683 | #if defined(PCBGROUP) && !defined(RSS) |
| 2684 | if (in_pcbgroup_enabled(pcbinfo)) { |
| 2685 | pcbgroup = in_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, |
| 2686 | fport); |
| 2687 | return (in_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, |
| 2688 | laddr, lport, lookupflags, ifp)); |
| 2689 | } |
| 2690 | #endif |
| 2691 | return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, |
| 2692 | lookupflags, ifp, M_NODOM)); |
| 2693 | } |
| 2694 | |
| 2695 | struct inpcb * |
| 2696 | in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr, |
no test coverage detected