mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 23:28:57 +00:00
Changed in_pcblookuphash() to not automatically call in_pcblookup() if
the lookup fails. Updated callers to deal with this. Call in_pcblookuphash instead of in_pcblookup() in in_pcbconnect; this improves performance of UDP output by about 17% in the standard case.
This commit is contained in:
parent
fd409c37b9
commit
0d7b7d3ea7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8235
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
|
||||
* $Id: in_pcb.c,v 1.9 1995/04/09 01:29:18 davidg Exp $
|
||||
* $Id: in_pcb.c,v 1.10 1995/04/10 08:52:45 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -303,12 +303,9 @@ in_pcbconnect(inp, nam)
|
||||
if (error = in_pcbladdr(inp, nam, &ifaddr))
|
||||
return(error);
|
||||
|
||||
if (in_pcblookup(inp->inp_pcbinfo->listhead,
|
||||
sin->sin_addr,
|
||||
sin->sin_port,
|
||||
if (in_pcblookuphash(inp->inp_pcbinfo, sin->sin_addr, sin->sin_port,
|
||||
inp->inp_laddr.s_addr ? inp->inp_laddr : ifaddr->sin_addr,
|
||||
inp->inp_lport,
|
||||
0))
|
||||
inp->inp_lport) != NULL)
|
||||
return (EADDRINUSE);
|
||||
if (inp->inp_laddr.s_addr == INADDR_ANY) {
|
||||
if (inp->inp_lport == 0)
|
||||
@ -588,17 +585,10 @@ in_pcblookuphash(pcbinfo, faddr, fport_arg, laddr, lport_arg)
|
||||
LIST_REMOVE(inp, inp_hash);
|
||||
LIST_INSERT_HEAD(head, inp, inp_hash);
|
||||
}
|
||||
splx(s);
|
||||
return (inp);
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
|
||||
/*
|
||||
* Didn't find an exact match, so try again looking for a matching
|
||||
* wildcard PCB.
|
||||
*/
|
||||
return (in_pcblookup(pcbinfo->listhead, faddr, fport_arg, laddr,
|
||||
lport_arg, INPLOOKUP_WILDCARD));
|
||||
return (inp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94
|
||||
* $Id: tcp_input.c,v 1.20 1995/04/10 17:16:10 davidg Exp $
|
||||
* $Id: tcp_input.c,v 1.21 1995/04/10 17:37:46 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef TUBA_INCLUDE
|
||||
@ -337,7 +337,18 @@ tcp_input(m, iphlen)
|
||||
* Locate pcb for segment.
|
||||
*/
|
||||
findpcb:
|
||||
inp = in_pcblookuphash(&tcbinfo, ti->ti_src, ti->ti_sport, ti->ti_dst, ti->ti_dport);
|
||||
/*
|
||||
* First look for an exact match.
|
||||
*/
|
||||
inp = in_pcblookuphash(&tcbinfo, ti->ti_src, ti->ti_sport,
|
||||
ti->ti_dst, ti->ti_dport);
|
||||
/*
|
||||
* ...and if that fails, do a wildcard search.
|
||||
*/
|
||||
if (inp == NULL) {
|
||||
inp = in_pcblookup(&tcb, ti->ti_src, ti->ti_sport,
|
||||
ti->ti_dst, ti->ti_dport, INPLOOKUP_WILDCARD);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the state is CLOSED (i.e., TCB does not exist) then
|
||||
@ -345,7 +356,7 @@ findpcb:
|
||||
* If the TCB exists but is in CLOSED state, it is embryonic,
|
||||
* but should either do a listen or a connect soon.
|
||||
*/
|
||||
if (inp == 0)
|
||||
if (inp == NULL)
|
||||
goto dropwithreset;
|
||||
tp = intotcpcb(inp);
|
||||
if (tp == 0)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94
|
||||
* $Id: tcp_input.c,v 1.20 1995/04/10 17:16:10 davidg Exp $
|
||||
* $Id: tcp_input.c,v 1.21 1995/04/10 17:37:46 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef TUBA_INCLUDE
|
||||
@ -337,7 +337,18 @@ tcp_input(m, iphlen)
|
||||
* Locate pcb for segment.
|
||||
*/
|
||||
findpcb:
|
||||
inp = in_pcblookuphash(&tcbinfo, ti->ti_src, ti->ti_sport, ti->ti_dst, ti->ti_dport);
|
||||
/*
|
||||
* First look for an exact match.
|
||||
*/
|
||||
inp = in_pcblookuphash(&tcbinfo, ti->ti_src, ti->ti_sport,
|
||||
ti->ti_dst, ti->ti_dport);
|
||||
/*
|
||||
* ...and if that fails, do a wildcard search.
|
||||
*/
|
||||
if (inp == NULL) {
|
||||
inp = in_pcblookup(&tcb, ti->ti_src, ti->ti_sport,
|
||||
ti->ti_dst, ti->ti_dport, INPLOOKUP_WILDCARD);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the state is CLOSED (i.e., TCB does not exist) then
|
||||
@ -345,7 +356,7 @@ findpcb:
|
||||
* If the TCB exists but is in CLOSED state, it is embryonic,
|
||||
* but should either do a listen or a connect soon.
|
||||
*/
|
||||
if (inp == 0)
|
||||
if (inp == NULL)
|
||||
goto dropwithreset;
|
||||
tp = intotcpcb(inp);
|
||||
if (tp == 0)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)udp_usrreq.c 8.4 (Berkeley) 1/21/94
|
||||
* $Id: udp_usrreq.c,v 1.8 1995/03/16 18:15:09 bde Exp $
|
||||
* $Id: udp_usrreq.c,v 1.9 1995/04/09 01:29:30 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -256,10 +256,17 @@ udp_input(m, iphlen)
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Locate pcb for datagram.
|
||||
* Locate pcb for datagram. First look for an exact match.
|
||||
*/
|
||||
inp = in_pcblookuphash(&udbinfo, ip->ip_src, uh->uh_sport,
|
||||
ip->ip_dst, uh->uh_dport);
|
||||
/*
|
||||
* ...and if that fails, do a wildcard search.
|
||||
*/
|
||||
if (inp == NULL) {
|
||||
inp = in_pcblookup(&udb, ip->ip_src, uh->uh_sport, ip->ip_dst,
|
||||
uh->uh_dport, INPLOOKUP_WILDCARD);
|
||||
}
|
||||
if (inp == NULL) {
|
||||
udpstat.udps_noport++;
|
||||
if (m->m_flags & (M_BCAST | M_MCAST)) {
|
||||
|
Loading…
Reference in New Issue
Block a user