ibmvfc.c (b10778a00d40b3d9fdaaf5891e802794781ff71c) | ibmvfc.c (c40ecc12cfdb630332198a04e2832ae8218a61f1) |
---|---|
1/* 2 * ibmvfc.c -- driver for IBM Power Virtual Fibre Channel Adapter 3 * 4 * Written By: Brian King <brking@linux.vnet.ibm.com>, IBM Corporation 5 * 6 * Copyright (C) IBM Corporation, 2008 7 * 8 * This program is free software; you can redistribute it and/or modify --- 1629 unchanged lines hidden (view full) --- 1638 vfc_cmd->payload_len = cpu_to_be32(sizeof(vfc_cmd->iu)); 1639 vfc_cmd->resp_len = cpu_to_be32(sizeof(vfc_cmd->rsp)); 1640 vfc_cmd->cancel_key = cpu_to_be32((unsigned long)cmnd->device->hostdata); 1641 vfc_cmd->tgt_scsi_id = cpu_to_be64(rport->port_id); 1642 vfc_cmd->iu.xfer_len = cpu_to_be32(scsi_bufflen(cmnd)); 1643 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); 1644 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); 1645 | 1/* 2 * ibmvfc.c -- driver for IBM Power Virtual Fibre Channel Adapter 3 * 4 * Written By: Brian King <brking@linux.vnet.ibm.com>, IBM Corporation 5 * 6 * Copyright (C) IBM Corporation, 2008 7 * 8 * This program is free software; you can redistribute it and/or modify --- 1629 unchanged lines hidden (view full) --- 1638 vfc_cmd->payload_len = cpu_to_be32(sizeof(vfc_cmd->iu)); 1639 vfc_cmd->resp_len = cpu_to_be32(sizeof(vfc_cmd->rsp)); 1640 vfc_cmd->cancel_key = cpu_to_be32((unsigned long)cmnd->device->hostdata); 1641 vfc_cmd->tgt_scsi_id = cpu_to_be64(rport->port_id); 1642 vfc_cmd->iu.xfer_len = cpu_to_be32(scsi_bufflen(cmnd)); 1643 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); 1644 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); 1645 |
1646 if (scsi_populate_tag_msg(cmnd, tag)) { 1647 vfc_cmd->task_tag = cpu_to_be64(tag[1]); 1648 switch (tag[0]) { 1649 case MSG_SIMPLE_TAG: 1650 vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK; 1651 break; 1652 case MSG_HEAD_TAG: 1653 vfc_cmd->iu.pri_task_attr = IBMVFC_HEAD_OF_QUEUE; 1654 break; 1655 case MSG_ORDERED_TAG: 1656 vfc_cmd->iu.pri_task_attr = IBMVFC_ORDERED_TASK; 1657 break; 1658 }; | 1646 if (cmnd->flags & SCMD_TAGGED) { 1647 vfc_cmd->task_tag = cpu_to_be64(cmnd->tag); 1648 vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK; |
1659 } 1660 1661 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) 1662 return ibmvfc_send_event(evt, vhost, 0); 1663 1664 ibmvfc_free_event(evt); 1665 if (rc == -ENOMEM) 1666 return SCSI_MLQUEUE_HOST_BUSY; --- 1225 unchanged lines hidden (view full) --- 2892static int ibmvfc_slave_configure(struct scsi_device *sdev) 2893{ 2894 struct Scsi_Host *shost = sdev->host; 2895 unsigned long flags = 0; 2896 2897 spin_lock_irqsave(shost->host_lock, flags); 2898 if (sdev->type == TYPE_DISK) 2899 sdev->allow_restart = 1; | 1649 } 1650 1651 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) 1652 return ibmvfc_send_event(evt, vhost, 0); 1653 1654 ibmvfc_free_event(evt); 1655 if (rc == -ENOMEM) 1656 return SCSI_MLQUEUE_HOST_BUSY; --- 1225 unchanged lines hidden (view full) --- 2882static int ibmvfc_slave_configure(struct scsi_device *sdev) 2883{ 2884 struct Scsi_Host *shost = sdev->host; 2885 unsigned long flags = 0; 2886 2887 spin_lock_irqsave(shost->host_lock, flags); 2888 if (sdev->type == TYPE_DISK) 2889 sdev->allow_restart = 1; |
2900 2901 if (sdev->tagged_supported) { 2902 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); 2903 scsi_activate_tcq(sdev, sdev->queue_depth); 2904 } else 2905 scsi_deactivate_tcq(sdev, sdev->queue_depth); | |
2906 spin_unlock_irqrestore(shost->host_lock, flags); 2907 return 0; 2908} 2909 2910/** 2911 * ibmvfc_change_queue_depth - Change the device's queue depth 2912 * @sdev: scsi device struct 2913 * @qdepth: depth to set --- 6 unchanged lines hidden (view full) --- 2920 int reason) 2921{ 2922 if (reason != SCSI_QDEPTH_DEFAULT) 2923 return -EOPNOTSUPP; 2924 2925 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) 2926 qdepth = IBMVFC_MAX_CMDS_PER_LUN; 2927 | 2890 spin_unlock_irqrestore(shost->host_lock, flags); 2891 return 0; 2892} 2893 2894/** 2895 * ibmvfc_change_queue_depth - Change the device's queue depth 2896 * @sdev: scsi device struct 2897 * @qdepth: depth to set --- 6 unchanged lines hidden (view full) --- 2904 int reason) 2905{ 2906 if (reason != SCSI_QDEPTH_DEFAULT) 2907 return -EOPNOTSUPP; 2908 2909 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) 2910 qdepth = IBMVFC_MAX_CMDS_PER_LUN; 2911 |
2928 scsi_adjust_queue_depth(sdev, 0, qdepth); | 2912 scsi_adjust_queue_depth(sdev, qdepth); |
2929 return sdev->queue_depth; 2930} 2931 | 2913 return sdev->queue_depth; 2914} 2915 |
2932/** 2933 * ibmvfc_change_queue_type - Change the device's queue type 2934 * @sdev: scsi device struct 2935 * @tag_type: type of tags to use 2936 * 2937 * Return value: 2938 * actual queue type set 2939 **/ 2940static int ibmvfc_change_queue_type(struct scsi_device *sdev, int tag_type) 2941{ 2942 if (sdev->tagged_supported) { 2943 scsi_set_tag_type(sdev, tag_type); 2944 2945 if (tag_type) 2946 scsi_activate_tcq(sdev, sdev->queue_depth); 2947 else 2948 scsi_deactivate_tcq(sdev, sdev->queue_depth); 2949 } else 2950 tag_type = 0; 2951 2952 return tag_type; 2953} 2954 | |
2955static ssize_t ibmvfc_show_host_partition_name(struct device *dev, 2956 struct device_attribute *attr, char *buf) 2957{ 2958 struct Scsi_Host *shost = class_to_shost(dev); 2959 struct ibmvfc_host *vhost = shost_priv(shost); 2960 2961 return snprintf(buf, PAGE_SIZE, "%s\n", 2962 vhost->login_buf->resp.partition_name); --- 165 unchanged lines hidden (view full) --- 3128 .eh_device_reset_handler = ibmvfc_eh_device_reset_handler, 3129 .eh_target_reset_handler = ibmvfc_eh_target_reset_handler, 3130 .eh_host_reset_handler = ibmvfc_eh_host_reset_handler, 3131 .slave_alloc = ibmvfc_slave_alloc, 3132 .slave_configure = ibmvfc_slave_configure, 3133 .target_alloc = ibmvfc_target_alloc, 3134 .scan_finished = ibmvfc_scan_finished, 3135 .change_queue_depth = ibmvfc_change_queue_depth, | 2916static ssize_t ibmvfc_show_host_partition_name(struct device *dev, 2917 struct device_attribute *attr, char *buf) 2918{ 2919 struct Scsi_Host *shost = class_to_shost(dev); 2920 struct ibmvfc_host *vhost = shost_priv(shost); 2921 2922 return snprintf(buf, PAGE_SIZE, "%s\n", 2923 vhost->login_buf->resp.partition_name); --- 165 unchanged lines hidden (view full) --- 3089 .eh_device_reset_handler = ibmvfc_eh_device_reset_handler, 3090 .eh_target_reset_handler = ibmvfc_eh_target_reset_handler, 3091 .eh_host_reset_handler = ibmvfc_eh_host_reset_handler, 3092 .slave_alloc = ibmvfc_slave_alloc, 3093 .slave_configure = ibmvfc_slave_configure, 3094 .target_alloc = ibmvfc_target_alloc, 3095 .scan_finished = ibmvfc_scan_finished, 3096 .change_queue_depth = ibmvfc_change_queue_depth, |
3136 .change_queue_type = ibmvfc_change_queue_type, | 3097 .change_queue_type = scsi_change_queue_type, |
3137 .cmd_per_lun = 16, 3138 .can_queue = IBMVFC_MAX_REQUESTS_DEFAULT, 3139 .this_id = -1, 3140 .sg_tablesize = SG_ALL, 3141 .max_sectors = IBMVFC_MAX_SECTORS, 3142 .use_clustering = ENABLE_CLUSTERING, 3143 .shost_attrs = ibmvfc_attrs, | 3098 .cmd_per_lun = 16, 3099 .can_queue = IBMVFC_MAX_REQUESTS_DEFAULT, 3100 .this_id = -1, 3101 .sg_tablesize = SG_ALL, 3102 .max_sectors = IBMVFC_MAX_SECTORS, 3103 .use_clustering = ENABLE_CLUSTERING, 3104 .shost_attrs = ibmvfc_attrs, |
3105 .use_blk_tags = 1, 3106 .track_queue_depth = 1, |
|
3144}; 3145 3146/** 3147 * ibmvfc_next_async_crq - Returns the next entry in async queue 3148 * @vhost: ibmvfc host struct 3149 * 3150 * Returns: 3151 * Pointer to next entry in queue / NULL if empty --- 1909 unchanged lines hidden --- | 3107}; 3108 3109/** 3110 * ibmvfc_next_async_crq - Returns the next entry in async queue 3111 * @vhost: ibmvfc host struct 3112 * 3113 * Returns: 3114 * Pointer to next entry in queue / NULL if empty --- 1909 unchanged lines hidden --- |