Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_pcb.c
Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | in_pcblbgroup_alloc(struct inpcblbgrouphead *hdr, u_char vflag, | ||||
grp->il_lport = port; | grp->il_lport = port; | ||||
grp->il_dependladdr = *addr; | grp->il_dependladdr = *addr; | ||||
grp->il_inpsiz = size; | grp->il_inpsiz = size; | ||||
CK_LIST_INSERT_HEAD(hdr, grp, il_list); | CK_LIST_INSERT_HEAD(hdr, grp, il_list); | ||||
return (grp); | return (grp); | ||||
} | } | ||||
static void | static void | ||||
in_pcblbgroup_free_deferred(epoch_context_t ctx) | in_pcblbgroup_free_deferred(epoch_context_t *ctx) | ||||
{ | { | ||||
struct inpcblbgroup *grp; | struct inpcblbgroup *grp; | ||||
grp = __containerof(ctx, struct inpcblbgroup, il_epoch_ctx); | grp = __containerof(ctx, struct inpcblbgroup, il_epoch_ctx); | ||||
free(grp, M_PCB); | free(grp, M_PCB); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 1,290 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
in_pcbrele(struct inpcb *inp) | in_pcbrele(struct inpcb *inp) | ||||
{ | { | ||||
return (in_pcbrele_wlocked(inp)); | return (in_pcbrele_wlocked(inp)); | ||||
} | } | ||||
void | void | ||||
in_pcblist_rele_rlocked(epoch_context_t ctx) | in_pcblist_rele_rlocked(epoch_context_t *ctx) | ||||
{ | { | ||||
struct in_pcblist *il; | struct in_pcblist *il; | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
int i, n; | int i, n; | ||||
il = __containerof(ctx, struct in_pcblist, il_epoch_ctx); | il = __containerof(ctx, struct in_pcblist, il_epoch_ctx); | ||||
pcbinfo = il->il_pcbinfo; | pcbinfo = il->il_pcbinfo; | ||||
n = il->il_count; | n = il->il_count; | ||||
INP_INFO_WLOCK(pcbinfo); | INP_INFO_WLOCK(pcbinfo); | ||||
for (i = 0; i < n; i++) { | for (i = 0; i < n; i++) { | ||||
inp = il->il_inp_list[i]; | inp = il->il_inp_list[i]; | ||||
INP_RLOCK(inp); | INP_RLOCK(inp); | ||||
if (!in_pcbrele_rlocked(inp)) | if (!in_pcbrele_rlocked(inp)) | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
} | } | ||||
INP_INFO_WUNLOCK(pcbinfo); | INP_INFO_WUNLOCK(pcbinfo); | ||||
free(il, M_TEMP); | free(il, M_TEMP); | ||||
} | } | ||||
static void | static void | ||||
inpcbport_free(epoch_context_t ctx) | inpcbport_free(epoch_context_t *ctx) | ||||
{ | { | ||||
struct inpcbport *phd; | struct inpcbport *phd; | ||||
phd = __containerof(ctx, struct inpcbport, phd_epoch_ctx); | phd = __containerof(ctx, struct inpcbport, phd_epoch_ctx); | ||||
free(phd, M_PCB); | free(phd, M_PCB); | ||||
} | } | ||||
static void | static void | ||||
in_pcbfree_deferred(epoch_context_t ctx) | in_pcbfree_deferred(epoch_context_t *ctx) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
int released __unused; | int released __unused; | ||||
inp = __containerof(ctx, struct inpcb, inp_epoch_ctx); | inp = __containerof(ctx, struct inpcb, inp_epoch_ctx); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
#ifdef INET | #ifdef INET | ||||
▲ Show 20 Lines • Show All 964 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* If none exists, malloc one and tack it on. | * If none exists, malloc one and tack it on. | ||||
*/ | */ | ||||
if (phd == NULL) { | if (phd == NULL) { | ||||
phd = malloc(sizeof(struct inpcbport), M_PCB, M_NOWAIT); | phd = malloc(sizeof(struct inpcbport), M_PCB, M_NOWAIT); | ||||
if (phd == NULL) { | if (phd == NULL) { | ||||
return (ENOBUFS); /* XXX */ | return (ENOBUFS); /* XXX */ | ||||
} | } | ||||
bzero(&phd->phd_epoch_ctx, sizeof(struct epoch_context)); | bzero(&phd->phd_epoch_ctx, sizeof(phd->phd_epoch_ctx)); | ||||
phd->phd_port = inp->inp_lport; | phd->phd_port = inp->inp_lport; | ||||
CK_LIST_INIT(&phd->phd_pcblist); | CK_LIST_INIT(&phd->phd_pcblist); | ||||
CK_LIST_INSERT_HEAD(pcbporthash, phd, phd_hash); | CK_LIST_INSERT_HEAD(pcbporthash, phd, phd_hash); | ||||
} | } | ||||
inp->inp_phd = phd; | inp->inp_phd = phd; | ||||
CK_LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); | CK_LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); | ||||
CK_LIST_INSERT_HEAD(pcbhash, inp, inp_hash); | CK_LIST_INSERT_HEAD(pcbhash, inp, inp_hash); | ||||
inp->inp_flags |= INP_INHASHLIST; | inp->inp_flags |= INP_INHASHLIST; | ||||
▲ Show 20 Lines • Show All 888 Lines • Show Last 20 Lines |