From 42c75627b5d06a17b2ca93dba620af53bdb4f79c Mon Sep 17 00:00:00 2001 From: rwatson Date: Thu, 30 Dec 2004 17:54:53 +0000 Subject: [PATCH] Use a global variable, ipxpcb_lport_cache, to cache the most recently used IPX port number, rather than using the global ipxpcb list head. --- sys/netipx/ipx_input.c | 1 + sys/netipx/ipx_pcb.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index e7036e296978..1d1697d448ae 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -88,6 +88,7 @@ struct sockaddr_ipx ipx_netmask, ipx_hostmask; /* * IPX protocol control block (pcb) lists. */ +u_short ipxpcb_lport_cache; struct ipxpcbhead ipxpcb_list; struct ipxpcbhead ipxrawpcb_list; diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c index 6cb8e50598d7..aa7527a93209 100644 --- a/sys/netipx/ipx_pcb.c +++ b/sys/netipx/ipx_pcb.c @@ -110,11 +110,11 @@ ipx_pcbbind(ipxp, nam, td) noname: if (lport == 0) do { - ipxpcb.ipxp_lport++; - if ((ipxpcb.ipxp_lport < IPXPORT_RESERVED) || - (ipxpcb.ipxp_lport >= IPXPORT_WELLKNOWN)) - ipxpcb.ipxp_lport = IPXPORT_RESERVED; - lport = htons(ipxpcb.ipxp_lport); + ipxpcb_lport_cache++; + if ((ipxpcb_lport_cache < IPXPORT_RESERVED) || + (ipxpcb_lport_cache >= IPXPORT_WELLKNOWN)) + ipxpcb_lport_cache = IPXPORT_RESERVED; + lport = htons(ipxpcb_lport_cache); } while (ipx_pcblookup(&zeroipx_addr, lport, 0)); ipxp->ipxp_lport = lport; return (0);