Lines Matching refs:vdev

39 spdk_vhost_dev_next(struct spdk_vhost_dev *vdev)
41 if (vdev == NULL) {
45 return RB_NEXT(vhost_dev_name_tree, &g_vhost_devices, vdev);
116 vhost_dev_register(struct spdk_vhost_dev *vdev, const char *name, const char *mask_str,
123 assert(vdev);
134 vdev->use_default_cpumask = false;
136 vdev->use_default_cpumask = true;
146 vdev->name = strdup(name);
147 if (vdev->name == NULL) {
152 vdev->backend = backend;
153 if (vdev->backend->type == VHOST_BACKEND_SCSI) {
154 rc = vhost_user_dev_create(vdev, name, &cpumask, user_backend, delay);
158 rc = virtio_blk_construct_ctrlr(vdev, name, &cpumask, params, user_backend);
161 free(vdev->name);
166 RB_INSERT(vhost_dev_name_tree, &g_vhost_devices, vdev);
169 SPDK_INFOLOG(vhost, "Controller %s: new controller added\n", vdev->name);
174 vhost_dev_unregister(struct spdk_vhost_dev *vdev)
179 if (vdev->backend->type == VHOST_BACKEND_SCSI) {
180 rc = vhost_user_dev_unregister(vdev);
182 rc = virtio_blk_destroy_ctrlr(vdev);
189 SPDK_INFOLOG(vhost, "Controller %s: removed\n", vdev->name);
191 free(vdev->name);
193 RB_REMOVE(vhost_dev_name_tree, &g_vhost_devices, vdev);
203 spdk_vhost_dev_get_name(struct spdk_vhost_dev *vdev)
205 assert(vdev != NULL);
206 return vdev->name;
210 spdk_vhost_dev_get_cpumask(struct spdk_vhost_dev *vdev)
212 assert(vdev != NULL);
213 return spdk_thread_get_cpumask(vdev->thread);
217 vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
219 assert(vdev->backend->dump_info_json != NULL);
220 vdev->backend->dump_info_json(vdev, w);
224 spdk_vhost_dev_remove(struct spdk_vhost_dev *vdev)
226 return vdev->backend->remove_device(vdev);
230 spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us,
233 assert(vdev->backend->set_coalescing != NULL);
234 return vdev->backend->set_coalescing(vdev, delay_base_us, iops_threshold);
238 spdk_vhost_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us,
241 assert(vdev->backend->get_coalescing != NULL);
242 vdev->backend->get_coalescing(vdev, delay_base_us, iops_threshold);
285 struct spdk_vhost_dev *vdev, *tmp;
292 vdev = spdk_vhost_dev_next(NULL);
293 while (vdev != NULL) {
294 tmp = spdk_vhost_dev_next(vdev);
295 spdk_vhost_dev_remove(vdev);
297 vdev = tmp;
352 vhost_user_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
357 vdev->backend->write_config_json(vdev, w);
359 spdk_vhost_get_coalescing(vdev, &delay_base_us, &iops_threshold);
365 spdk_json_write_named_string(w, "ctrlr", vdev->name);
377 struct spdk_vhost_dev *vdev;
382 for (vdev = spdk_vhost_dev_next(NULL); vdev != NULL;
383 vdev = spdk_vhost_dev_next(vdev)) {
384 if (vdev->backend->type == VHOST_BACKEND_SCSI) {
385 vhost_user_config_json(vdev, w);
416 struct spdk_vhost_dev *vdev;
421 for (vdev = spdk_vhost_dev_next(NULL); vdev != NULL;
422 vdev = spdk_vhost_dev_next(vdev)) {
423 if (vdev->backend->type == VHOST_BACKEND_BLK) {
424 vhost_user_config_json(vdev, w);