| 1259 | #endif |
| 1260 | |
| 1261 | static void |
| 1262 | netisr_start_swi(u_int cpuid, struct pcpu *pc) |
| 1263 | { |
| 1264 | char swiname[12]; |
| 1265 | struct netisr_workstream *nwsp; |
| 1266 | int error; |
| 1267 | |
| 1268 | KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); |
| 1269 | |
| 1270 | nwsp = DPCPU_ID_PTR(cpuid, nws); |
| 1271 | mtx_init(&nwsp->nws_mtx, "netisr_mtx", NULL, MTX_DEF); |
| 1272 | nwsp->nws_cpu = cpuid; |
| 1273 | snprintf(swiname, sizeof(swiname), "netisr %u", cpuid); |
| 1274 | error = swi_add(&nwsp->nws_intr_event, swiname, swi_net, nwsp, |
| 1275 | SWI_NET, INTR_TYPE_NET | INTR_MPSAFE, &nwsp->nws_swi_cookie); |
| 1276 | if (error) |
| 1277 | panic("%s: swi_add %d", __func__, error); |
| 1278 | pc->pc_netisr = nwsp->nws_intr_event; |
| 1279 | if (netisr_bindthreads) { |
| 1280 | error = intr_event_bind(nwsp->nws_intr_event, cpuid); |
| 1281 | if (error != 0) |
| 1282 | printf("%s: cpu %u: intr_event_bind: %d", __func__, |
| 1283 | cpuid, error); |
| 1284 | } |
| 1285 | NETISR_WLOCK(); |
| 1286 | nws_array[nws_count] = nwsp->nws_cpu; |
| 1287 | nws_count++; |
| 1288 | NETISR_WUNLOCK(); |
| 1289 | } |
| 1290 | |
| 1291 | /* |
| 1292 | * Initialize the netisr subsystem. We rely on BSS and static initialization |