464 dccp_stat_t template = {
465 { "dccp_sock_fallback", KSTAT_DATA_UINT64, 0 },
466 };
467
468 ksp = kstat_create_netstack(DCCP_MOD_NAME, 0, "dccpstat", "net",
469 KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), 0,
470 stackid);
471 if (ksp == NULL) {
472 return (NULL);
473 }
474
475 bcopy(&template, ksp->ks_data, sizeof (template));
476 ksp->ks_private = (void *)(uintptr_t)stackid;
477 ksp->ks_update = dccp_kstat2_update;
478
479 kstat_install(ksp);
480
481 return (ksp);
482 }
483
484 void
485 dccp_kstat2_fini(netstackid_t stackid, kstat_t *ksp)
486 {
487 if (ksp != NULL) {
488 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
489 kstat_delete_netstack(ksp, stackid);
490 }
491 }
492
493 /*
494 * Update routine for .
495 */
496 static int
497 dccp_kstat2_update(kstat_t *kp, int rw)
498 {
499 dccp_stack_t *dccps;
500 dccp_stat_t *stats;
501 netstack_t *ns;
502 netstackid_t stackid;
503 int i;
|
464 dccp_stat_t template = {
465 { "dccp_sock_fallback", KSTAT_DATA_UINT64, 0 },
466 };
467
468 ksp = kstat_create_netstack(DCCP_MOD_NAME, 0, "dccpstat", "net",
469 KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), 0,
470 stackid);
471 if (ksp == NULL) {
472 return (NULL);
473 }
474
475 bcopy(&template, ksp->ks_data, sizeof (template));
476 ksp->ks_private = (void *)(uintptr_t)stackid;
477 ksp->ks_update = dccp_kstat2_update;
478
479 kstat_install(ksp);
480
481 return (ksp);
482 }
483
484 /*
485 * Destroy DCCP kernel statistics.
486 */
487 void
488 dccp_kstat2_fini(netstackid_t stackid, kstat_t *ksp)
489 {
490 if (ksp != NULL) {
491 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
492 kstat_delete_netstack(ksp, stackid);
493 }
494 }
495
496 /*
497 * Update routine for .
498 */
499 static int
500 dccp_kstat2_update(kstat_t *kp, int rw)
501 {
502 dccp_stack_t *dccps;
503 dccp_stat_t *stats;
504 netstack_t *ns;
505 netstackid_t stackid;
506 int i;
|