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