Lines Matching refs:stor_device

563 	struct storvsc_device *stor_device;  in get_out_stor_device()  local
565 stor_device = hv_get_drvdata(device); in get_out_stor_device()
567 if (stor_device && stor_device->destroy) in get_out_stor_device()
568 stor_device = NULL; in get_out_stor_device()
570 return stor_device; in get_out_stor_device()
585 struct storvsc_device *stor_device; in get_in_stor_device() local
587 stor_device = hv_get_drvdata(device); in get_in_stor_device()
589 if (!stor_device) in get_in_stor_device()
597 if (stor_device->destroy && in get_in_stor_device()
598 (atomic_read(&stor_device->num_outstanding_req) == 0)) in get_in_stor_device()
599 stor_device = NULL; in get_in_stor_device()
602 return stor_device; in get_in_stor_device()
609 struct storvsc_device *stor_device; in storvsc_change_target_cpu() local
619 stor_device = get_out_stor_device(device); in storvsc_change_target_cpu()
620 if (!stor_device) in storvsc_change_target_cpu()
624 spin_lock_irqsave(&stor_device->lock, flags); in storvsc_change_target_cpu()
647 WRITE_ONCE(stor_device->stor_chns[old], cur_chn); in storvsc_change_target_cpu()
649 cpumask_clear_cpu(old, &stor_device->alloced_cpus); in storvsc_change_target_cpu()
653 if (stor_device->stor_chns[cpu] && !cpumask_test_cpu( in storvsc_change_target_cpu()
654 cpu, &stor_device->alloced_cpus)) in storvsc_change_target_cpu()
655 WRITE_ONCE(stor_device->stor_chns[cpu], NULL); in storvsc_change_target_cpu()
658 WRITE_ONCE(stor_device->stor_chns[new], channel); in storvsc_change_target_cpu()
659 cpumask_set_cpu(new, &stor_device->alloced_cpus); in storvsc_change_target_cpu()
661 spin_unlock_irqrestore(&stor_device->lock, flags); in storvsc_change_target_cpu()
685 struct storvsc_device *stor_device; in handle_sc_creation() local
689 stor_device = get_out_stor_device(device); in handle_sc_creation()
690 if (!stor_device) in handle_sc_creation()
714 stor_device->stor_chns[new_sc->target_cpu] = new_sc; in handle_sc_creation()
715 cpumask_set_cpu(new_sc->target_cpu, &stor_device->alloced_cpus); in handle_sc_creation()
721 struct storvsc_device *stor_device; in handle_multichannel_storage() local
738 stor_device = get_out_stor_device(device); in handle_multichannel_storage()
739 if (!stor_device) in handle_multichannel_storage()
742 stor_device->num_sc = num_sc; in handle_multichannel_storage()
743 request = &stor_device->init_request; in handle_multichannel_storage()
791 static void cache_wwn(struct storvsc_device *stor_device, in cache_wwn() argument
798 stor_device->node_name = in cache_wwn()
800 stor_device->port_name = in cache_wwn()
803 stor_device->node_name = in cache_wwn()
805 stor_device->port_name = in cache_wwn()
815 struct storvsc_device *stor_device; in storvsc_execute_vstor_op() local
819 stor_device = get_out_stor_device(device); in storvsc_execute_vstor_op()
820 if (!stor_device) in storvsc_execute_vstor_op()
852 struct storvsc_device *stor_device; in storvsc_channel_init() local
859 stor_device = get_out_stor_device(device); in storvsc_channel_init()
860 if (!stor_device) in storvsc_channel_init()
863 request = &stor_device->init_request; in storvsc_channel_init()
932 stor_device->stor_chns = kcalloc(nr_cpu_ids, sizeof(void *), in storvsc_channel_init()
934 if (stor_device->stor_chns == NULL) in storvsc_channel_init()
939 stor_device->stor_chns[device->channel->target_cpu] = device->channel; in storvsc_channel_init()
941 &stor_device->alloced_cpus); in storvsc_channel_init()
947 stor_device->max_transfer_bytes = in storvsc_channel_init()
965 cache_wwn(stor_device, vstor_packet); in storvsc_channel_init()
1134 static void storvsc_on_io_completion(struct storvsc_device *stor_device, in storvsc_on_io_completion() argument
1139 struct hv_device *device = stor_device->device; in storvsc_on_io_completion()
1203 storvsc_command_completion(request, stor_device); in storvsc_on_io_completion()
1205 if (atomic_dec_and_test(&stor_device->num_outstanding_req) && in storvsc_on_io_completion()
1206 stor_device->drain_notify) in storvsc_on_io_completion()
1207 wake_up(&stor_device->waiting_to_drain); in storvsc_on_io_completion()
1210 static void storvsc_on_receive(struct storvsc_device *stor_device, in storvsc_on_receive() argument
1217 storvsc_on_io_completion(stor_device, vstor_packet, request); in storvsc_on_receive()
1222 host_dev = shost_priv(stor_device->host); in storvsc_on_receive()
1228 cache_wwn(stor_device, vstor_packet); in storvsc_on_receive()
1230 fc_host_node_name(stor_device->host) = stor_device->node_name; in storvsc_on_receive()
1231 fc_host_port_name(stor_device->host) = stor_device->port_name; in storvsc_on_receive()
1244 struct storvsc_device *stor_device; in storvsc_on_channel_callback() local
1253 stor_device = get_in_stor_device(device); in storvsc_on_channel_callback()
1254 if (!stor_device) in storvsc_on_channel_callback()
1257 shost = stor_device->host; in storvsc_on_channel_callback()
1280 request = &stor_device->init_request; in storvsc_on_channel_callback()
1282 request = &stor_device->reset_request; in storvsc_on_channel_callback()
1321 storvsc_on_receive(stor_device, packet, request); in storvsc_on_channel_callback()
1361 struct storvsc_device *stor_device; in storvsc_dev_remove() local
1363 stor_device = hv_get_drvdata(device); in storvsc_dev_remove()
1365 stor_device->destroy = true; in storvsc_dev_remove()
1376 storvsc_wait_to_drain(stor_device); in storvsc_dev_remove()
1390 kfree(stor_device->stor_chns); in storvsc_dev_remove()
1391 kfree(stor_device); in storvsc_dev_remove()
1395 static struct vmbus_channel *get_og_chn(struct storvsc_device *stor_device, in get_og_chn() argument
1403 if (stor_device->num_sc == 0) { in get_og_chn()
1404 stor_device->stor_chns[q_num] = stor_device->device->channel; in get_og_chn()
1405 return stor_device->device->channel; in get_og_chn()
1420 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) { in get_og_chn()
1425 stor_device->stor_chns[q_num] = stor_device->device->channel; in get_og_chn()
1426 return stor_device->device->channel; in get_og_chn()
1433 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) { in get_og_chn()
1441 stor_device->stor_chns[q_num] = stor_device->stor_chns[tgt_cpu]; in get_og_chn()
1443 return stor_device->stor_chns[q_num]; in get_og_chn()
1450 struct storvsc_device *stor_device; in storvsc_do_io() local
1459 stor_device = get_out_stor_device(device); in storvsc_do_io()
1461 if (!stor_device) in storvsc_do_io()
1470 outgoing_channel = READ_ONCE(stor_device->stor_chns[q_num]); in storvsc_do_io()
1479 &stor_device->alloced_cpus, q_num + 1) { in storvsc_do_io()
1485 stor_device->stor_chns[tgt_cpu]); in storvsc_do_io()
1510 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) { in storvsc_do_io()
1514 stor_device->stor_chns[tgt_cpu]); in storvsc_do_io()
1526 spin_lock_irqsave(&stor_device->lock, flags); in storvsc_do_io()
1527 outgoing_channel = stor_device->stor_chns[q_num]; in storvsc_do_io()
1529 spin_unlock_irqrestore(&stor_device->lock, flags); in storvsc_do_io()
1532 outgoing_channel = get_og_chn(stor_device, q_num); in storvsc_do_io()
1533 spin_unlock_irqrestore(&stor_device->lock, flags); in storvsc_do_io()
1568 atomic_inc(&stor_device->num_outstanding_req); in storvsc_do_io()
1646 struct storvsc_device *stor_device; in storvsc_host_reset_handler() local
1651 stor_device = get_out_stor_device(device); in storvsc_host_reset_handler()
1652 if (!stor_device) in storvsc_host_reset_handler()
1655 request = &stor_device->reset_request; in storvsc_host_reset_handler()
1663 vstor_packet->vm_srb.path_id = stor_device->path_id; in storvsc_host_reset_handler()
1686 storvsc_wait_to_drain(stor_device); in storvsc_host_reset_handler()
1947 struct storvsc_device *stor_device; in storvsc_probe() local
1977 stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); in storvsc_probe()
1978 if (!stor_device) { in storvsc_probe()
1983 stor_device->destroy = false; in storvsc_probe()
1984 init_waitqueue_head(&stor_device->waiting_to_drain); in storvsc_probe()
1985 stor_device->device = device; in storvsc_probe()
1986 stor_device->host = host; in storvsc_probe()
1987 spin_lock_init(&stor_device->lock); in storvsc_probe()
1988 hv_set_drvdata(device, stor_device); in storvsc_probe()
1991 stor_device->port_number = host->host_no; in storvsc_probe()
1996 host_dev->path = stor_device->path_id; in storvsc_probe()
1997 host_dev->target = stor_device->target_id; in storvsc_probe()
2028 max_xfer_bytes = round_down(stor_device->max_transfer_bytes, HV_HYP_PAGE_SIZE); in storvsc_probe()
2096 fc_host_node_name(host) = stor_device->node_name; in storvsc_probe()
2097 fc_host_port_name(host) = stor_device->port_name; in storvsc_probe()
2098 stor_device->rport = fc_remote_port_add(host, 0, &ids); in storvsc_probe()
2099 if (!stor_device->rport) { in storvsc_probe()
2124 kfree(stor_device->stor_chns); in storvsc_probe()
2125 kfree(stor_device); in storvsc_probe()
2143 struct storvsc_device *stor_device = hv_get_drvdata(dev); in storvsc_remove() local
2144 struct Scsi_Host *host = stor_device->host; in storvsc_remove()
2149 fc_remote_port_delete(stor_device->rport); in storvsc_remove()
2161 struct storvsc_device *stor_device = hv_get_drvdata(hv_dev); in storvsc_suspend() local
2162 struct Scsi_Host *host = stor_device->host; in storvsc_suspend()
2165 storvsc_wait_to_drain(stor_device); in storvsc_suspend()
2171 kfree(stor_device->stor_chns); in storvsc_suspend()
2172 stor_device->stor_chns = NULL; in storvsc_suspend()
2174 cpumask_clear(&stor_device->alloced_cpus); in storvsc_suspend()