iscsi_target_tq.h 3.0 KB

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