Lines Matching refs:pcbinfo

127 in_pcbgroup_init(struct inpcbinfo *pcbinfo, u_int hashfields,
169 pcbinfo->ipi_hashfields = hashfields;
170 pcbinfo->ipi_pcbgroups = malloc(numpcbgroups *
171 sizeof(*pcbinfo->ipi_pcbgroups), M_PCB, M_WAITOK | M_ZERO);
172 pcbinfo->ipi_npcbgroups = numpcbgroups;
173 pcbinfo->ipi_wildbase = hashinit(hash_nelements, M_PCB,
174 &pcbinfo->ipi_wildmask);
175 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) {
176 pcbgroup = &pcbinfo->ipi_pcbgroups[pgn];
200 in_pcbgroup_destroy(struct inpcbinfo *pcbinfo)
205 if (pcbinfo->ipi_npcbgroups == 0)
208 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) {
209 pcbgroup = &pcbinfo->ipi_pcbgroups[pgn];
210 KASSERT(CK_LIST_EMPTY(pcbinfo->ipi_listhead),
216 hashdestroy(pcbinfo->ipi_wildbase, M_PCB, pcbinfo->ipi_wildmask);
217 free(pcbinfo->ipi_pcbgroups, M_PCB);
218 pcbinfo->ipi_pcbgroups = NULL;
219 pcbinfo->ipi_npcbgroups = 0;
220 pcbinfo->ipi_hashfields = 0;
229 in_pcbgroup_getbucket(struct inpcbinfo *pcbinfo, uint32_t hash)
235 return (hash % pcbinfo->ipi_npcbgroups);
246 in_pcbgroup_byhash(struct inpcbinfo *pcbinfo, u_int hashtype, uint32_t hash)
250 if ((pcbinfo->ipi_hashfields == IPI_HASHFIELDS_4TUPLE &&
252 (pcbinfo->ipi_hashfields == IPI_HASHFIELDS_4TUPLE &&
254 (pcbinfo->ipi_hashfields == IPI_HASHFIELDS_2TUPLE &&
256 return (&pcbinfo->ipi_pcbgroups[
257 in_pcbgroup_getbucket(pcbinfo, hash)]);
263 in_pcbgroup_bymbuf(struct inpcbinfo *pcbinfo, struct mbuf *m)
266 return (in_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m),
271 in_pcbgroup_bytuple(struct inpcbinfo *pcbinfo, struct in_addr laddr,
281 switch (pcbinfo->ipi_hashfields) {
301 return (&pcbinfo->ipi_pcbgroups[in_pcbgroup_getbucket(pcbinfo,
328 struct inpcbinfo *pcbinfo;
336 pcbinfo = inp->inp_pcbinfo;
337 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
338 INP_GROUP_LOCK(&pcbinfo->ipi_pcbgroups[pgn]);
339 head = &pcbinfo->ipi_wildbase[INP_PCBHASH(INADDR_ANY, inp->inp_lport,
340 0, pcbinfo->ipi_wildmask)];
343 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
344 INP_GROUP_UNLOCK(&pcbinfo->ipi_pcbgroups[pgn]);
350 struct inpcbinfo *pcbinfo;
357 pcbinfo = inp->inp_pcbinfo;
358 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
359 INP_GROUP_LOCK(&pcbinfo->ipi_pcbgroups[pgn]);
361 for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
362 INP_GROUP_UNLOCK(&pcbinfo->ipi_pcbgroups[pgn]);
406 in_pcbgroup_update_internal(struct inpcbinfo *pcbinfo,
472 struct inpcbinfo *pcbinfo;
477 pcbinfo = inp->inp_pcbinfo;
478 if (!in_pcbgroup_enabled(pcbinfo))
492 in_pcbgroup_update_internal(pcbinfo, newpcbgroup, inp);
498 struct inpcbinfo *pcbinfo;
503 pcbinfo = inp->inp_pcbinfo;
504 if (!in_pcbgroup_enabled(pcbinfo))
515 newpcbgroup = in_pcbgroup_bymbuf(pcbinfo, m);
529 in_pcbgroup_update_internal(pcbinfo, newpcbgroup, inp);
562 in_pcbgroup_enabled(struct inpcbinfo *pcbinfo)
565 return (pcbinfo->ipi_npcbgroups > 0);