497 netstack_rele(ns);
498 return (-1);
499 }
500 stats = (udp_stat_t *)kp->ks_data;
501 udp_clr_stats(stats);
502
503 cnt = us->us_sc_cnt;
504 for (i = 0; i < cnt; i++)
505 udp_add_stats(&us->us_sc[i]->udp_sc_stats, stats);
506
507 netstack_rele(ns);
508 return (0);
509 }
510
511 void *
512 udp_kstat_init(netstackid_t stackid)
513 {
514 kstat_t *ksp;
515
516 udp_named_kstat_t template = {
517 { "inDatagrams", KSTAT_DATA_UINT64, 0 },
518 { "inErrors", KSTAT_DATA_UINT32, 0 },
519 { "outDatagrams", KSTAT_DATA_UINT64, 0 },
520 { "entrySize", KSTAT_DATA_INT32, 0 },
521 { "entry6Size", KSTAT_DATA_INT32, 0 },
522 { "outErrors", KSTAT_DATA_UINT32, 0 },
523 };
524
525 ksp = kstat_create_netstack(UDP_MOD_NAME, 0, UDP_MOD_NAME, "mib2",
526 KSTAT_TYPE_NAMED, NUM_OF_FIELDS(udp_named_kstat_t), 0, stackid);
527
528 if (ksp == NULL)
529 return (NULL);
530
531 template.entrySize.value.ui32 = sizeof (mib2_udpEntry_t);
532 template.entry6Size.value.ui32 = sizeof (mib2_udp6Entry_t);
533
534 bcopy(&template, ksp->ks_data, sizeof (template));
535 ksp->ks_update = udp_kstat_update;
536 ksp->ks_private = (void *)(uintptr_t)stackid;
537
538 kstat_install(ksp);
539 return (ksp);
540 }
541
542 /*
|
497 netstack_rele(ns);
498 return (-1);
499 }
500 stats = (udp_stat_t *)kp->ks_data;
501 udp_clr_stats(stats);
502
503 cnt = us->us_sc_cnt;
504 for (i = 0; i < cnt; i++)
505 udp_add_stats(&us->us_sc[i]->udp_sc_stats, stats);
506
507 netstack_rele(ns);
508 return (0);
509 }
510
511 void *
512 udp_kstat_init(netstackid_t stackid)
513 {
514 kstat_t *ksp;
515
516 udp_named_kstat_t template = {
517 { "inDatagrams", KSTAT_DATA_UINT64, {{0}} },
518 { "inErrors", KSTAT_DATA_UINT32, {{0}} },
519 { "outDatagrams", KSTAT_DATA_UINT64, {{0}} },
520 { "entrySize", KSTAT_DATA_INT32, {{0}} },
521 { "entry6Size", KSTAT_DATA_INT32, {{0}} },
522 { "outErrors", KSTAT_DATA_UINT32, {{0}} },
523 };
524
525 ksp = kstat_create_netstack(UDP_MOD_NAME, 0, UDP_MOD_NAME, "mib2",
526 KSTAT_TYPE_NAMED, NUM_OF_FIELDS(udp_named_kstat_t), 0, stackid);
527
528 if (ksp == NULL)
529 return (NULL);
530
531 template.entrySize.value.ui32 = sizeof (mib2_udpEntry_t);
532 template.entry6Size.value.ui32 = sizeof (mib2_udp6Entry_t);
533
534 bcopy(&template, ksp->ks_data, sizeof (template));
535 ksp->ks_update = udp_kstat_update;
536 ksp->ks_private = (void *)(uintptr_t)stackid;
537
538 kstat_install(ksp);
539 return (ksp);
540 }
541
542 /*
|