iscsi_transport.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #include <linux/module.h>
  2. #include <linux/list.h>
  3. #include "iscsi_target_core.h"
  4. struct iscsit_transport {
  5. #define ISCSIT_TRANSPORT_NAME 16
  6. char name[ISCSIT_TRANSPORT_NAME];
  7. int transport_type;
  8. bool rdma_shutdown;
  9. int priv_size;
  10. struct module *owner;
  11. struct list_head t_node;
  12. int (*iscsit_setup_np)(struct iscsi_np *, struct sockaddr_storage *);
  13. int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *);
  14. void (*iscsit_free_np)(struct iscsi_np *);
  15. void (*iscsit_wait_conn)(struct iscsi_conn *);
  16. void (*iscsit_free_conn)(struct iscsi_conn *);
  17. int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *);
  18. int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);
  19. int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
  20. int (*iscsit_response_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
  21. int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool);
  22. int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *);
  23. int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
  24. void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *);
  25. int (*iscsit_xmit_pdu)(struct iscsi_conn *, struct iscsi_cmd *,
  26. struct iscsi_datain_req *, const void *, u32);
  27. void (*iscsit_release_cmd)(struct iscsi_conn *, struct iscsi_cmd *);
  28. void (*iscsit_get_rx_pdu)(struct iscsi_conn *);
  29. int (*iscsit_validate_params)(struct iscsi_conn *);
  30. void (*iscsit_get_r2t_ttt)(struct iscsi_conn *, struct iscsi_cmd *,
  31. struct iscsi_r2t *);
  32. enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *);
  33. };
  34. static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd)
  35. {
  36. return (void *)(cmd + 1);
  37. }
  38. /*
  39. * From iscsi_target_transport.c
  40. */
  41. extern int iscsit_register_transport(struct iscsit_transport *);
  42. extern void iscsit_unregister_transport(struct iscsit_transport *);
  43. extern struct iscsit_transport *iscsit_get_transport(int);
  44. extern void iscsit_put_transport(struct iscsit_transport *);
  45. /*
  46. * From iscsi_target.c
  47. */
  48. extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  49. unsigned char *);
  50. extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
  51. extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  52. struct iscsi_scsi_req *);
  53. extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
  54. struct iscsi_cmd **);
  55. extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
  56. bool);
  57. extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
  58. struct iscsi_nopout *);
  59. extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
  60. struct iscsi_nopout *);
  61. extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  62. unsigned char *);
  63. extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  64. unsigned char *);
  65. extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  66. struct iscsi_text *);
  67. extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  68. struct iscsi_text *);
  69. extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
  70. bool, struct iscsi_scsi_rsp *);
  71. extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
  72. struct iscsi_nopin *, bool);
  73. extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
  74. struct iscsi_tm_rsp *);
  75. extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
  76. struct iscsi_text_rsp *,
  77. enum iscsit_transport_type);
  78. extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
  79. struct iscsi_reject *);
  80. extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
  81. struct iscsi_logout_rsp *);
  82. extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
  83. extern int iscsit_queue_rsp(struct iscsi_conn *, struct iscsi_cmd *);
  84. extern void iscsit_aborted_task(struct iscsi_conn *, struct iscsi_cmd *);
  85. extern int iscsit_add_reject(struct iscsi_conn *, u8, unsigned char *);
  86. extern int iscsit_reject_cmd(struct iscsi_cmd *, u8, unsigned char *);
  87. extern int iscsit_handle_snack(struct iscsi_conn *, unsigned char *);
  88. extern void iscsit_build_datain_pdu(struct iscsi_cmd *, struct iscsi_conn *,
  89. struct iscsi_datain *,
  90. struct iscsi_data_rsp *, bool);
  91. extern int iscsit_build_r2ts_for_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  92. bool);
  93. extern int iscsit_immediate_queue(struct iscsi_conn *, struct iscsi_cmd *, int);
  94. extern int iscsit_response_queue(struct iscsi_conn *, struct iscsi_cmd *, int);
  95. /*
  96. * From iscsi_target_device.c
  97. */
  98. extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
  99. /*
  100. * From iscsi_target_erl0.c
  101. */
  102. extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
  103. /*
  104. * From iscsi_target_erl1.c
  105. */
  106. extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
  107. /*
  108. * From iscsi_target_tmr.c
  109. */
  110. extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
  111. /*
  112. * From iscsi_target_util.c
  113. */
  114. extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int);
  115. extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
  116. unsigned char *, __be32);
  117. extern void iscsit_release_cmd(struct iscsi_cmd *);
  118. extern void iscsit_free_cmd(struct iscsi_cmd *, bool);
  119. extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *,
  120. struct iscsi_conn *, u8);
  121. /*
  122. * From iscsi_target_nego.c
  123. */
  124. extern int iscsi_target_check_login_request(struct iscsi_conn *,
  125. struct iscsi_login *);
  126. /*
  127. * From iscsi_target_login.c
  128. */
  129. extern __printf(2, 3) int iscsi_change_param_sprintf(
  130. struct iscsi_conn *, const char *, ...);
  131. /*
  132. * From iscsi_target_parameters.c
  133. */
  134. extern struct iscsi_param *iscsi_find_param_from_key(
  135. char *, struct iscsi_param_list *);