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

Function netisr_init

freebsd/net/netisr.c:1299–1343  ·  view source on GitHub ↗

* Initialize the netisr subsystem. We rely on BSS and static initialization * of most fields in global data structures. * * Start a worker thread for the boot CPU so that we can support network * traffic immediately in case the network stack is used before additional * CPUs are started (for example, diskless boot). */

Source from the content-addressed store, hash-verified

1297 * CPUs are started (for example, diskless boot).
1298 */
1299static void
1300netisr_init(void *arg)
1301{
1302 struct pcpu *pc;
1303
1304 NETISR_LOCK_INIT();
1305 if (netisr_maxthreads == 0 || netisr_maxthreads < -1 )
1306 netisr_maxthreads = 1; /* default behavior */
1307 else if (netisr_maxthreads == -1)
1308 netisr_maxthreads = mp_ncpus; /* use max cpus */
1309 if (netisr_maxthreads > mp_ncpus) {
1310 printf("netisr_init: forcing maxthreads from %d to %d\n",
1311 netisr_maxthreads, mp_ncpus);
1312 netisr_maxthreads = mp_ncpus;
1313 }
1314 if (netisr_defaultqlimit > netisr_maxqlimit) {
1315 printf("netisr_init: forcing defaultqlimit from %d to %d\n",
1316 netisr_defaultqlimit, netisr_maxqlimit);
1317 netisr_defaultqlimit = netisr_maxqlimit;
1318 }
1319#ifdef DEVICE_POLLING
1320 /*
1321 * The device polling code is not yet aware of how to deal with
1322 * multiple netisr threads, so for the time being compiling in device
1323 * polling disables parallel netisr workers.
1324 */
1325 if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
1326 printf("netisr_init: forcing maxthreads to 1 and "
1327 "bindthreads to 0 for device polling\n");
1328 netisr_maxthreads = 1;
1329 netisr_bindthreads = 0;
1330 }
1331#endif
1332
1333#ifdef EARLY_AP_STARTUP
1334 STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
1335 if (nws_count >= netisr_maxthreads)
1336 break;
1337 netisr_start_swi(pc->pc_cpuid, pc);
1338 }
1339#else
1340 pc = get_pcpu();
1341 netisr_start_swi(pc->pc_cpuid, pc);
1342#endif
1343}
1344SYSINIT(netisr_init, SI_SUB_SOFTINTR, SI_ORDER_FIRST, netisr_init, NULL);
1345
1346#ifndef EARLY_AP_STARTUP

Callers

nothing calls this directly

Calls 3

netisr_start_swiFunction · 0.85
get_pcpuFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected