Lines Matching refs:stor_device
591 struct storvsc_device *stor_device;
593 stor_device = hv_get_drvdata(device);
595 if (stor_device && stor_device->destroy)
596 stor_device = NULL;
598 return stor_device;
613 struct storvsc_device *stor_device;
615 stor_device = hv_get_drvdata(device);
617 if (!stor_device)
625 if (stor_device->destroy &&
626 (atomic_read(&stor_device->num_outstanding_req) == 0))
627 stor_device = NULL;
630 return stor_device;
637 struct storvsc_device *stor_device;
647 stor_device = get_out_stor_device(device);
648 if (!stor_device)
652 spin_lock_irqsave(&stor_device->lock, flags);
675 WRITE_ONCE(stor_device->stor_chns[old], cur_chn);
677 cpumask_clear_cpu(old, &stor_device->alloced_cpus);
681 if (stor_device->stor_chns[cpu] && !cpumask_test_cpu(
682 cpu, &stor_device->alloced_cpus))
683 WRITE_ONCE(stor_device->stor_chns[cpu], NULL);
686 WRITE_ONCE(stor_device->stor_chns[new], channel);
687 cpumask_set_cpu(new, &stor_device->alloced_cpus);
689 spin_unlock_irqrestore(&stor_device->lock, flags);
696 struct storvsc_device *stor_device;
700 stor_device = get_out_stor_device(device);
701 if (!stor_device)
722 stor_device->stor_chns[new_sc->target_cpu] = new_sc;
723 cpumask_set_cpu(new_sc->target_cpu, &stor_device->alloced_cpus);
729 struct storvsc_device *stor_device;
746 stor_device = get_out_stor_device(device);
747 if (!stor_device)
750 stor_device->num_sc = num_sc;
751 request = &stor_device->init_request;
800 static void cache_wwn(struct storvsc_device *stor_device,
807 stor_device->node_name =
809 stor_device->port_name =
812 stor_device->node_name =
814 stor_device->port_name =
857 struct storvsc_device *stor_device;
864 stor_device = get_out_stor_device(device);
865 if (!stor_device)
868 request = &stor_device->init_request;
944 stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void *),
946 if (stor_device->stor_chns == NULL)
951 stor_device->stor_chns[device->channel->target_cpu] = device->channel;
953 &stor_device->alloced_cpus);
960 stor_device->max_transfer_bytes =
978 cache_wwn(stor_device, vstor_packet);
1142 static void storvsc_on_io_completion(struct storvsc_device *stor_device,
1147 struct hv_device *device = stor_device->device;
1208 storvsc_command_completion(request, stor_device);
1210 if (atomic_dec_and_test(&stor_device->num_outstanding_req) &&
1211 stor_device->drain_notify)
1212 wake_up(&stor_device->waiting_to_drain);
1217 static void storvsc_on_receive(struct storvsc_device *stor_device,
1224 storvsc_on_io_completion(stor_device, vstor_packet, request);
1229 host_dev = shost_priv(stor_device->host);
1235 cache_wwn(stor_device, vstor_packet);
1237 fc_host_node_name(stor_device->host) = stor_device->node_name;
1238 fc_host_port_name(stor_device->host) = stor_device->port_name;
1251 struct storvsc_device *stor_device;
1258 stor_device = get_in_stor_device(device);
1259 if (!stor_device)
1269 if (request == &stor_device->init_request ||
1270 request == &stor_device->reset_request) {
1275 storvsc_on_receive(stor_device, packet, request);
1305 struct storvsc_device *stor_device;
1307 stor_device = hv_get_drvdata(device);
1309 stor_device->destroy = true;
1320 storvsc_wait_to_drain(stor_device);
1334 kfree(stor_device->stor_chns);
1335 kfree(stor_device);
1339 static struct vmbus_channel *get_og_chn(struct storvsc_device *stor_device,
1347 if (stor_device->num_sc == 0) {
1348 stor_device->stor_chns[q_num] = stor_device->device->channel;
1349 return stor_device->device->channel;
1364 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1369 stor_device->stor_chns[q_num] = stor_device->device->channel;
1370 return stor_device->device->channel;
1377 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1385 stor_device->stor_chns[q_num] = stor_device->stor_chns[tgt_cpu];
1387 return stor_device->stor_chns[q_num];
1394 struct storvsc_device *stor_device;
1403 stor_device = get_out_stor_device(device);
1405 if (!stor_device)
1414 outgoing_channel = READ_ONCE(stor_device->stor_chns[q_num]);
1423 &stor_device->alloced_cpus, q_num + 1) {
1429 stor_device->stor_chns[tgt_cpu]);
1454 for_each_cpu(tgt_cpu, &stor_device->alloced_cpus) {
1458 stor_device->stor_chns[tgt_cpu]);
1470 spin_lock_irqsave(&stor_device->lock, flags);
1471 outgoing_channel = stor_device->stor_chns[q_num];
1473 spin_unlock_irqrestore(&stor_device->lock, flags);
1476 outgoing_channel = get_og_chn(stor_device, q_num);
1477 spin_unlock_irqrestore(&stor_device->lock, flags);
1515 atomic_inc(&stor_device->num_outstanding_req);
1592 struct storvsc_device *stor_device;
1598 stor_device = get_out_stor_device(device);
1599 if (!stor_device)
1602 request = &stor_device->reset_request;
1610 vstor_packet->vm_srb.path_id = stor_device->path_id;
1615 (unsigned long)&stor_device->reset_request,
1634 storvsc_wait_to_drain(stor_device);
1903 struct storvsc_device *stor_device;
1950 stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);
1951 if (!stor_device) {
1956 stor_device->destroy = false;
1957 init_waitqueue_head(&stor_device->waiting_to_drain);
1958 stor_device->device = device;
1959 stor_device->host = host;
1960 spin_lock_init(&stor_device->lock);
1961 hv_set_drvdata(device, stor_device);
1963 stor_device->port_number = host->host_no;
1968 host_dev->path = stor_device->path_id;
1969 host_dev->target = stor_device->target_id;
2000 host->sg_tablesize = (stor_device->max_transfer_bytes >> PAGE_SHIFT);
2040 fc_host_node_name(host) = stor_device->node_name;
2041 fc_host_port_name(host) = stor_device->port_name;
2042 stor_device->rport = fc_remote_port_add(host, 0, &ids);
2043 if (!stor_device->rport) {
2061 * this call also frees up the stor_device; hence the jump around
2068 kfree(stor_device->stor_chns);
2069 kfree(stor_device);
2087 struct storvsc_device *stor_device = hv_get_drvdata(dev);
2088 struct Scsi_Host *host = stor_device->host;
2093 fc_remote_port_delete(stor_device->rport);
2107 struct storvsc_device *stor_device = hv_get_drvdata(hv_dev);
2108 struct Scsi_Host *host = stor_device->host;
2111 storvsc_wait_to_drain(stor_device);
2117 kfree(stor_device->stor_chns);
2118 stor_device->stor_chns = NULL;
2120 cpumask_clear(&stor_device->alloced_cpus);