Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/list.h> |
| 3 | #include "../../../drivers/target/iscsi/iscsi_target_core.h" |
| 4 | |
| 5 | struct iscsit_transport { |
| 6 | #define ISCSIT_TRANSPORT_NAME 16 |
| 7 | char name[ISCSIT_TRANSPORT_NAME]; |
| 8 | int transport_type; |
Nicholas Bellinger | d703ce2 | 2013-08-17 14:27:56 -0700 | [diff] [blame] | 9 | int priv_size; |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 10 | struct module *owner; |
| 11 | struct list_head t_node; |
| 12 | int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); |
| 13 | int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); |
| 14 | void (*iscsit_free_np)(struct iscsi_np *); |
Nicholas Bellinger | defd884 | 2014-02-03 12:54:39 -0800 | [diff] [blame] | 15 | void (*iscsit_wait_conn)(struct iscsi_conn *); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 16 | void (*iscsit_free_conn)(struct iscsi_conn *); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 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 *); |
Nicholas Bellinger | 131e6ab | 2014-03-22 14:55:56 -0700 | [diff] [blame] | 24 | void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *); |
Nicholas Bellinger | e70beee | 2014-04-02 12:52:38 -0700 | [diff] [blame] | 25 | enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 26 | }; |
| 27 | |
Nicholas Bellinger | d703ce2 | 2013-08-17 14:27:56 -0700 | [diff] [blame] | 28 | static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd) |
| 29 | { |
| 30 | return (void *)(cmd + 1); |
| 31 | } |
| 32 | |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 33 | /* |
| 34 | * From iscsi_target_transport.c |
| 35 | */ |
| 36 | |
| 37 | extern int iscsit_register_transport(struct iscsit_transport *); |
| 38 | extern void iscsit_unregister_transport(struct iscsit_transport *); |
| 39 | extern struct iscsit_transport *iscsit_get_transport(int); |
| 40 | extern void iscsit_put_transport(struct iscsit_transport *); |
| 41 | |
| 42 | /* |
| 43 | * From iscsi_target.c |
| 44 | */ |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 45 | extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 46 | unsigned char *); |
| 47 | extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); |
| 48 | extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 49 | struct iscsi_scsi_req *); |
| 50 | extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *, |
| 51 | struct iscsi_cmd **); |
| 52 | extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *, |
| 53 | bool); |
Nicholas Bellinger | 778de36 | 2013-06-14 16:07:47 -0700 | [diff] [blame] | 54 | extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *, |
| 55 | struct iscsi_nopout *); |
| 56 | extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *, |
| 57 | struct iscsi_nopout *); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 58 | extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 59 | unsigned char *); |
| 60 | extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 61 | unsigned char *); |
Nicholas Bellinger | 64534aa | 2013-06-14 16:46:16 -0700 | [diff] [blame] | 62 | extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 63 | struct iscsi_text *); |
| 64 | extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 65 | struct iscsi_text *); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 66 | extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *, |
| 67 | bool, struct iscsi_scsi_rsp *); |
| 68 | extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *, |
| 69 | struct iscsi_nopin *, bool); |
| 70 | extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, |
| 71 | struct iscsi_tm_rsp *); |
Nicholas Bellinger | 889c8a6 | 2013-06-14 18:49:55 -0700 | [diff] [blame] | 72 | extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *, |
Sagi Grimberg | 22c7aaa | 2014-06-10 18:27:59 +0300 | [diff] [blame] | 73 | struct iscsi_text_rsp *, |
| 74 | enum iscsit_transport_type); |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 75 | extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, |
| 76 | struct iscsi_reject *); |
| 77 | extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, |
| 78 | struct iscsi_logout_rsp *); |
| 79 | extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *); |
| 80 | /* |
| 81 | * From iscsi_target_device.c |
| 82 | */ |
| 83 | extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *); |
| 84 | /* |
Nicholas Bellinger | b2cb964 | 2013-07-03 03:05:37 -0700 | [diff] [blame] | 85 | * From iscsi_target_erl0.c |
| 86 | */ |
| 87 | extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int); |
| 88 | /* |
Nicholas Bellinger | 3f99306 | 2013-03-06 21:53:26 -0800 | [diff] [blame] | 89 | * From iscsi_target_erl1.c |
| 90 | */ |
| 91 | extern void iscsit_stop_dataout_timer(struct iscsi_cmd *); |
| 92 | |
| 93 | /* |
| 94 | * From iscsi_target_tmr.c |
| 95 | */ |
| 96 | extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *); |
| 97 | |
| 98 | /* |
| 99 | * From iscsi_target_util.c |
| 100 | */ |
Nicholas Bellinger | 676687c | 2014-01-20 03:36:44 +0000 | [diff] [blame] | 101 | extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int); |
Nicholas Bellinger | 561bf15 | 2013-07-03 03:58:58 -0700 | [diff] [blame] | 102 | extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, |
| 103 | unsigned char *, __be32); |
Nicholas Bellinger | d703ce2 | 2013-08-17 14:27:56 -0700 | [diff] [blame] | 104 | extern void iscsit_release_cmd(struct iscsi_cmd *); |