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

Function sctp_pcb_init

freebsd/netinet/sctp_pcb.c:5688–5830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5686#endif
5687
5688void
5689sctp_pcb_init(void)
5690{
5691 /*
5692 * SCTP initialization for the PCB structures should be called by
5693 * the sctp_init() function.
5694 */
5695 int i;
5696 struct timeval tv;
5697
5698 if (SCTP_BASE_VAR(sctp_pcb_initialized) != 0) {
5699 /* error I was called twice */
5700 return;
5701 }
5702 SCTP_BASE_VAR(sctp_pcb_initialized) = 1;
5703
5704#if defined(SCTP_LOCAL_TRACE_BUF)
5705 memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
5706#endif
5707#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
5708 SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *,
5709 ((mp_maxid + 1) * sizeof(struct sctpstat)),
5710 SCTP_M_MCORE);
5711#endif
5712 (void)SCTP_GETTIME_TIMEVAL(&tv);
5713#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
5714 memset(SCTP_BASE_STATS, 0, sizeof(struct sctpstat) * (mp_maxid + 1));
5715 SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t)tv.tv_sec;
5716 SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t)tv.tv_usec;
5717#else
5718 memset(&SCTP_BASE_STATS, 0, sizeof(struct sctpstat));
5719 SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t)tv.tv_sec;
5720 SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t)tv.tv_usec;
5721#endif
5722 /* init the empty list of (All) Endpoints */
5723 LIST_INIT(&SCTP_BASE_INFO(listhead));
5724
5725 /* init the hash table of endpoints */
5726 TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &SCTP_BASE_SYSCTL(sctp_hashtblsize));
5727 TUNABLE_INT_FETCH("net.inet.sctp.pcbhashsize", &SCTP_BASE_SYSCTL(sctp_pcbtblsize));
5728 TUNABLE_INT_FETCH("net.inet.sctp.chunkscale", &SCTP_BASE_SYSCTL(sctp_chunkscale));
5729 SCTP_BASE_INFO(sctp_asochash) = SCTP_HASH_INIT((SCTP_BASE_SYSCTL(sctp_hashtblsize) * 31),
5730 &SCTP_BASE_INFO(hashasocmark));
5731 SCTP_BASE_INFO(sctp_ephash) = SCTP_HASH_INIT(SCTP_BASE_SYSCTL(sctp_hashtblsize),
5732 &SCTP_BASE_INFO(hashmark));
5733 SCTP_BASE_INFO(sctp_tcpephash) = SCTP_HASH_INIT(SCTP_BASE_SYSCTL(sctp_hashtblsize),
5734 &SCTP_BASE_INFO(hashtcpmark));
5735 SCTP_BASE_INFO(hashtblsize) = SCTP_BASE_SYSCTL(sctp_hashtblsize);
5736 SCTP_BASE_INFO(sctp_vrfhash) = SCTP_HASH_INIT(SCTP_SIZE_OF_VRF_HASH,
5737 &SCTP_BASE_INFO(hashvrfmark));
5738
5739 SCTP_BASE_INFO(vrf_ifn_hash) = SCTP_HASH_INIT(SCTP_VRF_IFN_HASH_SIZE,
5740 &SCTP_BASE_INFO(vrf_ifn_hashmark));
5741 /* init the zones */
5742 /*
5743 * FIX ME: Should check for NULL returns, but if it does fail we are
5744 * doomed to panic anyways... add later maybe.
5745 */

Callers 1

sctp_initFunction · 0.85

Calls 4

memsetFunction · 0.85
sctp_startup_iteratorFunction · 0.85
sctp_init_vrf_listFunction · 0.85

Tested by

no test coverage detected