Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/in_pcb.c
Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* Add PCB to load balance group for SO_REUSEPORT_LB option. | * Add PCB to load balance group for SO_REUSEPORT_LB option. | ||||
*/ | */ | ||||
static int | static int | ||||
in_pcbinslbgrouphash(struct inpcb *inp) | in_pcbinslbgrouphash(struct inpcb *inp) | ||||
{ | { | ||||
const static struct timeval interval = { 60, 0 }; | |||||
static struct timeval lastprint; | |||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
struct inpcblbgrouphead *hdr; | struct inpcblbgrouphead *hdr; | ||||
struct inpcblbgroup *grp; | struct inpcblbgroup *grp; | ||||
uint16_t hashmask, lport; | uint16_t hashmask, lport; | ||||
uint32_t group_index; | uint32_t group_index; | ||||
struct ucred *cred; | struct ucred *cred; | ||||
static int limit_logged = 0; | |||||
pcbinfo = inp->inp_pcbinfo; | pcbinfo = inp->inp_pcbinfo; | ||||
INP_WLOCK_ASSERT(inp); | INP_WLOCK_ASSERT(inp); | ||||
INP_HASH_WLOCK_ASSERT(pcbinfo); | INP_HASH_WLOCK_ASSERT(pcbinfo); | ||||
if (pcbinfo->ipi_lbgrouphashbase == NULL) | if (pcbinfo->ipi_lbgrouphashbase == NULL) | ||||
return (0); | return (0); | ||||
Show All 40 Lines | if (grp == NULL) { | ||||
/* Create new load balance group. */ | /* Create new load balance group. */ | ||||
grp = in_pcblbgroup_alloc(hdr, inp->inp_vflag, | grp = in_pcblbgroup_alloc(hdr, inp->inp_vflag, | ||||
inp->inp_lport, &inp->inp_inc.inc_ie.ie_dependladdr, | inp->inp_lport, &inp->inp_inc.inc_ie.ie_dependladdr, | ||||
INPCBLBGROUP_SIZMIN); | INPCBLBGROUP_SIZMIN); | ||||
if (!grp) | if (!grp) | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
} else if (grp->il_inpcnt == grp->il_inpsiz) { | } else if (grp->il_inpcnt == grp->il_inpsiz) { | ||||
if (grp->il_inpsiz >= INPCBLBGROUP_SIZMAX) { | if (grp->il_inpsiz >= INPCBLBGROUP_SIZMAX) { | ||||
if (!limit_logged) { | if (ratecheck(&lastprint, &interval)) | ||||
limit_logged = 1; | |||||
printf("lb group port %d, limit reached\n", | printf("lb group port %d, limit reached\n", | ||||
ntohs(grp->il_lport)); | ntohs(grp->il_lport)); | ||||
} | |||||
return (0); | return (0); | ||||
} | } | ||||
/* Expand this local group. */ | /* Expand this local group. */ | ||||
grp = in_pcblbgroup_resize(hdr, grp, grp->il_inpsiz * 2); | grp = in_pcblbgroup_resize(hdr, grp, grp->il_inpsiz * 2); | ||||
if (!grp) | if (!grp) | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,070 Lines • Show Last 20 Lines |