blob: 547d118312820d2a39ba960b11844298810190ce [file] [log] [blame]
Nicholas Bellingere48354c2011-07-23 06:43:04 +00001#ifndef ISCSI_THREAD_QUEUE_H
2#define ISCSI_THREAD_QUEUE_H
3
4/*
5 * Defines for thread sets.
6 */
7extern int iscsi_thread_set_force_reinstatement(struct iscsi_conn *);
Nicholas Bellingere48354c2011-07-23 06:43:04 +00008extern int iscsi_allocate_thread_sets(u32);
9extern void iscsi_deallocate_thread_sets(void);
10extern void iscsi_activate_thread_set(struct iscsi_conn *, struct iscsi_thread_set *);
11extern struct iscsi_thread_set *iscsi_get_thread_set(void);
12extern void iscsi_set_thread_clear(struct iscsi_conn *, u8);
13extern void iscsi_set_thread_set_signal(struct iscsi_conn *, u8);
14extern int iscsi_release_thread_set(struct iscsi_conn *);
15extern struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *);
16extern struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *);
17extern int iscsi_thread_set_init(void);
18extern void iscsi_thread_set_free(void);
19
20extern int iscsi_target_tx_thread(void *);
21extern int iscsi_target_rx_thread(void *);
22
23#define TARGET_THREAD_SET_COUNT 4
24
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
35
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
42
43/* By default allow a maximum of 32K iSCSI connections */
44#define ISCSI_TS_BITMAP_BITS 32768
45
46struct 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 rx side post startup */
68 struct completion rx_post_start_comp;
69 /* Used for tx side post startup */
70 struct completion tx_post_start_comp;
71 /* used for restarting thread queue */
72 struct completion rx_restart_comp;
73 /* used for restarting thread queue */
74 struct completion tx_restart_comp;
75 /* used for normal unused blocking */
76 struct completion rx_start_comp;
77 /* used for normal unused blocking */
78 struct completion tx_start_comp;
79 /* OS descriptor for rx thread */
80 struct task_struct *rx_thread;
81 /* OS descriptor for tx thread */
82 struct task_struct *tx_thread;
83 /* struct iscsi_thread_set in list list head*/
84 struct list_head ts_list;
85};
86
87#endif /*** ISCSI_THREAD_QUEUE_H ***/