| 293 | |
| 294 | #ifndef FSTACK |
| 295 | static void |
| 296 | netisr_load_kvm_workstream(void) |
| 297 | { |
| 298 | struct netisr_workstream nws; |
| 299 | struct sysctl_netisr_workstream *snwsp; |
| 300 | struct sysctl_netisr_work *snwp; |
| 301 | struct netisr_work *nwp; |
| 302 | u_int counter, cpuid, proto, wsid; |
| 303 | size_t len; |
| 304 | |
| 305 | len = numthreads * sizeof(*nws_array); |
| 306 | nws_array = malloc(len); |
| 307 | if (nws_array == NULL) |
| 308 | xo_err(-1, "malloc"); |
| 309 | if (kread(nl[N_NWS_ARRAY].n_value, nws_array, len) != 0) |
| 310 | xo_errx(-1, "%s: kread(_nws_array)", __func__); |
| 311 | workstream_array = calloc(numthreads, sizeof(*workstream_array)); |
| 312 | if (workstream_array == NULL) |
| 313 | xo_err(-1, "calloc"); |
| 314 | workstream_array_len = numthreads; |
| 315 | work_array = calloc(numthreads * proto_array_len, sizeof(*work_array)); |
| 316 | if (work_array == NULL) |
| 317 | xo_err(-1, "calloc"); |
| 318 | counter = 0; |
| 319 | for (wsid = 0; wsid < numthreads; wsid++) { |
| 320 | cpuid = nws_array[wsid]; |
| 321 | kset_dpcpu(cpuid); |
| 322 | if (kread(nl[N_NWS].n_value, &nws, sizeof(nws)) != 0) |
| 323 | xo_errx(-1, "%s: kread(nw)", __func__); |
| 324 | snwsp = &workstream_array[wsid]; |
| 325 | snwsp->snws_version = sizeof(*snwsp); |
| 326 | snwsp->snws_wsid = cpuid; |
| 327 | snwsp->snws_cpu = cpuid; |
| 328 | if (nws.nws_intr_event != NULL) |
| 329 | snwsp->snws_flags |= NETISR_SNWS_FLAGS_INTR; |
| 330 | |
| 331 | /* |
| 332 | * Extract the CPU's per-protocol work information. |
| 333 | */ |
| 334 | xo_emit("counting to maxprot: {:maxprot/%u}\n", maxprot); |
| 335 | for (proto = 0; proto < maxprot; proto++) { |
| 336 | if (!netisr_protoispresent(proto)) |
| 337 | continue; |
| 338 | nwp = &nws.nws_work[proto]; |
| 339 | snwp = &work_array[counter]; |
| 340 | snwp->snw_version = sizeof(*snwp); |
| 341 | snwp->snw_wsid = cpuid; |
| 342 | snwp->snw_proto = proto; |
| 343 | snwp->snw_len = nwp->nw_len; |
| 344 | snwp->snw_watermark = nwp->nw_watermark; |
| 345 | snwp->snw_dispatched = nwp->nw_dispatched; |
| 346 | snwp->snw_hybrid_dispatched = |
| 347 | nwp->nw_hybrid_dispatched; |
| 348 | snwp->snw_qdrops = nwp->nw_qdrops; |
| 349 | snwp->snw_queued = nwp->nw_queued; |
| 350 | snwp->snw_handled = nwp->nw_handled; |
| 351 | counter++; |
| 352 | } |
no test coverage detected