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

Function in_pcblbgroup_numa

freebsd/netinet/in_pcb.c:452–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452int
453in_pcblbgroup_numa(struct inpcb *inp, int arg)
454{
455 struct inpcbinfo *pcbinfo;
456 struct inpcblbgrouphead *hdr;
457 struct inpcblbgroup *grp;
458 int err, i;
459 uint8_t numa_domain;
460
461 switch (arg) {
462 case TCP_REUSPORT_LB_NUMA_NODOM:
463 numa_domain = M_NODOM;
464 break;
465 case TCP_REUSPORT_LB_NUMA_CURDOM:
466 numa_domain = PCPU_GET(domain);
467 break;
468 default:
469 if (arg < 0 || arg >= vm_ndomains)
470 return (EINVAL);
471 numa_domain = arg;
472 }
473
474 err = 0;
475 pcbinfo = inp->inp_pcbinfo;
476 INP_WLOCK_ASSERT(inp);
477 INP_HASH_WLOCK(pcbinfo);
478 hdr = &pcbinfo->ipi_lbgrouphashbase[
479 INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)];
480 CK_LIST_FOREACH(grp, hdr, il_list) {
481 for (i = 0; i < grp->il_inpcnt; ++i) {
482 if (grp->il_inp[i] != inp)
483 continue;
484
485 if (grp->il_numa_domain == numa_domain) {
486 goto abort_with_hash_wlock;
487 }
488
489 /* Remove it from the old group. */
490 in_pcbremlbgrouphash(inp);
491
492 /* Add it to the new group based on numa domain. */
493 in_pcbinslbgrouphash(inp, numa_domain);
494 goto abort_with_hash_wlock;
495 }
496 }
497 err = ENOENT;
498abort_with_hash_wlock:
499 INP_HASH_WUNLOCK(pcbinfo);
500 return (err);
501}
502
503/*
504 * Different protocols initialize their inpcbs differently - giving

Callers 1

tcp_default_ctloutputFunction · 0.85

Calls 2

in_pcbremlbgrouphashFunction · 0.85
in_pcbinslbgrouphashFunction · 0.85

Tested by

no test coverage detected