PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / target / iscsi / iscsi_target_tq.h
blobcc1eede5ab3a9cc4ad09fcbe3714eae77cdfb083
1 #ifndef ISCSI_THREAD_QUEUE_H
2 #define ISCSI_THREAD_QUEUE_H
4 /*
5 * Defines for thread sets.
6 */
7 extern int iscsi_thread_set_force_reinstatement(struct iscsi_conn *);
8 extern int iscsi_allocate_thread_sets(u32);
9 extern void iscsi_deallocate_thread_sets(void);
10 extern void iscsi_activate_thread_set(struct iscsi_conn *, struct iscsi_thread_set *);
11 extern struct iscsi_thread_set *iscsi_get_thread_set(void);
12 extern void iscsi_set_thread_clear(struct iscsi_conn *, u8);
13 extern void iscsi_set_thread_set_signal(struct iscsi_conn *, u8);
14 extern int iscsi_release_thread_set(struct iscsi_conn *);
15 extern struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *);
16 extern struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *);
17 extern int iscsi_thread_set_init(void);
18 extern void iscsi_thread_set_free(void);
20 extern int iscsi_target_tx_thread(void *);
21 extern int iscsi_target_rx_thread(void *);
23 #define TARGET_THREAD_SET_COUNT 4
25 #define ISCSI_RX_THREAD 1
26 #define ISCSI_TX_THREAD 2
27 #define ISCSI_RX_THREAD_NAME "iscsi_trx"
28 #define ISCSI_TX_THREAD_NAME "iscsi_ttx"
29 #define ISCSI_BLOCK_RX_THREAD 0x1
30 #define ISCSI_BLOCK_TX_THREAD 0x2
31 #define ISCSI_CLEAR_RX_THREAD 0x1
32 #define ISCSI_CLEAR_TX_THREAD 0x2
33 #define ISCSI_SIGNAL_RX_THREAD 0x1
34 #define ISCSI_SIGNAL_TX_THREAD 0x2
36 /* struct iscsi_thread_set->status */
37 #define ISCSI_THREAD_SET_FREE 1
38 #define ISCSI_THREAD_SET_ACTIVE 2
39 #define ISCSI_THREAD_SET_DIE 3
40 #define ISCSI_THREAD_SET_RESET 4
41 #define ISCSI_THREAD_SET_DEALLOCATE_THREADS 5
43 /* By default allow a maximum of 32K iSCSI connections */
44 #define ISCSI_TS_BITMAP_BITS 32768
46 struct iscsi_thread_set {
47 /* flags used for blocking and restarting sets */
48 int blocked_threads;
49 /* flag for creating threads */
50 int create_threads;
51 /* flag for delaying readding to inactive list */
52 int delay_inactive;
53 /* status for thread set */
54 int status;
55 /* which threads have had signals sent */
56 int signal_sent;
57 /* flag for which threads exited first */
58 int thread_clear;
59 /* Active threads in the thread set */
60 int thread_count;
61 /* Unique thread ID */
62 u32 thread_id;
63 /* pointer to connection if set is active */
64 struct iscsi_conn *conn;
65 /* used for controlling ts state accesses */
66 spinlock_t ts_state_lock;
67 /* used for restarting thread queue */
68 struct completion rx_restart_comp;
69 /* used for restarting thread queue */
70 struct completion tx_restart_comp;
71 /* used for normal unused blocking */
72 struct completion rx_start_comp;
73 /* used for normal unused blocking */
74 struct completion tx_start_comp;
75 /* OS descriptor for rx thread */
76 struct task_struct *rx_thread;
77 /* OS descriptor for tx thread */
78 struct task_struct *tx_thread;
79 /* struct iscsi_thread_set in list list head*/
80 struct list_head ts_list;
81 struct semaphore ts_activate_sem;
84 #endif /*** ISCSI_THREAD_QUEUE_H ***/