summaryrefslogtreecommitdiff
path: root/external/bsd/iscsi/dist/include/driver.h
blob: 4d125d8d7b4886fb497a001ac21788a7a5835edb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

/*
 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By downloading, copying, installing or
 * using the software you agree to this license. If you do not agree to this license, do not download, install,
 * copy or use the software. 
 *
 * Intel License Agreement 
 *
 * Copyright (c) 2000, Intel Corporation
 * All rights reserved. 
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that
 * the following conditions are met: 
 *
 * -Redistributions of source code must retain the above copyright notice, this list of conditions and the
 *  following disclaimer. 
 *
 * -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
 *  following disclaimer in the documentation and/or other materials provided with the distribution. 
 *
 * -The name of Intel Corporation may not be used to endorse or promote products derived from this software
 *  without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE. 
 */

/* 
 * Intel iSCSI Driver
 */

#ifndef _DRIVER_H_
#define _DRIVER_H_
#include "iscsi.h"
#include "iscsiutil.h"
#include "initiator.h"

/*
 * Driver configuration
 */

#define CONFIG_DRIVER_MAX_LUNS 1024

/*
 * Internal
 */

static int driver_init(void);
static int driver_shutdown(void);

typedef struct iscsi_driver_stats_t {
  unsigned num_tx, num_tx_queued; 
  unsigned num_rx, num_rx_queued;
  unsigned avg_tx, avg_rx;
  unsigned tx_queued, tx, tx_error, tx_overflow;
  unsigned rx_queued, rx, rx_error, rx_overflow;
  unsigned aborts_success, aborts_failed;
  unsigned device_resets, bus_resets, host_resets;
  iscsi_spin_t lock;
} iscsi_driver_stats_t;

/* 
 * Kernel Interface
 */

int iscsi_proc_info (char *, char **, off_t, int, int, int);
int iscsi_detect(Scsi_Host_Template *);
int iscsi_release(struct Scsi_Host *);
int iscsi_ioctl(Scsi_Device *dev, int cmd, void *arg);
int iscsi_command(Scsi_Cmnd *SCpnt);
int iscsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int iscsi_bios_param(Disk *, kdev_t, int *);
int iscsi_abort_handler (Scsi_Cmnd *SCpnt);
int iscsi_device_reset_handler (Scsi_Cmnd *);
int iscsi_bus_reset_handler (Scsi_Cmnd *);
int iscsi_host_reset_handler(Scsi_Cmnd *);

#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,0)
int iscsi_revoke (Scsi_Device *ptr);
void iscsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
#endif

#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
extern struct proc_dir_entry iscsi_proc_dir;
#endif
 
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
#define ISCSI {		                                        \
        name: "Intel iSCSI Driver",                             \
        proc_dir: NULL,                                         \
        proc_info: iscsi_proc_info,                             \
        detect: iscsi_detect,                                   \
        bios_param: iscsi_bios_param,                           \
        release: iscsi_release,                                 \
        revoke: NULL,                                           \
        ioctl: iscsi_ioctl,                                     \
        command: iscsi_command,                                 \
        queuecommand: iscsi_queuecommand,                       \
        select_queue_depths: iscsi_select_queue_depths,         \
        eh_strategy_handler: NULL,                              \
        eh_abort_handler: iscsi_abort_handler,                  \
        eh_device_reset_handler: iscsi_device_reset_handler,    \
        eh_bus_reset_handler: iscsi_bus_reset_handler,          \
        eh_host_reset_handler: iscsi_host_reset_handler,        \
        slave_attach: NULL,                                     \
        can_queue: CONFIG_INITIATOR_QUEUE_DEPTH,       		\
        this_id: -1,             				\
        sg_tablesize: 128,                                	\
        cmd_per_lun: 1, /* linked commands not supported */     \
        present: 0,                                             \
        unchecked_isa_dma: 0,                                   \
        use_clustering: 0,                                      \
        use_new_eh_code: 1,                                     \
	emulated: 0,	 					\
        next: NULL,                                             \
        module: NULL,                                           \
        info: NULL,                                             \
	proc_name: "iscsi" 		 	 		\
}
#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0)
#define ISCSI {		                                        \
        name: "Intel iSCSI Driver",                             \
	proc_dir: &iscsi_proc_dir,                              \
        proc_info: iscsi_proc_info,                             \
        detect: iscsi_detect,                                   \
        bios_param: iscsi_bios_param,                           \
        release: iscsi_release,                                 \
        ioctl: iscsi_ioctl,                                     \
        command: iscsi_command,                                 \
        queuecommand: iscsi_queuecommand,                       \
        eh_strategy_handler: NULL,                              \
        eh_abort_handler: iscsi_abort_handler,                  \
        eh_device_reset_handler: iscsi_device_reset_handler,    \
        eh_bus_reset_handler: iscsi_bus_reset_handler,          \
        eh_host_reset_handler: iscsi_host_reset_handler,        \
        use_new_eh_code: 1,                                     \
        can_queue: CONFIG_INITIATOR_QUEUE_DEPTH,       		\
        sg_tablesize: SG_ALL,                                	\
        cmd_per_lun: 1, /* linked commands not supported */	\
        this_id: -1,             				\
        present: 0,                                             \
        unchecked_isa_dma: 0,                                   \
        use_clustering: 0,                                      \
        slave_attach: NULL,                                     \
        next: NULL,                                             \
        module: NULL,                                           \
        info: NULL,                                             \
	emulated: 0 	 					\
}
#endif /* LINUX_VERSION_CODE */
#endif /* _DRIVER_H_ */