MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_pcblookup

Function in_pcblookup

freebsd/netinet/in_pcb.c:2660–2693  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

2658 * Possibly more of this logic should be in in_pcbgroup.c.
2659 */
2660struct inpcb *
2661in_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
2695struct inpcb *
2696in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr,

Callers 14

ipfw_chkFunction · 0.85
udp_inputFunction · 0.85
udp_common_ctlinputFunction · 0.85
udp_getcredFunction · 0.85
tcp_inputFunction · 0.85
tcp_getcredFunction · 0.85
tcp6_getcredFunction · 0.85
tcp_ctlinputFunction · 0.85
sysctl_dropFunction · 0.85
sysctl_switch_tlsFunction · 0.85
toe_4tuple_checkFunction · 0.85
siftr_findinpcbFunction · 0.85

Calls 4

in_pcbgroup_enabledFunction · 0.85
in_pcbgroup_bytupleFunction · 0.85
in_pcblookup_groupFunction · 0.85
in_pcblookup_hashFunction · 0.85

Tested by

no test coverage detected