Lines Matching defs:svdev
103 struct virtio_scsi_dev *svdev;
136 struct virtio_scsi_dev *svdev;
148 struct virtio_scsi_dev *svdev;
172 static void virtio_scsi_dev_remove(struct virtio_scsi_dev *svdev,
196 virtio_scsi_dev_init(struct virtio_scsi_dev *svdev, uint16_t max_queues, uint64_t feature_bits)
198 struct virtio_dev *vdev = &svdev->vdev;
239 svdev->eventq_ios = spdk_zmalloc(sizeof(*svdev->eventq_ios) * num_events,
242 if (svdev->eventq_ios == NULL) {
252 eventq_io = &svdev->eventq_ios[i];
258 svdev->ctrlq_ring = ctrlq_ring;
260 svdev->mgmt_poller = SPDK_POLLER_REGISTER(bdev_virtio_mgmt_poll, svdev,
263 TAILQ_INIT(&svdev->luns);
264 svdev->scan_ctx = NULL;
265 svdev->removed = false;
266 svdev->remove_cb = NULL;
267 svdev->remove_ctx = NULL;
269 spdk_io_device_register(svdev, bdev_virtio_scsi_ch_create_cb,
272 svdev->vdev.name);
275 TAILQ_INSERT_TAIL(&g_virtio_scsi_devs, svdev, tailq);
284 struct virtio_scsi_dev *svdev;
290 svdev = calloc(1, sizeof(*svdev));
291 if (svdev == NULL) {
296 vdev = &svdev->vdev;
310 free(svdev);
321 rc = virtio_scsi_dev_init(svdev, num_queues, VIRTIO_SCSI_DEV_SUPPORTED_FEATURES);
326 return svdev;
331 free(svdev);
339 struct virtio_scsi_dev *svdev;
344 svdev = calloc(1, sizeof(*svdev));
345 if (svdev == NULL) {
350 vdev = &svdev->vdev;
354 free(svdev);
360 rc = virtio_scsi_dev_init(svdev, num_queues + SPDK_VIRTIO_SCSI_QUEUE_NUM_FIXED, feature_bits);
363 free(svdev);
367 return svdev;
371 virtio_scsi_dev_get_disk_by_id(struct virtio_scsi_dev *svdev, uint8_t target_id)
375 TAILQ_FOREACH(disk, &svdev->luns, link) {
384 static int virtio_scsi_dev_scan(struct virtio_scsi_dev *svdev,
390 static int virtio_scsi_dev_scan_tgt(struct virtio_scsi_dev *svdev, uint8_t target);
401 struct virtio_scsi_dev *svdev;
404 TAILQ_FOREACH(svdev, &g_virtio_scsi_devs, tailq) {
410 spdk_json_write_named_string(w, "name", svdev->vdev.name);
414 svdev->vdev.backend_ops->write_json_config(&svdev->vdev, w);
543 struct virtio_scsi_dev *svdev = virtio_ch->svdev;
549 enqueued_count = spdk_ring_enqueue(svdev->ctrlq_ring, (void **)&bdev_io, 1, NULL);
692 return spdk_get_io_channel(disk->svdev);
699 struct virtio_scsi_dev *svdev = disk->svdev;
701 TAILQ_REMOVE(&svdev->luns, disk, link);
705 if (svdev->removed && TAILQ_EMPTY(&svdev->luns)) {
706 spdk_io_device_unregister(svdev, virtio_scsi_dev_unregister_cb);
717 virtio_dev_dump_json_info(&disk->svdev->vdev, w);
779 struct virtio_scsi_dev *svdev = ch->svdev;
780 struct virtio_scsi_scan_base *scan_ctx = svdev->scan_ctx;
789 if (svdev->removed) {
812 scan_ctx = svdev->scan_ctx;
814 if (svdev->removed) {
855 bdev_virtio_eventq_io_cpl(struct virtio_scsi_dev *svdev, struct virtio_scsi_eventq_io *io)
867 virtio_scsi_dev_scan(svdev, NULL, NULL);
876 virtio_scsi_dev_scan_tgt(svdev, ev->lun[1]);
879 disk = virtio_scsi_dev_get_disk_by_id(svdev, ev->lun[1]);
893 virtio_scsi_dev_send_eventq_io(svdev->vdev.vqs[VIRTIO_SCSI_EVENTQ], io);
947 struct virtio_scsi_dev *svdev = arg;
948 struct virtio_dev *vdev = &svdev->vdev;
951 struct spdk_ring *send_ring = svdev->ctrlq_ring;
976 bdev_virtio_eventq_io_cpl(svdev, io[i]);
985 struct virtio_scsi_dev *svdev = io_device;
986 struct virtio_dev *vdev = &svdev->vdev;
999 ch->svdev = svdev;
1011 struct virtio_scsi_dev *svdev = ch->svdev;
1012 struct virtio_dev *vdev = &svdev->vdev;
1022 struct virtio_scsi_dev *svdev = base->svdev;
1029 base->svdev->scan_ctx = NULL;
1043 TAILQ_FOREACH(disk, &svdev->luns, link) {
1315 virtio_scsi_dev_add_tgt(struct virtio_scsi_dev *svdev, struct virtio_scsi_scan_info *info)
1321 TAILQ_FOREACH(disk, &svdev->luns, link) {
1330 svdev->vdev.name, info->target, info->block_size, info->num_blocks);
1340 disk->svdev = svdev;
1344 bdev->name = spdk_sprintf_alloc("%st%"PRIu8, svdev->vdev.name, info->target);
1374 TAILQ_INSERT_TAIL(&svdev->luns, disk, link);
1403 rc = virtio_scsi_dev_add_tgt(base->svdev, &base->info);
1426 rc = virtio_scsi_dev_add_tgt(base->svdev, &base->info);
1521 disk = virtio_scsi_dev_get_disk_by_id(base->svdev,
1552 _virtio_scsi_dev_scan_init(struct virtio_scsi_dev *svdev)
1560 io_ch = spdk_get_io_channel(svdev);
1572 base->svdev = svdev;
1576 svdev->scan_ctx = base;
1606 virtio_scsi_dev_scan(struct virtio_scsi_dev *svdev, bdev_virtio_create_cb cb_fn,
1613 if (svdev->scan_ctx) {
1614 if (svdev->scan_ctx->full_scan) {
1621 TAILQ_FOREACH_SAFE(tgt, &svdev->scan_ctx->scan_queue, tailq, next_tgt) {
1622 TAILQ_REMOVE(&svdev->scan_ctx->scan_queue, tgt, tailq);
1626 svdev->scan_ctx->cb_fn = cb_fn;
1627 svdev->scan_ctx->cb_arg = cb_arg;
1628 svdev->scan_ctx->restart = true;
1632 rc = _virtio_scsi_dev_scan_init(svdev);
1637 base = svdev->scan_ctx;
1647 virtio_scsi_dev_scan_tgt(struct virtio_scsi_dev *svdev, uint8_t target)
1653 base = svdev->scan_ctx;
1666 rc = _virtio_scsi_dev_scan_init(svdev);
1671 base = svdev->scan_ctx;
1686 struct virtio_scsi_dev *svdev = io_device;
1687 struct virtio_dev *vdev = &svdev->vdev;
1692 assert(spdk_ring_count(svdev->ctrlq_ring) == 0);
1693 spdk_ring_free(svdev->ctrlq_ring);
1694 spdk_poller_unregister(&svdev->mgmt_poller);
1703 TAILQ_REMOVE(&g_virtio_scsi_devs, svdev, tailq);
1706 remove_cb = svdev->remove_cb;
1707 remove_ctx = svdev->remove_ctx;
1708 spdk_free(svdev->eventq_ios);
1709 free(svdev);
1725 struct virtio_scsi_dev *svdev = io_device;
1728 thread = virtio_dev_queue_get_thread(&svdev->vdev, VIRTIO_SCSI_CONTROLQ);
1733 virtio_scsi_dev_remove(struct virtio_scsi_dev *svdev,
1739 if (svdev->removed) {
1746 svdev->remove_cb = cb_fn;
1747 svdev->remove_ctx = cb_arg;
1748 svdev->removed = true;
1750 if (svdev->scan_ctx) {
1755 TAILQ_FOREACH_SAFE(disk, &svdev->luns, link, disk_tmp) {
1763 spdk_io_device_unregister(svdev, virtio_scsi_dev_unregister_cb);
1770 struct virtio_scsi_dev *svdev, *next;
1782 TAILQ_FOREACH_SAFE(svdev, &g_virtio_scsi_devs, tailq, next) {
1783 virtio_scsi_dev_remove(svdev, NULL, NULL);
1793 struct virtio_scsi_dev *svdev;
1796 svdev = virtio_user_scsi_dev_create(base_name, path, num_queues, queue_size);
1797 if (svdev == NULL) {
1801 rc = virtio_scsi_dev_scan(svdev, cb_fn, cb_arg);
1803 virtio_scsi_dev_remove(svdev, NULL, NULL);
1813 struct virtio_scsi_dev *svdev;
1817 svdev = calloc(1, sizeof(*svdev));
1818 if (svdev == NULL) {
1823 rc = virtio_vfio_user_dev_init(&svdev->vdev, base_name, path);
1826 free(svdev);
1830 rc = virtio_dev_read_dev_config(&svdev->vdev, offsetof(struct virtio_scsi_config, num_queues),
1834 virtio_dev_destruct(&svdev->vdev);
1835 free(svdev);
1841 virtio_dev_destruct(&svdev->vdev);
1842 free(svdev);
1846 rc = virtio_scsi_dev_init(svdev, num_queues, VIRTIO_SCSI_DEV_SUPPORTED_FEATURES);
1848 virtio_dev_destruct(&svdev->vdev);
1849 free(svdev);
1853 rc = virtio_scsi_dev_scan(svdev, cb_fn, cb_arg);
1855 virtio_scsi_dev_remove(svdev, NULL, NULL);
1870 struct virtio_scsi_dev *svdev;
1874 svdev = virtio_pci_scsi_dev_create(create_ctx->name, pci_ctx);
1875 if (svdev == NULL) {
1879 rc = virtio_scsi_dev_scan(svdev, create_ctx->cb_fn, create_ctx->cb_arg);
1881 svdev->vdev.ctx = NULL;
1882 virtio_scsi_dev_remove(svdev, NULL, NULL);
1905 struct virtio_scsi_dev *svdev;
1908 TAILQ_FOREACH(svdev, &g_virtio_scsi_devs, tailq) {
1909 if (strcmp(svdev->vdev.name, name) == 0) {
1914 if (svdev == NULL) {
1920 virtio_scsi_dev_remove(svdev, cb_fn, cb_arg);
1929 struct virtio_scsi_dev *svdev;
1934 TAILQ_FOREACH(svdev, &g_virtio_scsi_devs, tailq) {
1937 spdk_json_write_named_string(w, "name", svdev->vdev.name);
1939 virtio_dev_dump_json_info(&svdev->vdev, w);