iscsi_target_tq.h 2.9 KB

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