blob: cc1eede5ab3a9cc4ad09fcbe3714eae77cdfb083 [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;
Nicholas Bellingere48354c2011-07-23 06:43:04 +000067 /* 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;
Nicholas Bellinger5ab41ca2013-09-05 16:13:41 -070081 struct semaphore ts_activate_sem;
Nicholas Bellingere48354c2011-07-23 06:43:04 +000082};
83
84#endif /*** ISCSI_THREAD_QUEUE_H ***/