MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_pcbinfo_init

Function in_pcbinfo_init

freebsd/netinet/in_pcb.c:519–550  ·  view source on GitHub ↗

* Initialize an inpcbinfo -- we should be able to reduce the number of * arguments in time. */

Source from the content-addressed store, hash-verified

517 * arguments in time.
518 */
519void
520in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char *name,
521 struct inpcbhead *listhead, int hash_nelements, int porthash_nelements,
522 char *inpcbzone_name, uma_init inpcbzone_init, u_int hashfields)
523{
524
525 porthash_nelements = imin(porthash_nelements, IPPORT_MAX + 1);
526
527 INP_INFO_LOCK_INIT(pcbinfo, name);
528 INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */
529 INP_LIST_LOCK_INIT(pcbinfo, "pcbinfolist");
530#ifdef VIMAGE
531 pcbinfo->ipi_vnet = curvnet;
532#endif
533 pcbinfo->ipi_listhead = listhead;
534 CK_LIST_INIT(pcbinfo->ipi_listhead);
535 pcbinfo->ipi_count = 0;
536 pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB,
537 &pcbinfo->ipi_hashmask);
538 pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB,
539 &pcbinfo->ipi_porthashmask);
540 pcbinfo->ipi_lbgrouphashbase = hashinit(porthash_nelements, M_PCB,
541 &pcbinfo->ipi_lbgrouphashmask);
542#ifdef PCBGROUP
543 in_pcbgroup_init(pcbinfo, hashfields, hash_nelements);
544#endif
545 pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb),
546 NULL, NULL, inpcbzone_init, inpcb_fini, UMA_ALIGN_PTR, 0);
547 uma_zone_set_max(pcbinfo->ipi_zone, maxsockets);
548 uma_zone_set_warning(pcbinfo->ipi_zone,
549 "kern.ipc.maxsockets limit reached");
550}
551
552/*
553 * Destroy an inpcbinfo.

Callers 5

udp_initFunction · 0.85
udplite_initFunction · 0.85
div_initFunction · 0.85
tcp_initFunction · 0.85
rip_initFunction · 0.85

Calls 6

iminFunction · 0.85
in_pcbgroup_initFunction · 0.85
uma_zcreateFunction · 0.85
uma_zone_set_maxFunction · 0.85
uma_zone_set_warningFunction · 0.85
hashinitFunction · 0.50

Tested by

no test coverage detected