1 2 /* 3 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By downloading, copying, installing or 4 * using the software you agree to this license. If you do not agree to this license, do not download, install, 5 * copy or use the software. 6 * 7 * Intel License Agreement 8 * 9 * Copyright (c) 2000, Intel Corporation 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that 13 * the following conditions are met: 14 * 15 * -Redistributions of source code must retain the above copyright notice, this list of conditions and the 16 * following disclaimer. 17 * 18 * -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 19 * following disclaimer in the documentation and/or other materials provided with the distribution. 20 * 21 * -The name of Intel Corporation may not be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 26 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* 35 * Intel iSCSI Driver 36 */ 37 38 #ifndef _DRIVER_H_ 39 #define _DRIVER_H_ 40 #include "iscsi.h" 41 #include "iscsiutil.h" 42 #include "initiator.h" 43 44 /* 45 * Driver configuration 46 */ 47 48 #define CONFIG_DRIVER_MAX_LUNS 1024 49 50 /* 51 * Internal 52 */ 53 54 static int driver_init(void); 55 static int driver_shutdown(void); 56 57 typedef struct iscsi_driver_stats_t { 58 unsigned num_tx, num_tx_queued; 59 unsigned num_rx, num_rx_queued; 60 unsigned avg_tx, avg_rx; 61 unsigned tx_queued, tx, tx_error, tx_overflow; 62 unsigned rx_queued, rx, rx_error, rx_overflow; 63 unsigned aborts_success, aborts_failed; 64 unsigned device_resets, bus_resets, host_resets; 65 iscsi_spin_t lock; 66 } iscsi_driver_stats_t; 67 68 /* 69 * Kernel Interface 70 */ 71 72 int iscsi_proc_info (char *, char **, off_t, int, int, int); 73 int iscsi_detect(Scsi_Host_Template *); 74 int iscsi_release(struct Scsi_Host *); 75 int iscsi_ioctl(Scsi_Device *dev, int cmd, void *arg); 76 int iscsi_command(Scsi_Cmnd *SCpnt); 77 int iscsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 78 int iscsi_bios_param(Disk *, kdev_t, int *); 79 int iscsi_abort_handler (Scsi_Cmnd *SCpnt); 80 int iscsi_device_reset_handler (Scsi_Cmnd *); 81 int iscsi_bus_reset_handler (Scsi_Cmnd *); 82 int iscsi_host_reset_handler(Scsi_Cmnd *); 83 84 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,0) 85 int iscsi_revoke (Scsi_Device *ptr); 86 void iscsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *); 87 #endif 88 89 #if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0) 90 extern struct proc_dir_entry iscsi_proc_dir; 91 #endif 92 93 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) 94 #define ISCSI { \ 95 name: "Intel iSCSI Driver", \ 96 proc_dir: NULL, \ 97 proc_info: iscsi_proc_info, \ 98 detect: iscsi_detect, \ 99 bios_param: iscsi_bios_param, \ 100 release: iscsi_release, \ 101 revoke: NULL, \ 102 ioctl: iscsi_ioctl, \ 103 command: iscsi_command, \ 104 queuecommand: iscsi_queuecommand, \ 105 select_queue_depths: iscsi_select_queue_depths, \ 106 eh_strategy_handler: NULL, \ 107 eh_abort_handler: iscsi_abort_handler, \ 108 eh_device_reset_handler: iscsi_device_reset_handler, \ 109 eh_bus_reset_handler: iscsi_bus_reset_handler, \ 110 eh_host_reset_handler: iscsi_host_reset_handler, \ 111 slave_attach: NULL, \ 112 can_queue: CONFIG_INITIATOR_QUEUE_DEPTH, \ 113 this_id: -1, \ 114 sg_tablesize: 128, \ 115 cmd_per_lun: 1, /* linked commands not supported */ \ 116 present: 0, \ 117 unchecked_isa_dma: 0, \ 118 use_clustering: 0, \ 119 use_new_eh_code: 1, \ 120 emulated: 0, \ 121 next: NULL, \ 122 module: NULL, \ 123 info: NULL, \ 124 proc_name: "iscsi" \ 125 } 126 #elif LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0) 127 #define ISCSI { \ 128 name: "Intel iSCSI Driver", \ 129 proc_dir: &iscsi_proc_dir, \ 130 proc_info: iscsi_proc_info, \ 131 detect: iscsi_detect, \ 132 bios_param: iscsi_bios_param, \ 133 release: iscsi_release, \ 134 ioctl: iscsi_ioctl, \ 135 command: iscsi_command, \ 136 queuecommand: iscsi_queuecommand, \ 137 eh_strategy_handler: NULL, \ 138 eh_abort_handler: iscsi_abort_handler, \ 139 eh_device_reset_handler: iscsi_device_reset_handler, \ 140 eh_bus_reset_handler: iscsi_bus_reset_handler, \ 141 eh_host_reset_handler: iscsi_host_reset_handler, \ 142 use_new_eh_code: 1, \ 143 can_queue: CONFIG_INITIATOR_QUEUE_DEPTH, \ 144 sg_tablesize: SG_ALL, \ 145 cmd_per_lun: 1, /* linked commands not supported */ \ 146 this_id: -1, \ 147 present: 0, \ 148 unchecked_isa_dma: 0, \ 149 use_clustering: 0, \ 150 slave_attach: NULL, \ 151 next: NULL, \ 152 module: NULL, \ 153 info: NULL, \ 154 emulated: 0 \ 155 } 156 #endif /* LINUX_VERSION_CODE */ 157 #endif /* _DRIVER_H_ */ 158