Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/netisr.c
| Show First 20 Lines • Show All 1,262 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * Start a worker thread for the boot CPU so that we can support network | * 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 | * traffic immediately in case the network stack is used before additional | ||||
| * CPUs are started (for example, diskless boot). | * CPUs are started (for example, diskless boot). | ||||
| */ | */ | ||||
| static void | static void | ||||
| netisr_init(void *arg) | netisr_init(void *arg) | ||||
| { | { | ||||
| #ifdef EARLY_AP_STARTUP | |||||
| struct pcpu *pc; | struct pcpu *pc; | ||||
| #endif | |||||
| NETISR_LOCK_INIT(); | NETISR_LOCK_INIT(); | ||||
| if (netisr_maxthreads == 0 || netisr_maxthreads < -1 ) | if (netisr_maxthreads == 0 || netisr_maxthreads < -1 ) | ||||
| netisr_maxthreads = 1; /* default behavior */ | netisr_maxthreads = 1; /* default behavior */ | ||||
| else if (netisr_maxthreads == -1) | else if (netisr_maxthreads == -1) | ||||
| netisr_maxthreads = mp_ncpus; /* use max cpus */ | netisr_maxthreads = mp_ncpus; /* use max cpus */ | ||||
| if (netisr_maxthreads > mp_ncpus) { | if (netisr_maxthreads > mp_ncpus) { | ||||
| printf("netisr_init: forcing maxthreads from %d to %d\n", | printf("netisr_init: forcing maxthreads from %d to %d\n", | ||||
| Show All 21 Lines | |||||
| #ifdef EARLY_AP_STARTUP | #ifdef EARLY_AP_STARTUP | ||||
| STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { | STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { | ||||
| if (nws_count >= netisr_maxthreads) | if (nws_count >= netisr_maxthreads) | ||||
| break; | break; | ||||
| netisr_start_swi(pc->pc_cpuid, pc); | netisr_start_swi(pc->pc_cpuid, pc); | ||||
| } | } | ||||
| #else | #else | ||||
| netisr_start_swi(curcpu, pcpu_find(curcpu)); | pc = get_pcpu(); | ||||
| netisr_start_swi(pc->pc_cpuid, pc); | |||||
| #endif | #endif | ||||
| } | } | ||||
| SYSINIT(netisr_init, SI_SUB_SOFTINTR, SI_ORDER_FIRST, netisr_init, NULL); | SYSINIT(netisr_init, SI_SUB_SOFTINTR, SI_ORDER_FIRST, netisr_init, NULL); | ||||
| #ifndef EARLY_AP_STARTUP | #ifndef EARLY_AP_STARTUP | ||||
| /* | /* | ||||
| * Start worker threads for additional CPUs. No attempt to gracefully handle | * Start worker threads for additional CPUs. No attempt to gracefully handle | ||||
| * work reassignment, we don't yet support dynamic reconfiguration. | * work reassignment, we don't yet support dynamic reconfiguration. | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||