Lines Matching refs:channel

158 static int dcopy_stats_init(dcopy_handle_t channel);
159 static void dcopy_stats_fini(dcopy_handle_t channel);
285 dcopy_handle_t channel; in dcopy_alloc() local
301 channel = list_head(&list->dl_list); in dcopy_alloc()
302 if (channel == NULL) { in dcopy_alloc()
312 channel->ch_ref_cnt++; in dcopy_alloc()
313 list_remove(&list->dl_list, channel); in dcopy_alloc()
314 list_insert_tail(&list->dl_list, channel); in dcopy_alloc()
317 *handle = (dcopy_handle_t)channel; in dcopy_alloc()
326 dcopy_free(dcopy_handle_t *channel) in dcopy_free() argument
333 ASSERT(*channel != NULL); in dcopy_free()
341 (*channel)->ch_ref_cnt--; in dcopy_free()
348 if ((*channel)->ch_removing && ((*channel)->ch_ref_cnt == 0)) { in dcopy_free()
349 device = (*channel)->ch_device; in dcopy_free()
368 *channel = NULL; in dcopy_free()
376 dcopy_query_channel(dcopy_handle_t channel, dcopy_query_channel_t *query) in dcopy_query_channel() argument
378 *query = channel->ch_info; in dcopy_query_channel()
388 dcopy_handle_t channel; in dcopy_cmd_alloc() local
393 channel = handle; in dcopy_cmd_alloc()
395 atomic_inc_64(&channel->ch_stat.cs_cmd_alloc.value.ui64); in dcopy_cmd_alloc()
396 e = channel->ch_cb->cb_cmd_alloc(channel->ch_channel_private, flags, in dcopy_cmd_alloc()
400 priv->pr_channel = channel; in dcopy_cmd_alloc()
418 dcopy_handle_t channel; in dcopy_cmd_free() local
425 channel = priv->pr_channel; in dcopy_cmd_free()
433 channel->ch_cb->cb_cmd_free(channel->ch_channel_private, cmd); in dcopy_cmd_free()
443 dcopy_handle_t channel; in dcopy_cmd_post() local
447 channel = cmd->dp_private->pr_channel; in dcopy_cmd_post()
449 atomic_inc_64(&channel->ch_stat.cs_cmd_post.value.ui64); in dcopy_cmd_post()
451 atomic_add_64(&channel->ch_stat.cs_bytes_xfer.value.ui64, in dcopy_cmd_post()
454 e = channel->ch_cb->cb_cmd_post(channel->ch_channel_private, cmd); in dcopy_cmd_post()
469 dcopy_handle_t channel; in dcopy_cmd_poll() local
475 channel = priv->pr_channel; in dcopy_cmd_poll()
485 atomic_inc_64(&channel->ch_stat.cs_cmd_poll.value.ui64); in dcopy_cmd_poll()
488 e = channel->ch_cb->cb_cmd_poll(channel->ch_channel_private, cmd); in dcopy_cmd_poll()
511 dcopy_list_push(&channel->ch_poll_list, priv); in dcopy_cmd_poll()
604 struct dcopy_channel_s *channel; in dcopy_device_register() local
633 channel = kmem_zalloc(sizeof (*channel), KM_SLEEP); in dcopy_device_register()
634 channel->ch_device = device; in dcopy_device_register()
635 channel->ch_removing = B_FALSE; in dcopy_device_register()
636 channel->ch_ref_cnt = 0; in dcopy_device_register()
637 channel->ch_cb = info->di_cb; in dcopy_device_register()
639 e = info->di_cb->cb_channel_alloc(device_private, channel, in dcopy_device_register()
640 DCOPY_SLEEP, dcopy_channel_size, &channel->ch_info, in dcopy_device_register()
641 &channel->ch_channel_private); in dcopy_device_register()
643 kmem_free(channel, sizeof (*channel)); in dcopy_device_register()
647 e = dcopy_stats_init(channel); in dcopy_device_register()
650 &channel->ch_channel_private); in dcopy_device_register()
651 kmem_free(channel, sizeof (*channel)); in dcopy_device_register()
655 e = dcopy_list_init(&channel->ch_poll_list, in dcopy_device_register()
659 dcopy_stats_fini(channel); in dcopy_device_register()
661 &channel->ch_channel_private); in dcopy_device_register()
662 kmem_free(channel, sizeof (*channel)); in dcopy_device_register()
666 dcopy_list_push(&device->dc_devchan_list, channel); in dcopy_device_register()
678 channel = list_head(&device->dc_devchan_list.dl_list); in dcopy_device_register()
679 while (channel != NULL) { in dcopy_device_register()
681 channel); in dcopy_device_register()
683 channel = list_next(&device->dc_devchan_list.dl_list, channel); in dcopy_device_register()
696 channel = list_head(&device->dc_devchan_list.dl_list); in dcopy_device_register()
697 while (channel != NULL) { in dcopy_device_register()
699 channel = dcopy_list_pop(&device->dc_devchan_list); in dcopy_device_register()
700 ASSERT(channel != NULL); in dcopy_device_register()
702 dcopy_list_fini(&channel->ch_poll_list); in dcopy_device_register()
703 dcopy_stats_fini(channel); in dcopy_device_register()
704 info->di_cb->cb_channel_free(&channel->ch_channel_private); in dcopy_device_register()
705 kmem_free(channel, sizeof (*channel)); in dcopy_device_register()
723 struct dcopy_channel_s *channel; in dcopy_device_unregister() local
739 channel = list_head(&device->dc_devchan_list.dl_list); in dcopy_device_unregister()
740 while (channel != NULL) { in dcopy_device_unregister()
746 if (channel->ch_ref_cnt != 0) { in dcopy_device_unregister()
747 channel->ch_removing = B_TRUE; in dcopy_device_unregister()
752 list_remove(&dcopy_statep->d_globalchan_list.dl_list, channel); in dcopy_device_unregister()
753 channel = list_next(&device->dc_devchan_list.dl_list, channel); in dcopy_device_unregister()
779 struct dcopy_channel_s *channel; in dcopy_device_cleanup() local
786 channel = list_head(&device->dc_devchan_list.dl_list); in dcopy_device_cleanup()
787 while (channel != NULL) { in dcopy_device_cleanup()
789 list_remove(&device->dc_devchan_list.dl_list, channel); in dcopy_device_cleanup()
790 dcopy_list_fini(&channel->ch_poll_list); in dcopy_device_cleanup()
791 dcopy_stats_fini(channel); in dcopy_device_cleanup()
792 channel->ch_cb->cb_channel_free(&channel->ch_channel_private); in dcopy_device_cleanup()
793 kmem_free(channel, sizeof (*channel)); in dcopy_device_cleanup()
794 channel = list_head(&device->dc_devchan_list.dl_list); in dcopy_device_cleanup()
823 struct dcopy_channel_s *channel; in dcopy_device_channel_notify() local
830 channel = handle; in dcopy_device_channel_notify()
832 poll_list = &channel->ch_poll_list; in dcopy_device_channel_notify()
845 atomic_inc_64(&channel-> in dcopy_device_channel_notify()
847 e = channel->ch_cb->cb_cmd_poll( in dcopy_device_channel_notify()
848 channel->ch_channel_private, in dcopy_device_channel_notify()
851 atomic_inc_64(&channel-> in dcopy_device_channel_notify()
876 dcopy_stats_init(dcopy_handle_t channel) in dcopy_stats_init() argument
885 stats = &channel->ch_stat; in dcopy_stats_init()
886 name = (char *)ddi_driver_name(channel->ch_device->dc_info.di_dip); in dcopy_stats_init()
887 instance = ddi_get_instance(channel->ch_device->dc_info.di_dip); in dcopy_stats_init()
890 (uint32_t)channel->ch_info.qc_chan_num); in dcopy_stats_init()
892 channel->ch_kstat = kstat_create(name, instance, chanstr, "misc", in dcopy_stats_init()
895 if (channel->ch_kstat == NULL) { in dcopy_stats_init()
898 channel->ch_kstat->ks_data = stats; in dcopy_stats_init()
917 kstat_install(channel->ch_kstat); in dcopy_stats_init()
919 channel->ch_stat.cs_id.value.ui64 = channel->ch_info.qc_id; in dcopy_stats_init()
920 channel->ch_stat.cs_capabilities.value.ui64 = in dcopy_stats_init()
921 channel->ch_info.qc_capabilities; in dcopy_stats_init()
931 dcopy_stats_fini(dcopy_handle_t channel) in dcopy_stats_fini() argument
933 kstat_delete(channel->ch_kstat); in dcopy_stats_fini()