Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/in_pcb.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
#include <sys/rmlock.h> | #include <sys/rmlock.h> | ||||
#include <sys/smp.h> | |||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
#include <sys/sockio.h> | #include <sys/sockio.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/refcount.h> | #include <sys/refcount.h> | ||||
#include <sys/jail.h> | #include <sys/jail.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
Show All 13 Lines | |||||
#include <net/rss_config.h> | #include <net/rss_config.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_pcb.h> | #include <netinet/in_pcb.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
#ifdef TCPHPTS | |||||
#include <netinet/tcp_hpts.h> | |||||
#endif | |||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/udp_var.h> | #include <netinet/udp_var.h> | ||||
#endif | #endif | ||||
#ifdef INET | #ifdef INET | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
▲ Show 20 Lines • Show All 1,121 Lines • ▼ Show 20 Lines | if (refcount_release(&inp->inp_refcount) == 0) { | ||||
* this isn't the last reference. | * this isn't the last reference. | ||||
*/ | */ | ||||
if (inp->inp_flags2 & INP_FREED) { | if (inp->inp_flags2 & INP_FREED) { | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
return (1); | return (1); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); | KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); | ||||
#ifdef TCPHPTS | |||||
if (inp->inp_in_hpts || inp->inp_in_input) { | |||||
struct tcp_hpts_entry *hpts; | |||||
/* | |||||
* We should not be on the hpts at | |||||
* this point in any form. we must | |||||
* get the lock to be sure. | |||||
*/ | |||||
hpts = tcp_hpts_lock(inp); | |||||
if (inp->inp_in_hpts) | |||||
panic("Hpts:%p inp:%p at free still on hpts", | |||||
hpts, inp); | |||||
mtx_unlock(&hpts->p_mtx); | |||||
hpts = tcp_input_lock(inp); | |||||
if (inp->inp_in_input) | |||||
panic("Hpts:%p inp:%p at free still on input hpts", | |||||
hpts, inp); | |||||
mtx_unlock(&hpts->p_mtx); | |||||
} | |||||
#endif | |||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
pcbinfo = inp->inp_pcbinfo; | pcbinfo = inp->inp_pcbinfo; | ||||
uma_zfree(pcbinfo->ipi_zone, inp); | uma_zfree(pcbinfo->ipi_zone, inp); | ||||
return (1); | return (1); | ||||
} | } | ||||
int | int | ||||
in_pcbrele_wlocked(struct inpcb *inp) | in_pcbrele_wlocked(struct inpcb *inp) | ||||
Show All 12 Lines | if (refcount_release(&inp->inp_refcount) == 0) { | ||||
if (inp->inp_flags2 & INP_FREED) { | if (inp->inp_flags2 & INP_FREED) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (1); | return (1); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); | KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); | ||||
#ifdef TCPHPTS | |||||
if (inp->inp_in_hpts || inp->inp_in_input) { | |||||
struct tcp_hpts_entry *hpts; | |||||
/* | |||||
* We should not be on the hpts at | |||||
* this point in any form. we must | |||||
* get the lock to be sure. | |||||
*/ | |||||
hpts = tcp_hpts_lock(inp); | |||||
if (inp->inp_in_hpts) | |||||
panic("Hpts:%p inp:%p at free still on hpts", | |||||
hpts, inp); | |||||
mtx_unlock(&hpts->p_mtx); | |||||
hpts = tcp_input_lock(inp); | |||||
if (inp->inp_in_input) | |||||
panic("Hpts:%p inp:%p at free still on input hpts", | |||||
hpts, inp); | |||||
mtx_unlock(&hpts->p_mtx); | |||||
} | |||||
#endif | |||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
pcbinfo = inp->inp_pcbinfo; | pcbinfo = inp->inp_pcbinfo; | ||||
uma_zfree(pcbinfo->ipi_zone, inp); | uma_zfree(pcbinfo->ipi_zone, inp); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* Temporary wrapper. | * Temporary wrapper. | ||||
▲ Show 20 Lines • Show All 1,785 Lines • Show Last 20 Lines |