Lines Matching refs:stor_device
555 struct storvsc_device *stor_device;
557 stor_device = hv_get_drvdata(device);
559 if (stor_device && stor_device->destroy)
560 stor_device = NULL;
562 return stor_device;
577 struct storvsc_device *stor_device;
579 stor_device = hv_get_drvdata(device);
581 if (!stor_device)
589 if (stor_device->destroy &&
590 (atomic_read(&stor_device->num_outstanding_req) == 0))
591 stor_device = NULL;
594 return stor_device;
601 struct storvsc_device *stor_device;
611 stor_device = get_out_stor_device(device);
612 if (!stor_device)
616 spin_lock_irqsave(&stor_device->lock, flags);
639 WRITE_ONCE(stor_device->stor_chns[old], cur_chn);
641 cpumask_clear_cpu(old, &stor_device->alloced_cpus);
645 if (stor_device->stor_chns[cpu] && !cpumask_test_cpu(
646 cpu, &stor_device->alloced_cpus))
647 WRITE_ONCE(stor_device->stor_chns[cpu], NULL);
650 WRITE_ONCE(stor_device->stor_chns[new], channel);
651 cpumask_set_cpu(new, &stor_device->alloced_cpus);
653 spin_unlock_irqrestore(&stor_device->lock, flags);
677 struct storvsc_device *stor_device;
681 stor_device = get_out_stor_device(device);
682 if (!stor_device)
706 stor_device->stor_chns[new_sc->target_cpu] = new_sc;
707 cpumask_set_cpu(new_sc->target_cpu, &stor_device->alloced_cpus);
713 struct storvsc_device *stor_device;
730 stor_device = get_out_stor_device(device);
731 if (!stor_device)
734 stor_device->num_sc = num_sc;
735 request = &stor_device->init_request;
783 static void cache_wwn(struct storvsc_device *stor_device,
790 stor_device->node_name =
792 stor_device->port_name =
795 stor_device->node_name =
797 stor_device->port_name =
807 struct storvsc_device *stor_device;
811 stor_device = get_out_stor_device(device);
812 if (!stor_device)
844 struct storvsc_device *stor_device;
851 stor_device = get_out_stor_device(device);
852 if (!stor_device)
855 request = &stor_device->init_request;
925 stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void *),
927 if (stor_device->stor_chns == NULL)
932 stor_device->stor_chns[device->channel->target_cpu] = device->channel;
934 &stor_device->alloced_cpus);
940 stor_device->max_transfer_bytes =
958 cache_wwn(stor_device, vstor_packet);
1127 static void storvsc_on_io_completion(struct storvsc_device *stor_device,
1132 struct hv_device *device = stor_device->device;
1193 storvsc_command_completion(request, stor_device);
1195 if (atomic_dec_and_test(&stor_device->num_outstanding_req) &&
1196 stor_device->drain_notify)
1197 wake_up(&stor_device->waiting_to_drain);
1200 static void storvsc_on_receive(struct storvsc_device *stor_device,
1207 storvsc_on_io_completion(stor_device, vstor_packet, request);
1212 host_dev = shost_priv(stor_device->host);
1218 cache_wwn(stor_device, vstor_packet);
1220 fc_host_node_name(stor_device->host) = stor_device->node_name;
1221 fc_host_port_name(stor_device->host) = stor_device->port_name;
1234 struct storvsc_device *stor_device;
1243 stor_device = get_in_stor_device(device);
1244 if (!stor_device)
1247 shost = stor_device->host;
1270 request = &stor_device->init_request;
1272 request = &stor_device->reset_request;
1311 storvsc_on_receive(stor_device, packet, request);
1349 struct storvsc_device *stor_device;
1351 stor_device = hv_get_drvdata(device);
1353 stor_device->destroy = true;
1364 storvsc_wait_to_drain(stor_device);
1378 kfree(stor_device->stor_chns);
1379 kfree(stor_device);
1383 static struct vmbus_channel *get_og_chn(struct storvsc_device *stor_device,
1391 if (stor_device->num_sc == 0) {
1392 stor_device->stor_chns[q_num] = stor_device->device->channel;
1393 return stor_device->device->channel;
1408 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1413 stor_device->stor_chns[q_num] = stor_device->device->channel;
1414 return stor_device->device->channel;
1421 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1429 stor_device->stor_chns[q_num] = stor_device->stor_chns[tgt_cpu];
1431 return stor_device->stor_chns[q_num];
1438 struct storvsc_device *stor_device;
1447 stor_device = get_out_stor_device(device);
1449 if (!stor_device)
1458 outgoing_channel = READ_ONCE(stor_device->stor_chns[q_num]);
1467 &stor_device->alloced_cpus, q_num + 1) {
1473 stor_device->stor_chns[tgt_cpu]);
1498 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1502 stor_device->stor_chns[tgt_cpu]);
1514 spin_lock_irqsave(&stor_device->lock, flags);
1515 outgoing_channel = stor_device->stor_chns[q_num];
1517 spin_unlock_irqrestore(&stor_device->lock, flags);
1520 outgoing_channel = get_og_chn(stor_device, q_num);
1521 spin_unlock_irqrestore(&stor_device->lock, flags);
1556 atomic_inc(&stor_device->num_outstanding_req);
1633 struct storvsc_device *stor_device;
1638 stor_device = get_out_stor_device(device);
1639 if (!stor_device)
1642 request = &stor_device->reset_request;
1650 vstor_packet->vm_srb.path_id = stor_device->path_id;
1673 storvsc_wait_to_drain(stor_device);
1932 struct storvsc_device *stor_device;
1962 stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);
1963 if (!stor_device) {
1968 stor_device->destroy = false;
1969 init_waitqueue_head(&stor_device->waiting_to_drain);
1970 stor_device->device = device;
1971 stor_device->host = host;
1972 spin_lock_init(&stor_device->lock);
1973 hv_set_drvdata(device, stor_device);
1976 stor_device->port_number = host->host_no;
1981 host_dev->path = stor_device->path_id;
1982 host_dev->target = stor_device->target_id;
2013 max_xfer_bytes = round_down(stor_device->max_transfer_bytes, HV_HYP_PAGE_SIZE);
2081 fc_host_node_name(host) = stor_device->node_name;
2082 fc_host_port_name(host) = stor_device->port_name;
2083 stor_device->rport = fc_remote_port_add(host, 0, &ids);
2084 if (!stor_device->rport) {
2102 * this call also frees up the stor_device; hence the jump around
2109 kfree(stor_device->stor_chns);
2110 kfree(stor_device);
2128 struct storvsc_device *stor_device = hv_get_drvdata(dev);
2129 struct Scsi_Host *host = stor_device->host;
2134 fc_remote_port_delete(stor_device->rport);
2146 struct storvsc_device *stor_device = hv_get_drvdata(hv_dev);
2147 struct Scsi_Host *host = stor_device->host;
2150 storvsc_wait_to_drain(stor_device);
2156 kfree(stor_device->stor_chns);
2157 stor_device->stor_chns = NULL;
2159 cpumask_clear(&stor_device->alloced_cpus);