diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dmi.h | 3 | ||||
-rw-r--r-- | include/linux/enclosure.h | 129 | ||||
-rw-r--r-- | include/linux/hrtimer.h | 5 | ||||
-rw-r--r-- | include/linux/i2c-id.h | 36 | ||||
-rw-r--r-- | include/linux/ktime.h | 3 | ||||
-rw-r--r-- | include/linux/mm_types.h | 5 | ||||
-rw-r--r-- | include/linux/slub_def.h | 23 | ||||
-rw-r--r-- | include/scsi/iscsi_proto.h | 4 | ||||
-rw-r--r-- | include/scsi/libiscsi.h | 30 | ||||
-rw-r--r-- | include/scsi/scsi.h | 14 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 44 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 43 |
12 files changed, 256 insertions, 83 deletions
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index b1251b2af568..bbc9992ec374 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -79,6 +79,7 @@ extern void dmi_scan_machine(void); | |||
79 | extern int dmi_get_year(int field); | 79 | extern int dmi_get_year(int field); |
80 | extern int dmi_name_in_vendors(const char *str); | 80 | extern int dmi_name_in_vendors(const char *str); |
81 | extern int dmi_available; | 81 | extern int dmi_available; |
82 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); | ||
82 | 83 | ||
83 | #else | 84 | #else |
84 | 85 | ||
@@ -89,6 +90,8 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na | |||
89 | static inline int dmi_get_year(int year) { return 0; } | 90 | static inline int dmi_get_year(int year) { return 0; } |
90 | static inline int dmi_name_in_vendors(const char *s) { return 0; } | 91 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
91 | #define dmi_available 0 | 92 | #define dmi_available 0 |
93 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) | ||
94 | { return -1; } | ||
92 | 95 | ||
93 | #endif | 96 | #endif |
94 | 97 | ||
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h new file mode 100644 index 000000000000..a5978f18ca40 --- /dev/null +++ b/include/linux/enclosure.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Enclosure Services | ||
3 | * | ||
4 | * Copyright (C) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> | ||
5 | * | ||
6 | **----------------------------------------------------------------------------- | ||
7 | ** | ||
8 | ** This program is free software; you can redistribute it and/or | ||
9 | ** modify it under the terms of the GNU General Public License | ||
10 | ** version 2 as published by the Free Software Foundation. | ||
11 | ** | ||
12 | ** This program is distributed in the hope that it will be useful, | ||
13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | ** GNU General Public License for more details. | ||
16 | ** | ||
17 | ** You should have received a copy of the GNU General Public License | ||
18 | ** along with this program; if not, write to the Free Software | ||
19 | ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | ** | ||
21 | **----------------------------------------------------------------------------- | ||
22 | */ | ||
23 | #ifndef _LINUX_ENCLOSURE_H_ | ||
24 | #define _LINUX_ENCLOSURE_H_ | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | #include <linux/list.h> | ||
28 | |||
29 | /* A few generic types ... taken from ses-2 */ | ||
30 | enum enclosure_component_type { | ||
31 | ENCLOSURE_COMPONENT_DEVICE = 0x01, | ||
32 | ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, | ||
33 | }; | ||
34 | |||
35 | /* ses-2 common element status */ | ||
36 | enum enclosure_status { | ||
37 | ENCLOSURE_STATUS_UNSUPPORTED = 0, | ||
38 | ENCLOSURE_STATUS_OK, | ||
39 | ENCLOSURE_STATUS_CRITICAL, | ||
40 | ENCLOSURE_STATUS_NON_CRITICAL, | ||
41 | ENCLOSURE_STATUS_UNRECOVERABLE, | ||
42 | ENCLOSURE_STATUS_NOT_INSTALLED, | ||
43 | ENCLOSURE_STATUS_UNKNOWN, | ||
44 | ENCLOSURE_STATUS_UNAVAILABLE, | ||
45 | }; | ||
46 | |||
47 | /* SFF-8485 activity light settings */ | ||
48 | enum enclosure_component_setting { | ||
49 | ENCLOSURE_SETTING_DISABLED = 0, | ||
50 | ENCLOSURE_SETTING_ENABLED = 1, | ||
51 | ENCLOSURE_SETTING_BLINK_A_ON_OFF = 2, | ||
52 | ENCLOSURE_SETTING_BLINK_A_OFF_ON = 3, | ||
53 | ENCLOSURE_SETTING_BLINK_B_ON_OFF = 6, | ||
54 | ENCLOSURE_SETTING_BLINK_B_OFF_ON = 7, | ||
55 | }; | ||
56 | |||
57 | struct enclosure_device; | ||
58 | struct enclosure_component; | ||
59 | struct enclosure_component_callbacks { | ||
60 | void (*get_status)(struct enclosure_device *, | ||
61 | struct enclosure_component *); | ||
62 | int (*set_status)(struct enclosure_device *, | ||
63 | struct enclosure_component *, | ||
64 | enum enclosure_status); | ||
65 | void (*get_fault)(struct enclosure_device *, | ||
66 | struct enclosure_component *); | ||
67 | int (*set_fault)(struct enclosure_device *, | ||
68 | struct enclosure_component *, | ||
69 | enum enclosure_component_setting); | ||
70 | void (*get_active)(struct enclosure_device *, | ||
71 | struct enclosure_component *); | ||
72 | int (*set_active)(struct enclosure_device *, | ||
73 | struct enclosure_component *, | ||
74 | enum enclosure_component_setting); | ||
75 | void (*get_locate)(struct enclosure_device *, | ||
76 | struct enclosure_component *); | ||
77 | int (*set_locate)(struct enclosure_device *, | ||
78 | struct enclosure_component *, | ||
79 | enum enclosure_component_setting); | ||
80 | }; | ||
81 | |||
82 | |||
83 | struct enclosure_component { | ||
84 | void *scratch; | ||
85 | struct class_device cdev; | ||
86 | enum enclosure_component_type type; | ||
87 | int number; | ||
88 | int fault; | ||
89 | int active; | ||
90 | int locate; | ||
91 | enum enclosure_status status; | ||
92 | }; | ||
93 | |||
94 | struct enclosure_device { | ||
95 | void *scratch; | ||
96 | struct list_head node; | ||
97 | struct class_device cdev; | ||
98 | struct enclosure_component_callbacks *cb; | ||
99 | int components; | ||
100 | struct enclosure_component component[0]; | ||
101 | }; | ||
102 | |||
103 | static inline struct enclosure_device * | ||
104 | to_enclosure_device(struct class_device *dev) | ||
105 | { | ||
106 | return container_of(dev, struct enclosure_device, cdev); | ||
107 | } | ||
108 | |||
109 | static inline struct enclosure_component * | ||
110 | to_enclosure_component(struct class_device *dev) | ||
111 | { | ||
112 | return container_of(dev, struct enclosure_component, cdev); | ||
113 | } | ||
114 | |||
115 | struct enclosure_device * | ||
116 | enclosure_register(struct device *, const char *, int, | ||
117 | struct enclosure_component_callbacks *); | ||
118 | void enclosure_unregister(struct enclosure_device *); | ||
119 | struct enclosure_component * | ||
120 | enclosure_component_register(struct enclosure_device *, unsigned int, | ||
121 | enum enclosure_component_type, const char *); | ||
122 | int enclosure_add_device(struct enclosure_device *enclosure, int component, | ||
123 | struct device *dev); | ||
124 | int enclosure_remove_device(struct enclosure_device *enclosure, int component); | ||
125 | struct enclosure_device *enclosure_find(struct device *dev); | ||
126 | int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *), | ||
127 | void *data); | ||
128 | |||
129 | #endif /* _LINUX_ENCLOSURE_H_ */ | ||
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 8371b664b41f..203591e23210 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
225 | * idea of the (in)accuracy of timers. Timer values are rounded up to | 225 | * idea of the (in)accuracy of timers. Timer values are rounded up to |
226 | * this resolution values. | 226 | * this resolution values. |
227 | */ | 227 | */ |
228 | # define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 } | 228 | # define HIGH_RES_NSEC 1 |
229 | # define KTIME_HIGH_RES (ktime_t) { .tv64 = HIGH_RES_NSEC } | ||
230 | # define MONOTONIC_RES_NSEC HIGH_RES_NSEC | ||
229 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES | 231 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES |
230 | 232 | ||
231 | #else | 233 | #else |
232 | 234 | ||
235 | # define MONOTONIC_RES_NSEC LOW_RES_NSEC | ||
233 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES | 236 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES |
234 | 237 | ||
235 | /* | 238 | /* |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index f922b060158b..b979112f74e0 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -96,42 +96,6 @@ | |||
96 | 96 | ||
97 | #define I2C_DRIVERID_I2CDEV 900 | 97 | #define I2C_DRIVERID_I2CDEV 900 |
98 | 98 | ||
99 | /* IDs -- Use DRIVERIDs 1000-1999 for sensors. | ||
100 | These were originally in sensors.h in the lm_sensors package */ | ||
101 | #define I2C_DRIVERID_LM78 1002 | ||
102 | #define I2C_DRIVERID_LM75 1003 | ||
103 | #define I2C_DRIVERID_GL518 1004 | ||
104 | #define I2C_DRIVERID_EEPROM 1005 | ||
105 | #define I2C_DRIVERID_W83781D 1006 | ||
106 | #define I2C_DRIVERID_LM80 1007 | ||
107 | #define I2C_DRIVERID_ADM1021 1008 | ||
108 | #define I2C_DRIVERID_ADM9240 1009 | ||
109 | #define I2C_DRIVERID_LTC1710 1010 | ||
110 | #define I2C_DRIVERID_BT869 1013 | ||
111 | #define I2C_DRIVERID_MAXILIFE 1014 | ||
112 | #define I2C_DRIVERID_MATORB 1015 | ||
113 | #define I2C_DRIVERID_GL520 1016 | ||
114 | #define I2C_DRIVERID_THMC50 1017 | ||
115 | #define I2C_DRIVERID_ADM1025 1020 | ||
116 | #define I2C_DRIVERID_LM87 1021 | ||
117 | #define I2C_DRIVERID_PCF8574 1022 | ||
118 | #define I2C_DRIVERID_MTP008 1023 | ||
119 | #define I2C_DRIVERID_DS1621 1024 | ||
120 | #define I2C_DRIVERID_ADM1024 1025 | ||
121 | #define I2C_DRIVERID_CH700X 1027 /* single driver for CH7003-7009 digital pc to tv encoders */ | ||
122 | #define I2C_DRIVERID_FSCPOS 1028 | ||
123 | #define I2C_DRIVERID_FSCSCY 1029 | ||
124 | #define I2C_DRIVERID_PCF8591 1030 | ||
125 | #define I2C_DRIVERID_LM92 1033 | ||
126 | #define I2C_DRIVERID_SMARTBATT 1035 | ||
127 | #define I2C_DRIVERID_BMCSENSORS 1036 | ||
128 | #define I2C_DRIVERID_FS451 1037 | ||
129 | #define I2C_DRIVERID_LM85 1039 | ||
130 | #define I2C_DRIVERID_LM83 1040 | ||
131 | #define I2C_DRIVERID_LM90 1042 | ||
132 | #define I2C_DRIVERID_ASB100 1043 | ||
133 | #define I2C_DRIVERID_FSCHER 1046 | ||
134 | #define I2C_DRIVERID_W83L785TS 1047 | ||
135 | #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ | 99 | #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ |
136 | 100 | ||
137 | /* | 101 | /* |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index a6ddec141f96..36c542b70c6d 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | |||
316 | * idea of the (in)accuracy of timers. Timer values are rounded up to | 316 | * idea of the (in)accuracy of timers. Timer values are rounded up to |
317 | * this resolution values. | 317 | * this resolution values. |
318 | */ | 318 | */ |
319 | #define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC } | 319 | #define LOW_RES_NSEC TICK_NSEC |
320 | #define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } | ||
320 | 321 | ||
321 | /* Get the monotonic time in timespec format: */ | 322 | /* Get the monotonic time in timespec format: */ |
322 | extern void ktime_get_ts(struct timespec *ts); | 323 | extern void ktime_get_ts(struct timespec *ts); |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 34023c65d466..bfee0bd1d435 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -64,7 +64,10 @@ struct page { | |||
64 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 64 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS |
65 | spinlock_t ptl; | 65 | spinlock_t ptl; |
66 | #endif | 66 | #endif |
67 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ | 67 | struct { |
68 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ | ||
69 | void *end; /* SLUB: end marker */ | ||
70 | }; | ||
68 | struct page *first_page; /* Compound tail pages */ | 71 | struct page *first_page; /* Compound tail pages */ |
69 | }; | 72 | }; |
70 | union { | 73 | union { |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index ddb1a706b144..5e6d3d634d5b 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -11,12 +11,35 @@ | |||
11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
12 | #include <linux/kobject.h> | 12 | #include <linux/kobject.h> |
13 | 13 | ||
14 | enum stat_item { | ||
15 | ALLOC_FASTPATH, /* Allocation from cpu slab */ | ||
16 | ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ | ||
17 | FREE_FASTPATH, /* Free to cpu slub */ | ||
18 | FREE_SLOWPATH, /* Freeing not to cpu slab */ | ||
19 | FREE_FROZEN, /* Freeing to frozen slab */ | ||
20 | FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ | ||
21 | FREE_REMOVE_PARTIAL, /* Freeing removes last object */ | ||
22 | ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ | ||
23 | ALLOC_SLAB, /* Cpu slab acquired from page allocator */ | ||
24 | ALLOC_REFILL, /* Refill cpu slab from slab freelist */ | ||
25 | FREE_SLAB, /* Slab freed to the page allocator */ | ||
26 | CPUSLAB_FLUSH, /* Abandoning of the cpu slab */ | ||
27 | DEACTIVATE_FULL, /* Cpu slab was full when deactivated */ | ||
28 | DEACTIVATE_EMPTY, /* Cpu slab was empty when deactivated */ | ||
29 | DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */ | ||
30 | DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ | ||
31 | DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ | ||
32 | NR_SLUB_STAT_ITEMS }; | ||
33 | |||
14 | struct kmem_cache_cpu { | 34 | struct kmem_cache_cpu { |
15 | void **freelist; /* Pointer to first free per cpu object */ | 35 | void **freelist; /* Pointer to first free per cpu object */ |
16 | struct page *page; /* The slab from which we are allocating */ | 36 | struct page *page; /* The slab from which we are allocating */ |
17 | int node; /* The node of the page (or -1 for debug) */ | 37 | int node; /* The node of the page (or -1 for debug) */ |
18 | unsigned int offset; /* Freepointer offset (in word units) */ | 38 | unsigned int offset; /* Freepointer offset (in word units) */ |
19 | unsigned int objsize; /* Size of an object (from kmem_cache) */ | 39 | unsigned int objsize; /* Size of an object (from kmem_cache) */ |
40 | #ifdef CONFIG_SLUB_STATS | ||
41 | unsigned stat[NR_SLUB_STAT_ITEMS]; | ||
42 | #endif | ||
20 | }; | 43 | }; |
21 | 44 | ||
22 | struct kmem_cache_node { | 45 | struct kmem_cache_node { |
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index 318a909e7ae1..5ffec8ad6964 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
@@ -45,8 +45,8 @@ | |||
45 | /* initiator tags; opaque for target */ | 45 | /* initiator tags; opaque for target */ |
46 | typedef uint32_t __bitwise__ itt_t; | 46 | typedef uint32_t __bitwise__ itt_t; |
47 | /* below makes sense only for initiator that created this tag */ | 47 | /* below makes sense only for initiator that created this tag */ |
48 | #define build_itt(itt, id, age) ((__force itt_t)\ | 48 | #define build_itt(itt, age) ((__force itt_t)\ |
49 | ((itt) | ((id) << ISCSI_CID_SHIFT) | ((age) << ISCSI_AGE_SHIFT))) | 49 | ((itt) | ((age) << ISCSI_AGE_SHIFT))) |
50 | #define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK) | 50 | #define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK) |
51 | #define RESERVED_ITT ((__force itt_t)0xffffffff) | 51 | #define RESERVED_ITT ((__force itt_t)0xffffffff) |
52 | 52 | ||
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 889f51fabab9..7b90b63fb5c7 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -70,8 +70,6 @@ enum { | |||
70 | #define ISCSI_SUSPEND_BIT 1 | 70 | #define ISCSI_SUSPEND_BIT 1 |
71 | 71 | ||
72 | #define ISCSI_ITT_MASK (0xfff) | 72 | #define ISCSI_ITT_MASK (0xfff) |
73 | #define ISCSI_CID_SHIFT 12 | ||
74 | #define ISCSI_CID_MASK (0xffff << ISCSI_CID_SHIFT) | ||
75 | #define ISCSI_AGE_SHIFT 28 | 73 | #define ISCSI_AGE_SHIFT 28 |
76 | #define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) | 74 | #define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) |
77 | 75 | ||
@@ -135,6 +133,14 @@ static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask) | |||
135 | return (void*)ctask->hdr + ctask->hdr_len; | 133 | return (void*)ctask->hdr + ctask->hdr_len; |
136 | } | 134 | } |
137 | 135 | ||
136 | /* Connection's states */ | ||
137 | enum { | ||
138 | ISCSI_CONN_INITIAL_STAGE, | ||
139 | ISCSI_CONN_STARTED, | ||
140 | ISCSI_CONN_STOPPED, | ||
141 | ISCSI_CONN_CLEANUP_WAIT, | ||
142 | }; | ||
143 | |||
138 | struct iscsi_conn { | 144 | struct iscsi_conn { |
139 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ | 145 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ |
140 | void *dd_data; /* iscsi_transport data */ | 146 | void *dd_data; /* iscsi_transport data */ |
@@ -227,6 +233,17 @@ struct iscsi_pool { | |||
227 | int max; /* Max number of elements */ | 233 | int max; /* Max number of elements */ |
228 | }; | 234 | }; |
229 | 235 | ||
236 | /* Session's states */ | ||
237 | enum { | ||
238 | ISCSI_STATE_FREE = 1, | ||
239 | ISCSI_STATE_LOGGED_IN, | ||
240 | ISCSI_STATE_FAILED, | ||
241 | ISCSI_STATE_TERMINATE, | ||
242 | ISCSI_STATE_IN_RECOVERY, | ||
243 | ISCSI_STATE_RECOVERY_FAILED, | ||
244 | ISCSI_STATE_LOGGING_OUT, | ||
245 | }; | ||
246 | |||
230 | struct iscsi_session { | 247 | struct iscsi_session { |
231 | /* | 248 | /* |
232 | * Syncs up the scsi eh thread with the iscsi eh thread when sending | 249 | * Syncs up the scsi eh thread with the iscsi eh thread when sending |
@@ -325,6 +342,10 @@ extern int iscsi_session_get_param(struct iscsi_cls_session *cls_session, | |||
325 | #define session_to_cls(_sess) \ | 342 | #define session_to_cls(_sess) \ |
326 | hostdata_session(_sess->host->hostdata) | 343 | hostdata_session(_sess->host->hostdata) |
327 | 344 | ||
345 | #define iscsi_session_printk(prefix, _sess, fmt, a...) \ | ||
346 | iscsi_cls_session_printk(prefix, \ | ||
347 | (struct iscsi_cls_session *)session_to_cls(_sess), fmt, ##a) | ||
348 | |||
328 | /* | 349 | /* |
329 | * connection management | 350 | * connection management |
330 | */ | 351 | */ |
@@ -339,6 +360,9 @@ extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); | |||
339 | extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | 360 | extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, |
340 | enum iscsi_param param, char *buf); | 361 | enum iscsi_param param, char *buf); |
341 | 362 | ||
363 | #define iscsi_conn_printk(prefix, _c, fmt, a...) \ | ||
364 | iscsi_cls_conn_printk(prefix, _c->cls_conn, fmt, ##a) | ||
365 | |||
342 | /* | 366 | /* |
343 | * pdu and task processing | 367 | * pdu and task processing |
344 | */ | 368 | */ |
@@ -349,8 +373,6 @@ extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, | |||
349 | char *, uint32_t); | 373 | char *, uint32_t); |
350 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | 374 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, |
351 | char *, int); | 375 | char *, int); |
352 | extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | ||
353 | char *, int); | ||
354 | extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, | 376 | extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, |
355 | uint32_t *); | 377 | uint32_t *); |
356 | extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); | 378 | extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 82251575a9b4..1f74bcd603fe 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -235,6 +235,20 @@ static inline int scsi_status_is_good(int status) | |||
235 | #define TYPE_RBC 0x0e | 235 | #define TYPE_RBC 0x0e |
236 | #define TYPE_NO_LUN 0x7f | 236 | #define TYPE_NO_LUN 0x7f |
237 | 237 | ||
238 | /* SCSI protocols; these are taken from SPC-3 section 7.5 */ | ||
239 | enum scsi_protocol { | ||
240 | SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ | ||
241 | SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ | ||
242 | SCSI_PROTOCOL_SSA = 2, /* Serial Storage Architecture - Obsolete */ | ||
243 | SCSI_PROTOCOL_SBP = 3, /* firewire */ | ||
244 | SCSI_PROTOCOL_SRP = 4, /* Infiniband RDMA */ | ||
245 | SCSI_PROTOCOL_ISCSI = 5, | ||
246 | SCSI_PROTOCOL_SAS = 6, | ||
247 | SCSI_PROTOCOL_ADT = 7, /* Media Changers */ | ||
248 | SCSI_PROTOCOL_ATA = 8, | ||
249 | SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */ | ||
250 | }; | ||
251 | |||
238 | /* Returns a human-readable name for the device */ | 252 | /* Returns a human-readable name for the device */ |
239 | extern const char * scsi_device_type(unsigned type); | 253 | extern const char * scsi_device_type(unsigned type); |
240 | 254 | ||
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 5c58d594126a..d1299e999723 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -280,39 +280,45 @@ struct scsi_host_template { | |||
280 | * If the host wants to be called before the scan starts, but | 280 | * If the host wants to be called before the scan starts, but |
281 | * after the midlayer has set up ready for the scan, it can fill | 281 | * after the midlayer has set up ready for the scan, it can fill |
282 | * in this function. | 282 | * in this function. |
283 | * | ||
284 | * Status: OPTIONAL | ||
283 | */ | 285 | */ |
284 | void (* scan_start)(struct Scsi_Host *); | 286 | void (* scan_start)(struct Scsi_Host *); |
285 | 287 | ||
286 | /* | 288 | /* |
287 | * fill in this function to allow the queue depth of this host | 289 | * Fill in this function to allow the queue depth of this host |
288 | * to be changeable (on a per device basis). returns either | 290 | * to be changeable (on a per device basis). Returns either |
289 | * the current queue depth setting (may be different from what | 291 | * the current queue depth setting (may be different from what |
290 | * was passed in) or an error. An error should only be | 292 | * was passed in) or an error. An error should only be |
291 | * returned if the requested depth is legal but the driver was | 293 | * returned if the requested depth is legal but the driver was |
292 | * unable to set it. If the requested depth is illegal, the | 294 | * unable to set it. If the requested depth is illegal, the |
293 | * driver should set and return the closest legal queue depth. | 295 | * driver should set and return the closest legal queue depth. |
294 | * | 296 | * |
297 | * Status: OPTIONAL | ||
295 | */ | 298 | */ |
296 | int (* change_queue_depth)(struct scsi_device *, int); | 299 | int (* change_queue_depth)(struct scsi_device *, int); |
297 | 300 | ||
298 | /* | 301 | /* |
299 | * fill in this function to allow the changing of tag types | 302 | * Fill in this function to allow the changing of tag types |
300 | * (this also allows the enabling/disabling of tag command | 303 | * (this also allows the enabling/disabling of tag command |
301 | * queueing). An error should only be returned if something | 304 | * queueing). An error should only be returned if something |
302 | * went wrong in the driver while trying to set the tag type. | 305 | * went wrong in the driver while trying to set the tag type. |
303 | * If the driver doesn't support the requested tag type, then | 306 | * If the driver doesn't support the requested tag type, then |
304 | * it should set the closest type it does support without | 307 | * it should set the closest type it does support without |
305 | * returning an error. Returns the actual tag type set. | 308 | * returning an error. Returns the actual tag type set. |
309 | * | ||
310 | * Status: OPTIONAL | ||
306 | */ | 311 | */ |
307 | int (* change_queue_type)(struct scsi_device *, int); | 312 | int (* change_queue_type)(struct scsi_device *, int); |
308 | 313 | ||
309 | /* | 314 | /* |
310 | * This function determines the bios parameters for a given | 315 | * This function determines the BIOS parameters for a given |
311 | * harddisk. These tend to be numbers that are made up by | 316 | * harddisk. These tend to be numbers that are made up by |
312 | * the host adapter. Parameters: | 317 | * the host adapter. Parameters: |
313 | * size, device, list (heads, sectors, cylinders) | 318 | * size, device, list (heads, sectors, cylinders) |
314 | * | 319 | * |
315 | * Status: OPTIONAL */ | 320 | * Status: OPTIONAL |
321 | */ | ||
316 | int (* bios_param)(struct scsi_device *, struct block_device *, | 322 | int (* bios_param)(struct scsi_device *, struct block_device *, |
317 | sector_t, int []); | 323 | sector_t, int []); |
318 | 324 | ||
@@ -351,7 +357,7 @@ struct scsi_host_template { | |||
351 | 357 | ||
352 | /* | 358 | /* |
353 | * This determines if we will use a non-interrupt driven | 359 | * This determines if we will use a non-interrupt driven |
354 | * or an interrupt driven scheme, It is set to the maximum number | 360 | * or an interrupt driven scheme. It is set to the maximum number |
355 | * of simultaneous commands a given host adapter will accept. | 361 | * of simultaneous commands a given host adapter will accept. |
356 | */ | 362 | */ |
357 | int can_queue; | 363 | int can_queue; |
@@ -372,12 +378,12 @@ struct scsi_host_template { | |||
372 | unsigned short sg_tablesize; | 378 | unsigned short sg_tablesize; |
373 | 379 | ||
374 | /* | 380 | /* |
375 | * If the host adapter has limitations beside segment count | 381 | * Set this if the host adapter has limitations beside segment count. |
376 | */ | 382 | */ |
377 | unsigned short max_sectors; | 383 | unsigned short max_sectors; |
378 | 384 | ||
379 | /* | 385 | /* |
380 | * dma scatter gather segment boundary limit. a segment crossing this | 386 | * DMA scatter gather segment boundary limit. A segment crossing this |
381 | * boundary will be split in two. | 387 | * boundary will be split in two. |
382 | */ | 388 | */ |
383 | unsigned long dma_boundary; | 389 | unsigned long dma_boundary; |
@@ -386,7 +392,7 @@ struct scsi_host_template { | |||
386 | * This specifies "machine infinity" for host templates which don't | 392 | * This specifies "machine infinity" for host templates which don't |
387 | * limit the transfer size. Note this limit represents an absolute | 393 | * limit the transfer size. Note this limit represents an absolute |
388 | * maximum, and may be over the transfer limits allowed for | 394 | * maximum, and may be over the transfer limits allowed for |
389 | * individual devices (e.g. 256 for SCSI-1) | 395 | * individual devices (e.g. 256 for SCSI-1). |
390 | */ | 396 | */ |
391 | #define SCSI_DEFAULT_MAX_SECTORS 1024 | 397 | #define SCSI_DEFAULT_MAX_SECTORS 1024 |
392 | 398 | ||
@@ -413,12 +419,12 @@ struct scsi_host_template { | |||
413 | unsigned supported_mode:2; | 419 | unsigned supported_mode:2; |
414 | 420 | ||
415 | /* | 421 | /* |
416 | * true if this host adapter uses unchecked DMA onto an ISA bus. | 422 | * True if this host adapter uses unchecked DMA onto an ISA bus. |
417 | */ | 423 | */ |
418 | unsigned unchecked_isa_dma:1; | 424 | unsigned unchecked_isa_dma:1; |
419 | 425 | ||
420 | /* | 426 | /* |
421 | * true if this host adapter can make good use of clustering. | 427 | * True if this host adapter can make good use of clustering. |
422 | * I originally thought that if the tablesize was large that it | 428 | * I originally thought that if the tablesize was large that it |
423 | * was a waste of CPU cycles to prepare a cluster list, but | 429 | * was a waste of CPU cycles to prepare a cluster list, but |
424 | * it works out that the Buslogic is faster if you use a smaller | 430 | * it works out that the Buslogic is faster if you use a smaller |
@@ -428,7 +434,7 @@ struct scsi_host_template { | |||
428 | unsigned use_clustering:1; | 434 | unsigned use_clustering:1; |
429 | 435 | ||
430 | /* | 436 | /* |
431 | * True for emulated SCSI host adapters (e.g. ATAPI) | 437 | * True for emulated SCSI host adapters (e.g. ATAPI). |
432 | */ | 438 | */ |
433 | unsigned emulated:1; | 439 | unsigned emulated:1; |
434 | 440 | ||
@@ -438,12 +444,12 @@ struct scsi_host_template { | |||
438 | unsigned skip_settle_delay:1; | 444 | unsigned skip_settle_delay:1; |
439 | 445 | ||
440 | /* | 446 | /* |
441 | * ordered write support | 447 | * True if we are using ordered write support. |
442 | */ | 448 | */ |
443 | unsigned ordered_tag:1; | 449 | unsigned ordered_tag:1; |
444 | 450 | ||
445 | /* | 451 | /* |
446 | * Countdown for host blocking with no commands outstanding | 452 | * Countdown for host blocking with no commands outstanding. |
447 | */ | 453 | */ |
448 | unsigned int max_host_blocked; | 454 | unsigned int max_host_blocked; |
449 | 455 | ||
@@ -522,8 +528,8 @@ struct Scsi_Host { | |||
522 | struct scsi_transport_template *transportt; | 528 | struct scsi_transport_template *transportt; |
523 | 529 | ||
524 | /* | 530 | /* |
525 | * area to keep a shared tag map (if needed, will be | 531 | * Area to keep a shared tag map (if needed, will be |
526 | * NULL if not) | 532 | * NULL if not). |
527 | */ | 533 | */ |
528 | struct blk_queue_tag *bqt; | 534 | struct blk_queue_tag *bqt; |
529 | 535 | ||
@@ -596,16 +602,16 @@ struct Scsi_Host { | |||
596 | /* | 602 | /* |
597 | * Host uses correct SCSI ordering not PC ordering. The bit is | 603 | * Host uses correct SCSI ordering not PC ordering. The bit is |
598 | * set for the minority of drivers whose authors actually read | 604 | * set for the minority of drivers whose authors actually read |
599 | * the spec ;) | 605 | * the spec ;). |
600 | */ | 606 | */ |
601 | unsigned reverse_ordering:1; | 607 | unsigned reverse_ordering:1; |
602 | 608 | ||
603 | /* | 609 | /* |
604 | * ordered write support | 610 | * Ordered write support |
605 | */ | 611 | */ |
606 | unsigned ordered_tag:1; | 612 | unsigned ordered_tag:1; |
607 | 613 | ||
608 | /* task mgmt function in progress */ | 614 | /* Task mgmt function in progress */ |
609 | unsigned tmf_in_progress:1; | 615 | unsigned tmf_in_progress:1; |
610 | 616 | ||
611 | /* Asynchronous scan in progress */ | 617 | /* Asynchronous scan in progress */ |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 404f11d331d6..dbc96ef4cc72 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -149,13 +149,6 @@ extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error); | |||
149 | extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | 149 | extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
150 | char *data, uint32_t data_size); | 150 | char *data, uint32_t data_size); |
151 | 151 | ||
152 | |||
153 | /* Connection's states */ | ||
154 | #define ISCSI_CONN_INITIAL_STAGE 0 | ||
155 | #define ISCSI_CONN_STARTED 1 | ||
156 | #define ISCSI_CONN_STOPPED 2 | ||
157 | #define ISCSI_CONN_CLEANUP_WAIT 3 | ||
158 | |||
159 | struct iscsi_cls_conn { | 152 | struct iscsi_cls_conn { |
160 | struct list_head conn_list; /* item in connlist */ | 153 | struct list_head conn_list; /* item in connlist */ |
161 | void *dd_data; /* LLD private data */ | 154 | void *dd_data; /* LLD private data */ |
@@ -169,27 +162,31 @@ struct iscsi_cls_conn { | |||
169 | #define iscsi_dev_to_conn(_dev) \ | 162 | #define iscsi_dev_to_conn(_dev) \ |
170 | container_of(_dev, struct iscsi_cls_conn, dev) | 163 | container_of(_dev, struct iscsi_cls_conn, dev) |
171 | 164 | ||
172 | /* Session's states */ | 165 | #define iscsi_conn_to_session(_conn) \ |
173 | #define ISCSI_STATE_FREE 1 | 166 | iscsi_dev_to_session(_conn->dev.parent) |
174 | #define ISCSI_STATE_LOGGED_IN 2 | 167 | |
175 | #define ISCSI_STATE_FAILED 3 | 168 | /* iscsi class session state */ |
176 | #define ISCSI_STATE_TERMINATE 4 | 169 | enum { |
177 | #define ISCSI_STATE_IN_RECOVERY 5 | 170 | ISCSI_SESSION_LOGGED_IN, |
178 | #define ISCSI_STATE_RECOVERY_FAILED 6 | 171 | ISCSI_SESSION_FAILED, |
179 | #define ISCSI_STATE_LOGGING_OUT 7 | 172 | ISCSI_SESSION_FREE, |
173 | }; | ||
180 | 174 | ||
181 | struct iscsi_cls_session { | 175 | struct iscsi_cls_session { |
182 | struct list_head sess_list; /* item in session_list */ | 176 | struct list_head sess_list; /* item in session_list */ |
183 | struct list_head host_list; | 177 | struct list_head host_list; |
184 | struct iscsi_transport *transport; | 178 | struct iscsi_transport *transport; |
179 | spinlock_t lock; | ||
180 | struct work_struct scan_work; | ||
181 | struct work_struct unbind_work; | ||
185 | 182 | ||
186 | /* recovery fields */ | 183 | /* recovery fields */ |
187 | int recovery_tmo; | 184 | int recovery_tmo; |
188 | struct delayed_work recovery_work; | 185 | struct delayed_work recovery_work; |
189 | struct work_struct unbind_work; | ||
190 | 186 | ||
191 | int target_id; | 187 | int target_id; |
192 | 188 | ||
189 | int state; | ||
193 | int sid; /* session id */ | 190 | int sid; /* session id */ |
194 | void *dd_data; /* LLD private data */ | 191 | void *dd_data; /* LLD private data */ |
195 | struct device dev; /* sysfs transport/container device */ | 192 | struct device dev; /* sysfs transport/container device */ |
@@ -206,14 +203,22 @@ struct iscsi_cls_session { | |||
206 | 203 | ||
207 | struct iscsi_host { | 204 | struct iscsi_host { |
208 | struct list_head sessions; | 205 | struct list_head sessions; |
206 | atomic_t nr_scans; | ||
209 | struct mutex mutex; | 207 | struct mutex mutex; |
210 | struct workqueue_struct *unbind_workq; | 208 | struct workqueue_struct *scan_workq; |
211 | char unbind_workq_name[KOBJ_NAME_LEN]; | 209 | char scan_workq_name[KOBJ_NAME_LEN]; |
212 | }; | 210 | }; |
213 | 211 | ||
214 | /* | 212 | /* |
215 | * session and connection functions that can be used by HW iSCSI LLDs | 213 | * session and connection functions that can be used by HW iSCSI LLDs |
216 | */ | 214 | */ |
215 | #define iscsi_cls_session_printk(prefix, _cls_session, fmt, a...) \ | ||
216 | dev_printk(prefix, &(_cls_session)->dev, fmt, ##a) | ||
217 | |||
218 | #define iscsi_cls_conn_printk(prefix, _cls_conn, fmt, a...) \ | ||
219 | dev_printk(prefix, &(_cls_conn)->dev, fmt, ##a) | ||
220 | |||
221 | extern int iscsi_session_chkready(struct iscsi_cls_session *session); | ||
217 | extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, | 222 | extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, |
218 | struct iscsi_transport *transport); | 223 | struct iscsi_transport *transport); |
219 | extern int iscsi_add_session(struct iscsi_cls_session *session, | 224 | extern int iscsi_add_session(struct iscsi_cls_session *session, |
@@ -231,6 +236,6 @@ extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, | |||
231 | extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); | 236 | extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); |
232 | extern void iscsi_unblock_session(struct iscsi_cls_session *session); | 237 | extern void iscsi_unblock_session(struct iscsi_cls_session *session); |
233 | extern void iscsi_block_session(struct iscsi_cls_session *session); | 238 | extern void iscsi_block_session(struct iscsi_cls_session *session); |
234 | 239 | extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time); | |
235 | 240 | ||
236 | #endif | 241 | #endif |